:root {
  color-scheme: light;
  --page: #fff8fb;
  --panel: #ffffff;
  --soft: #fff0f5;
  --soft-2: #f8f5f7;
  --pink: #e85f91;
  --pink-dark: #bb3f70;
  --pink-light: #ffd8e6;
  --text: #352932;
  --muted: #85737f;
  --line: #eddde5;
  --green: #2f9b70;
  --amber: #be7a27;
  --red: #c9465e;
  --shadow: 0 18px 50px rgba(116, 61, 86, .12);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #080a11;
  --panel: #11141d;
  --soft: #171522;
  --soft-2: #151822;
  --pink: #8d6dff;
  --pink-dark: #bca9ff;
  --pink-light: #302a49;
  --text: #f1eff8;
  --muted: #9994a8;
  --line: #292d3b;
  --green: #35d59a;
  --amber: #e9a653;
  --red: #ff7189;
  --shadow: 0 20px 55px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; color: var(--text); background: var(--page); min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button, label[for], select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
[hidden] { display: none !important; }
a { color: inherit; }

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--pink-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background-color: var(--soft);
}

.login-card {
  width: min(430px, 100%);
  padding: 38px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.login-logo { width: 84px; height: 84px; object-fit: contain; border-radius: 20px; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 8px; font-size: 27px; }
.login-card p { margin: 0 0 26px; color: var(--muted); }
.login-card form { display: grid; gap: 12px; text-align: left; }
.login-card .admin-entry { display: inline-block; margin-top: 22px; color: var(--muted); font-size: 13px; }

label { font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  outline: none;
  padding: 11px 13px;
  transition: border-color .16s, box-shadow .16s;
}
textarea { resize: vertical; line-height: 1.65; }
input:focus, textarea:focus, select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(232, 95, 145, .12); }

.primary-button, .secondary-button, .danger-button, .text-button, .close-button {
  border: 0;
  background: none;
}
.primary-button {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--pink);
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(232, 95, 145, .22);
}
.primary-button:hover { background: var(--pink-dark); }
.secondary-button {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--pink-dark);
  font-weight: 800;
}
.secondary-button:hover { border-color: var(--pink-light); background: var(--soft); }
.danger-button {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid #efc8d0;
  border-radius: 11px;
  background: white;
  color: var(--red);
  font-weight: 800;
}
.danger-button:hover { border-color: var(--red); background: #fff4f6; }
.text-button { color: var(--muted); padding: 6px 4px; font-weight: 700; text-decoration: none; }
.text-button:hover { color: var(--pink-dark); }
.full-button { width: 100%; margin-top: 4px; }
.compact-button { min-height: 34px; padding: 7px 11px; font-size: 12px; }

.site-header {
  height: 72px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(320px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand img { width: 43px; height: 43px; object-fit: contain; border-radius: 10px; }
.brand span { display: grid; }
.brand strong { font-size: 18px; letter-spacing: 0; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.media-nav { height: 100%; display: flex; align-items: center; gap: 28px; }
.media-nav button { position: relative; height: 100%; padding: 0 3px; border: 0; background: transparent; color: var(--muted); font-weight: 800; }
.media-nav button::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.media-nav button:hover { color: var(--pink-dark); }
.media-nav button.is-active { color: var(--text); }
.media-nav button.is-active::after { background: var(--pink); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 18px; }
.api-header-button, .announcement-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid var(--pink-light); border-radius: 999px; font-size: 12px; font-weight: 800; text-decoration: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.api-header-button { color: #6d5af3; border-color: #ded8ff; background: #f6f3ff; }
.announcement-button { gap: 7px; color: #7257c8; background: #f4f0ff; }
.announcement-button i { width: 7px; height: 7px; border-radius: 50%; background: #8b6be5; box-shadow: 0 0 0 4px rgba(139,107,229,.12); }
.api-header-button:hover, .announcement-button:hover { transform: translateY(-1px); border-color: var(--pink); box-shadow: 0 8px 20px rgba(126,87,112,.1); }
.balance-button {
  display: grid;
  gap: 1px;
  padding: 7px 13px;
  border: 1px solid var(--pink-light);
  border-radius: 12px;
  background: var(--soft);
  text-align: left;
}
.balance-button span { font-size: 10px; color: var(--muted); }
.balance-button strong { color: var(--pink-dark); font-size: 15px; }
.pool-status { display: flex; gap: 7px; align-items: center; font-size: 12px; color: var(--muted); }
.pool-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.pool-status i.is-online, .online-dot { background: var(--green) !important; box-shadow: 0 0 0 4px rgba(47, 155, 112, .12); }

.customer-frame {
  width: calc(100% - 36px);
  margin: 18px auto 50px;
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.customer-sidebar {
  min-height: calc(100vh - 108px);
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 35px rgba(116, 61, 86, .07);
}
.sidebar-collapse-button { position: absolute; top: 44%; right: -15px; z-index: 30; width: 30px; height: 46px; display: grid; place-items: center; padding: 0; border: 1px solid var(--pink-light); border-radius: 15px; background: white; color: var(--pink-dark); box-shadow: 0 7px 18px rgba(108,67,91,.13); font-size: 24px; line-height: 1; }
.sidebar-collapse-button:hover { border-color: var(--pink); background: var(--soft); }
.customer-frame.is-sidebar-collapsed { grid-template-columns: 62px minmax(0, 1fr); gap: 12px; }
.customer-frame.is-sidebar-collapsed .customer-sidebar { padding: 8px; border-radius: 16px; }
.customer-frame.is-sidebar-collapsed .customer-sidebar nav button { grid-template-columns: 1fr; justify-items: center; padding: 8px 4px; font-size: 0; }
.customer-frame.is-sidebar-collapsed .customer-sidebar nav button span { font-size: 18px; }
.customer-frame.is-sidebar-collapsed .sidebar-note { display: none; }
.customer-sidebar nav { display: grid; gap: 6px; }
.customer-sidebar nav button {
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 800;
}
.customer-sidebar nav button span { display: grid; place-items: center; color: var(--pink-dark); font-size: 18px; }
.customer-sidebar nav button:hover, .customer-sidebar #homeNavButton.is-active { color: var(--pink-dark); background: var(--soft); }
.customer-sidebar nav button[data-media-nav].is-active { color: var(--pink-dark); }
.sidebar-note { margin-top: auto; display: grid; gap: 5px; padding: 14px; overflow: hidden; border: 1px solid var(--pink-light); border-radius: 16px; background: var(--soft); }
.sidebar-note img { width: 54px; height: 54px; margin-bottom: 4px; border-radius: 15px; object-fit: cover; }
.sidebar-note strong { font-size: 13px; }
.sidebar-note span { color: var(--muted); font-size: 10px; line-height: 1.6; }

.customer-layout {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 18px;
  align-items: start;
}
.composer-panel, .result-panel, .admin-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 35px rgba(116, 61, 86, .07);
}
.composer-panel { min-height: calc(100vh - 116px); padding: 28px; container-type: inline-size; }
.result-panel { padding: 22px; position: sticky; top: 94px; max-height: calc(100vh - 116px); overflow: hidden; display: flex; flex-direction: column; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.section-heading h1, .section-heading h2 { margin: 0; font-size: 23px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.composer-panel > .section-heading { position: relative; min-height: 128px; align-items: center; overflow: hidden; padding: 22px 190px 22px 24px; border: 1px solid var(--pink-light); border-radius: 18px; background: var(--soft); }
.composer-panel > .section-heading .price-note { position: absolute; top: 20px; right: 116px; z-index: 2; background: rgba(255,255,255,.82); }
.hero-logo { position: absolute; width: 120px; height: 120px; right: -8px; bottom: -17px; object-fit: cover; border: 8px solid rgba(255,255,255,.55); border-radius: 38px 0 0 0; transform: rotate(-3deg); }
.compact-heading { margin-bottom: 16px; }
.price-note { color: var(--pink-dark); background: var(--soft); padding: 8px 11px; border-radius: 10px; font-size: 12px; font-weight: 800; }

fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
legend, .prompt-field > label, .parameter-grid label > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.mode-fieldset { margin-bottom: 20px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; padding: 5px; border-radius: 13px; background: var(--soft-2); }
.segmented button { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 800; }
.segmented button.is-selected { background: white; color: var(--pink-dark); box-shadow: 0 3px 12px rgba(116, 61, 86, .09); }
.segmented button.is-unavailable:not(.is-selected) { color: var(--muted); opacity: .72; }
.segmented button.is-unavailable::after { content: ''; width: 6px; height: 6px; margin-left: 7px; display: inline-block; border-radius: 50%; background: var(--amber); vertical-align: middle; }
.model-select-control select { width: 100%; min-height: 42px; padding: 9px 12px; border-color: var(--line); background: white; font-weight: 800; color: var(--pink-dark); }
.provider-select-control select { width: 100%; min-height: 42px; padding: 9px 12px; border-color: var(--line); background: white; color: var(--pink-dark); font-weight: 800; }

.composer-panel form { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(360px, 1.28fr); gap: 18px; align-items: stretch; }
.composer-top-controls { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 14px; }
.composer-top-controls .mode-fieldset { margin-bottom: 0; }
.upload-section { min-width: 0; margin-bottom: 0; }
.upload-section.is-dragging { outline: 2px solid var(--pink); outline-offset: 7px; border-radius: 14px; }
.upload-section.is-dragging .drop-zone { border-color: var(--pink); background: #fff5f9; }
.upload-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.upload-heading > div { display: flex; align-items: baseline; gap: 10px; }
.upload-heading span { font-size: 11px; color: var(--muted); }
.drop-zone { display: grid; gap: 5px; place-items: center; min-height: 166px; padding: 16px; border: 1px dashed #e5a8be; background: var(--soft); border-radius: 14px; text-align: center; }
.drop-zone.is-dragging { border-color: var(--pink); background: #ffe7ef; }
.drop-zone strong { color: var(--pink-dark); font-size: 13px; }
.drop-zone span { color: var(--muted); font-size: 11px; font-weight: 500; }
.reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; margin-top: 10px; }
.reference-card { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) 24px; gap: 9px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.reference-thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: var(--soft); display: grid; place-items: center; color: var(--pink-dark); font-size: 18px; }
.reference-card strong, .reference-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-card strong { font-size: 12px; color: var(--pink-dark); }
.reference-card small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.reference-remove { border: 0; background: transparent; color: #ae97a4; font-size: 18px; }

.prompt-field { position: relative; min-width: 0; margin-bottom: 0; }
.prompt-input-shell { position: relative; min-height: 205px; height: calc(100% - 25px); }
.prompt-field textarea { position: relative; z-index: 1; min-height: 205px; height: 100%; padding: 16px 16px 30px; resize: none; color: transparent; caret-color: var(--text); background: transparent; -webkit-text-fill-color: transparent; white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word; }
.prompt-field textarea::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); }
.prompt-highlight { position: absolute; inset: 0; right: var(--prompt-scrollbar-width, 0px); z-index: 0; overflow: hidden; box-sizing: border-box; margin: 0; padding: 16px 16px 30px; border: 1px solid transparent; border-radius: 12px; color: var(--text); font: inherit; line-height: 1.65; white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word; pointer-events: none; }
.prompt-highlight .prompt-mention { color: #2563eb; font-weight: 700; }
.prompt-input-shell.has-selection .prompt-highlight { visibility: hidden; }
.prompt-input-shell.has-selection textarea { color: var(--text); -webkit-text-fill-color: var(--text); }
.character-count { position: absolute; right: 12px; bottom: 9px; color: var(--muted); font-size: 10px; }
.mention-menu { position: absolute; left: 12px; right: 12px; bottom: 13px; transform: translateY(100%); max-height: 190px; overflow: auto; z-index: 12; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.mention-menu button { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 9px; align-items: center; padding: 7px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.mention-menu button:hover { background: var(--soft); color: var(--pink-dark); }
.mention-thumb { width: 38px; height: 38px; display: block; border-radius: 8px; object-fit: cover; background: var(--soft); }
.mention-symbol { display: grid; place-items: center; color: var(--pink-dark); font-size: 14px; }
.mention-copy { min-width: 0; display: grid; gap: 3px; }
.mention-copy strong,
.mention-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-copy strong { color: var(--pink-dark); font-size: 11px; }
.mention-copy small { color: var(--muted); font-size: 9px; }

.composer-bottom-controls { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr; gap: 14px; align-items: end; padding-top: 18px; border-top: 1px solid var(--line); }
.composer-bottom-controls .mode-fieldset { margin-bottom: 0; }
.parameter-grid { display: grid; grid-template-columns: repeat(4, minmax(105px, 1fr)); gap: 10px; margin-bottom: 0; }
.parameter-grid label { min-width: 0; }
.parameter-grid select { min-height: 42px; padding: 9px 11px; }
.submit-row { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 14px; }
.check-control { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.check-control input { width: 17px; height: 17px; accent-color: var(--pink); }
.generate-button { min-width: 190px; min-height: 48px; border-radius: 14px; }
.submit-row .generate-button { margin-left: auto; }
.compact-price { flex: 0 0 auto; min-height: 38px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--pink-light); border-radius: 12px; background: var(--soft); color: var(--pink-dark); font-size: 13px; font-weight: 900; }
.prompt-template-control { position: relative; }
.prompt-template-menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 25; width: min(380px, 78vw); max-height: 260px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.prompt-template-menu button { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.prompt-template-menu button:hover { background: var(--soft); }
.prompt-template-thumb { width: 48px; height: 40px; display: block; border-radius: 8px; object-fit: cover; background: var(--soft); }
.prompt-template-symbol { display: grid; place-items: center; color: var(--pink-dark); font-size: 13px; font-weight: 900; }
.prompt-template-copy { min-width: 0; display: grid; gap: 4px; }
.prompt-template-copy strong,
.prompt-template-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-template-copy strong { color: var(--pink-dark); font-size: 12px; }
.prompt-template-copy small, .prompt-template-empty { color: var(--muted); font-size: 10px; }
.prompt-template-empty { padding: 14px; text-align: center; }
.saved-prompt-control { position: relative; z-index: 5; display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.keep-prompt-control { min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.keep-prompt-control input { width: 15px; height: 15px; margin: 0; accent-color: var(--pink-dark); }
.saved-prompt-menu { left: auto; right: 0; top: auto; bottom: calc(100% + 8px); }
.saved-prompt-menu button { grid-template-columns: minmax(0, 1fr) auto; }
.saved-prompt-menu .prompt-template-copy { min-width: 0; }
.saved-prompt-delete { color: var(--red); font-size: 11px; }
.image-composer .saved-prompt-control { position: absolute; top: 10px; right: 10px; margin: 0; }
.image-composer .saved-prompt-menu { top: calc(100% + 8px); bottom: auto; }
.image-composer .prompt-field textarea,
.image-composer .prompt-highlight { padding-top: 58px; }

/* Keep the image composer open and lightweight; controls retain their own boundaries. */
.image-composer { border: 0; box-shadow: none; background: transparent; }
.image-composer .composer-bottom-controls { border-top: 0; }

.image-composer { grid-template-columns: minmax(340px, .9fr) minmax(360px, 1.1fr); padding: 16px; border: 0; border-radius: 18px; background: transparent; box-shadow: none; }
.image-composer .composer-top-controls { margin-bottom: 2px; }
.image-composer .upload-heading,
.image-composer .upload-section.has-references.can-add-reference .upload-heading { min-height: 36px; display: flex; align-items: center; justify-content: space-between; margin: 0 0 9px; }
.image-composer .upload-section.has-references .upload-heading > div { display: flex; }
.image-composer #referenceAddLabel { width: auto; height: 36px; min-height: 36px; display: inline-flex; align-items: center; padding: 0 13px; border-radius: 10px; font-size: 11px; }
.image-composer #referenceAddLabel::before { content: none; }
.image-composer #referenceAddLabel[hidden] { display: none; }
.image-composer .upload-section { align-self: stretch; }
.image-composer .upload-section.has-references { display: block; }
.image-composer .drop-zone { min-height: 185px; height: auto; padding: 16px; border-style: dashed; border-color: #e5a8be; background: var(--soft); }
.image-composer .drop-zone::before { content: '▧'; display: block; color: var(--pink-dark); font-size: 25px; line-height: 1; }
.image-composer .drop-zone strong { font-size: 13px; }
.image-composer .drop-zone span { font-size: 10px; }
.image-composer .reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; align-content: start; max-height: none; margin-top: 0; padding-right: 0; overflow: visible; }
.image-composer .reference-card { min-height: 58px; grid-template-columns: 48px minmax(0, 1fr) 20px; align-content: center; padding: 7px; }
.image-composer .reference-thumb { width: 48px; height: 48px; }
.image-composer .prompt-field > label { display: none; }
.image-composer .prompt-input-shell { min-height: 132px; height: 100%; }
.image-composer .prompt-field textarea { min-height: 132px; height: 100%; padding: 18px 18px 32px; border-color: var(--line); font-size: 15px; line-height: 1.65; }
.image-composer .prompt-highlight { padding: 18px 18px 32px; font-size: 15px; line-height: 1.65; }
.image-composer .composer-bottom-controls { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.image-composer .model-fieldset { flex: 1 1 220px; }
.image-composer .model-fieldset legend, .image-composer .parameter-grid label > span { display: none; }
.image-composer .parameter-grid { flex: 2 1 420px; display: flex; gap: 7px; }
.image-composer .parameter-grid label { flex: 1 1 82px; }
.image-composer .parameter-grid select, .image-composer .model-select-control select { min-height: 40px; padding: 8px 10px; border-radius: 11px; }
.image-composer .submit-row { flex: 1 1 100%; padding-top: 4px; gap: 8px; }
.image-composer .generate-button { min-width: 136px; min-height: 42px; border-radius: 12px; }
@container (max-width: 760px) {
  .image-composer { grid-template-columns: 1fr; }
  .image-composer .upload-section,
  .image-composer .prompt-field,
  .image-composer .composer-top-controls,
  .image-composer .composer-bottom-controls {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
  }
  .image-composer .prompt-input-shell,
  .image-composer .prompt-field textarea,
  .image-composer .prompt-field .prompt-highlight { max-width: 100%; min-width: 0; }
}
@container (max-width: 430px) {
  .image-composer .reference-grid { grid-template-columns: 1fr; }
}
.prompt-template-settings { display: grid; gap: 8px; }
.prompt-template-settings textarea { min-height: 130px; resize: vertical; }
.template-management { max-width: 860px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.template-management-heading { margin-bottom: 12px; }
.template-management-heading h3 { margin: 0; font-size: 15px; }
.template-management-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.template-management-toolbar { display: grid; grid-template-columns: minmax(190px, 1fr) 130px auto auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.template-management-toolbar input,
.template-management-toolbar select { min-height: 35px; padding: 7px 9px; border-radius: 8px; font-size: 11px; }
.template-management-toolbar span { min-width: max-content; color: var(--muted); font-size: 10px; }
.template-management-list { display: grid; gap: 7px; }
.template-management-item { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.template-management-preview { position: relative; width: 104px; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--soft-2); }
.template-management-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.template-management-preview span { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.template-management-preview label { position: absolute; right: 5px; bottom: 5px; padding: 4px 6px; border-radius: 6px; color: white; background: rgba(53, 41, 50, .78); font-size: 9px; }
.template-management-body { min-width: 0; display: grid; gap: 9px; }
.template-management-copy { min-width: 0; display: grid; gap: 3px; }
.template-management-copy > span { width: max-content; max-width: 100%; padding: 2px 5px; border-radius: 5px; color: var(--pink-dark); background: var(--soft); font-size: 9px; font-weight: 800; }
.template-management-copy strong, .template-management-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-management-copy strong { font-size: 12px; }
.template-management-copy small { color: var(--muted); font-size: 10px; }
.template-management-controls { display: flex; align-items: center; gap: 8px; }
.template-management-fields { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(100px, .45fr); gap: 8px; }
.template-management-fields label:last-child { grid-column: 1 / -1; }
.template-management-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 9px; }
.template-management-fields input,
.template-management-fields textarea { padding: 7px 9px; border-radius: 7px; font-size: 11px; }
.template-management-fields textarea { min-height: 70px; resize: vertical; }
.template-management-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.template-management-controls .check-control { min-width: max-content; font-size: 11px; }
.template-management-controls .small-action { min-width: max-content; padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.template-management-controls .small-action.is-selected { border-color: #dca0b6; color: var(--pink-dark); background: var(--soft); }
.template-management-controls .small-action:disabled { cursor: default; opacity: .34; }
.template-management-empty { padding: 18px; border: 1px dashed #dfb5c4; border-radius: 10px; color: var(--muted); font-size: 11px; text-align: center; }

.video-stage { min-height: 240px; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; background: #2f2730; border-radius: 15px; }
.video-stage video { width: 100%; max-height: 460px; background: #1d191d; }
.video-stage .image-result { display: block; width: 100%; max-height: 620px; object-fit: contain; background: #1d191d; }
.result-gallery { width: 100%; display: grid; grid-template-columns: 1fr; gap: 10px; padding: 10px; }
.result-gallery.is-multiple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-gallery figure { min-width: 0; margin: 0; display: grid; justify-items: center; gap: 8px; overflow: hidden; }
.work-result { position: relative; overflow: visible !important; }
.work-menu-shell { position: absolute; z-index: 14; top: 12px; right: 12px; }
.work-menu-trigger { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.88); border-radius: 9px; color: #5b4d56; background: rgba(255,255,255,.94); box-shadow: 0 5px 14px rgba(45,31,42,.14); }
.work-menu-trigger::before { content: ''; width: 3px; height: 3px; border-radius: 50%; background: currentColor; box-shadow: -6px 0 currentColor, 6px 0 currentColor; }
.work-menu-trigger:hover, .work-menu-trigger[aria-expanded="true"] { color: var(--pink-dark); border-color: var(--pink-light); background: #fff; }
.work-menu { position: absolute; top: calc(100% + 5px); right: 0; width: 168px; overflow: hidden; padding: 5px; border: 1px solid rgba(64,48,59,.12); border-radius: 12px; background: rgba(255,255,255,.985); box-shadow: 0 12px 30px rgba(38,28,36,.16); text-align: left; backdrop-filter: blur(16px); }
.work-menu[hidden] { display: none; }
.work-menu a, .work-menu button { width: 100%; min-height: 32px; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; padding: 5px 8px; border: 0; border-radius: 7px; color: #302a2f; background: transparent; text-decoration: none; font-size: 11.5px; font-weight: 650; text-align: left; }
.work-menu a:hover, .work-menu button:hover { color: var(--pink-dark); background: var(--soft); }
.work-menu span { display: grid; place-items: center; color: #6b6068; line-height: 1; }
.work-menu svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.work-menu hr { height: 1px; margin: 4px 5px; border: 0; background: rgba(70,51,64,.11); }
.work-menu .is-danger { color: var(--red); }
.work-menu .is-danger span { color: var(--red); }
.work-menu .is-danger:hover { color: var(--red); background: #fff0f3; }
.result-gallery figure img,
.result-gallery figure video { width: 100%; max-height: 470px; display: block; object-fit: contain; background: #1d191d; }
.result-media-buttons { display: flex; justify-content: center; gap: 8px; }
.result-copy-button { display: inline-flex; align-items: center; gap: 6px; }
.result-copy-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.image-result-open { position: relative; width: 100%; min-width: 0; padding: 0; overflow: hidden; border: 0; border-radius: 10px; background: #1d191d; cursor: zoom-in; }
.video-result-actions { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; color: #f7edf2; }
.video-result-actions small { color: #d9c7d1; }
.empty-state { display: grid; place-items: center; gap: 7px; color: #e8dce3; text-align: center; }
.empty-state > span { font-size: 45px; color: #f2a4bf; }
.empty-state small { color: #a995a1; }
.job-heading { display: flex; justify-content: space-between; align-items: center; margin: 21px 0 10px; }
.job-heading > div { display: grid; gap: 3px; }
.job-heading small { color: var(--muted); font-size: 10px; }
.job-list { display: grid; gap: 8px; }
.job-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; cursor: pointer; }
.job-item:hover, .job-item.is-active { border-color: #e8a9bf; background: var(--soft); }
.job-item strong, .job-item small { display: block; }
.job-item strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.job-item small { color: var(--muted); margin-top: 5px; font-size: 10px; }
.job-item.is-failed { border-color: #efbfd0; background: #fff9fb; }
.job-failure-reason,
.job-refund-state { display: block; margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.job-failure-reason { color: #b32f59; font-weight: 800; }
.job-refund-state { color: var(--green); font-weight: 800; }
.job-item-side { display: grid; justify-items: end; gap: 7px; }
.job-copy-button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--pink-dark); background: var(--panel); }
.job-copy-button:hover { border-color: var(--pink-light); background: var(--soft); }
.job-copy-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.status-badge { align-self: start; padding: 4px 7px; border-radius: 7px; background: var(--soft-2); color: var(--muted); font-size: 10px; font-weight: 800; }
.status-badge.succeeded, .status-badge.ready { color: var(--green); background: #e9f7f1; }
.status-badge.failed, .status-badge.error, .status-badge.revoked { color: var(--red); background: #fff0f2; }
.status-badge.running, .status-badge.uploading, .status-badge.submitting, .status-badge.dispatching, .status-badge.preparing { color: var(--amber); background: #fff6e9; }

dialog { width: min(440px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(53, 41, 50, .36); backdrop-filter: blur(4px); }
dialog form { padding: 24px; display: grid; gap: 12px; }
.account-dialog { width: min(680px, calc(100% - 28px)); max-height: min(820px, calc(100vh - 28px)); overflow: hidden; background: var(--panel); }
.access-dialog { width: min(430px, calc(100% - 28px)); background: var(--panel); }
.access-dialog-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.guest-access-button { white-space: nowrap; }
.upload-consent-dialog { width: min(560px, calc(100% - 28px)); background: var(--panel); }
.upload-consent-dialog form { gap: 16px; }
.upload-consent-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.upload-consent-checks { display: grid; gap: 10px; }
.upload-consent-checks label { display: flex; align-items: flex-start; gap: 9px; color: var(--text); font-size: 14px; line-height: 1.5; }
.upload-consent-checks input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--pink-dark); }
.upload-consent-checks a { color: var(--pink-dark); text-decoration: underline; text-underline-offset: 2px; }
.upload-consent-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 2px; }
.upload-consent-actions button { min-width: 88px; }
.announcement-dialog { width: min(500px, calc(100% - 24px)); max-height: calc(100vh - 24px); overflow: hidden; background: var(--panel); }
.announcement-dialog-card { position: relative; max-height: calc(100vh - 26px); overflow-y: auto; padding: 28px; }
.announcement-close { position: absolute; top: 17px; right: 18px; z-index: 2; width: 36px; height: 36px; padding: 0; border-radius: 10px; background: var(--soft-2); }
.announcement-kicker { display: inline-flex; align-items: center; gap: 7px; color: #7257c8; font-size: 10px; font-weight: 900; }
.announcement-kicker i { width: 7px; height: 7px; border-radius: 50%; background: #8b6be5; }
.announcement-dialog h2 { margin: 13px 44px 10px 0; font-size: 23px; }
.announcement-dialog p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 13px; line-height: 1.8; }
.announcement-dialog-card > small { display: block; margin-top: 16px; color: var(--muted); font-size: 10px; }
.announcement-dialog .full-button { margin-top: 20px; }
.account-dialog form { max-height: calc(100vh - 30px); overflow-y: auto; gap: 16px; }
.account-balance-hero { display: grid; gap: 5px; padding: 18px 20px; border: 1px solid var(--pink-light); border-radius: 14px; background: var(--soft); }
.account-balance-hero span { color: var(--muted); font-size: 11px; font-weight: 800; }
.account-balance-hero strong { color: var(--pink-dark); font-size: 28px; }
.account-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.account-summary-grid div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft-2); }
.account-summary-grid span, .account-summary-grid strong { display: block; }
.account-summary-grid span { color: var(--muted); font-size: 10px; }
.account-summary-grid strong { margin-top: 5px; font-size: 15px; }
.account-history-section { min-height: 180px; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
.account-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-history-filters { display: flex; gap: 4px; }
.account-history-filters button { min-height: 28px; padding: 4px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; }
.account-history-filters button.is-selected { border-color: var(--pink-light); background: var(--soft); color: var(--pink-dark); }
.account-transaction-list { max-height: 280px; display: grid; align-content: start; overflow-y: auto; border-top: 1px solid var(--line); }
.account-transaction-item { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 3px; border-bottom: 1px solid var(--line); }
.account-transaction-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-weight: 900; }
.account-transaction-icon.is-income { color: #167853; background: #e9f7f1; }
.account-transaction-icon.is-expense { color: #b43b5d; background: #fff0f3; }
.account-transaction-copy, .account-transaction-amount { min-width: 0; display: grid; gap: 4px; }
.account-transaction-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.account-transaction-copy small, .account-transaction-amount small { color: var(--muted); font-size: 9px; }
.account-transaction-amount { justify-items: end; text-align: right; }
.account-transaction-amount strong { font-size: 12px; }
.account-transaction-amount.is-income strong, .transaction-amount.is-income { color: var(--green); }
.account-transaction-amount.is-expense strong, .transaction-amount.is-expense { color: var(--red); }
.account-history-empty { padding: 35px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.account-redeem-section { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.account-redeem-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.account-redeem-row .primary-button { min-width: 100px; }
.transaction-dialog { width: min(980px, calc(100% - 28px)); max-height: calc(100vh - 28px); overflow: hidden; background: var(--panel); }
.transaction-dialog-card { max-height: calc(100vh - 30px); display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 16px; overflow: hidden; padding: 24px; }
.transaction-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.transaction-summary div { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft-2); }
.transaction-summary span, .transaction-summary strong { display: block; }
.transaction-summary span { color: var(--muted); font-size: 10px; }
.transaction-summary strong { margin-top: 5px; }
.transaction-table-wrap { min-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.transaction-table-wrap table { width: 100%; border-collapse: collapse; }
.transaction-table-wrap th { position: sticky; top: 0; z-index: 1; background: var(--soft-2); }
.status-badge.transaction-refund, .status-badge.transaction-recharge { color: var(--green); background: #e9f7f1; }
.status-badge.transaction-spend { color: var(--red); background: #fff0f2; }

@keyframes theme-eyes { 0%, 22% { opacity: 0; transform: scaleX(.2); } 45%, 75% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1.6); } }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 5px; }
.dialog-heading h2 { margin: 0; }
.close-button { font-size: 24px; color: var(--muted); }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(420px, calc(100% - 44px)); padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: #382d35; color: white; box-shadow: var(--shadow); }
.toast.is-error { background: #8e3347; }

/* Admin */
.admin-body { background: #fbf9fa; }
.admin-main { width: min(1760px, calc(100% - 40px)); margin: 28px auto 60px; }
.admin-title { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 22px; }
.admin-title h1 { margin: 0; font-size: 26px; }
.admin-title p { margin: 7px 0 0; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.summary-item { padding: 17px; background: white; border: 1px solid var(--line); border-left: 4px solid var(--pink-light); border-radius: 14px; }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: 11px; }
.summary-item strong { margin-top: 7px; font-size: 22px; }
.admin-tabs { display: flex; gap: 3px; overflow-x: auto; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-tabs button { min-width: max-content; padding: 12px 17px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 800; }
.admin-tabs button.is-active { color: var(--pink-dark); border-color: var(--pink); }
.admin-panel { padding: 22px; border-radius: 16px; }
.admin-panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 17px; }
.admin-panel-heading h2 { margin: 0; font-size: 19px; }
.admin-panel-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.heading-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; align-items: end; padding: 15px; margin-bottom: 17px; background: var(--soft-2); border-radius: 12px; }
.inline-form label { display: grid; gap: 7px; }
.wide-form { grid-template-columns: minmax(320px, 1fr) auto; }
.wide-form label { grid-column: 1; }
.wide-form textarea { grid-column: 1; }
.wide-form button { grid-column: 2; grid-row: 2; }
.quota-form { grid-template-columns: 180px 180px auto; justify-content: start; }
.provider-settings-form { display: grid; gap: 14px; max-width: none; }
.admin-panel[data-panel="settings"] { width: 100%; }
#providerSettingsRows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.provider-setting-row { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.provider-setting-row .provider-setting-body { grid-template-columns: minmax(150px, .8fr) minmax(180px, 1fr); }
.provider-setting-row .provider-model-list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.concurrency-settings, .announcement-settings { margin: 0 0 6px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.concurrency-settings legend, .announcement-settings legend { padding: 0 7px; font-weight: 850; }
.concurrency-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; }
.concurrency-grid label { display: grid; gap: 7px; }
.announcement-settings { display: grid; gap: 12px; background: white; }
.announcement-settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.announcement-settings-grid > label:first-child, .announcement-settings > label { display: grid; gap: 7px; }
.announcement-settings-grid .check-control { min-height: 43px; padding: 0 4px; }
.announcement-list-editor { display: grid; gap: 12px; }
.announcement-editor-item { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft-2); }
.announcement-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--pink-dark); }
.announcement-editor-item label { display: grid; gap: 7px; }
.announcement-editor-empty { padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }
.settings-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.provider-setting-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.provider-setting-row label { display: grid; gap: 7px; }
.provider-setting-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; }
.provider-setting-summary > div { min-width: 0; display: grid; gap: 5px; }
.provider-setting-summary strong, .provider-setting-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-setting-summary small { color: var(--muted); font-size: 11px; }
.provider-setting-body { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) minmax(220px, 1fr); gap: 14px; align-items: start; padding: 16px 0 4px; }
.provider-setting-row.is-collapsed .provider-setting-body { display: none; }
.provider-price-matrix { grid-column: 1 / -1; padding: 0; border: 0; }
.provider-price-matrix legend { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
.provider-model-list { grid-column: 1 / -1; padding: 0; border: 0; }
.provider-model-list legend { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
.provider-model-pricing-note { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 800; }
.provider-model-list-grid { display: grid; gap: 8px; }
.provider-model-item { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft-2); }
.provider-model-item strong { color: var(--text); font-size: 13px; }
.provider-model-item code { color: var(--pink-dark); font-size: 11px; overflow-wrap: anywhere; }
.provider-model-item small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.provider-model-item > label { display: grid; gap: 6px; }
.provider-model-item > label span, .provider-model-price-fields label span { color: var(--muted); font-size: 11px; font-weight: 800; }
.provider-model-price-fields { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 8px; }
.provider-model-price-fields label { display: grid; gap: 6px; }
.canvas-key-form { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.4fr) auto; gap: 12px; align-items: end; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft-2); }
.canvas-key-copy { display: grid; gap: 5px; align-self: center; }
.canvas-key-copy strong { font-size: 14px; }
.canvas-key-copy span { color: var(--muted); font-size: 11px; }
.canvas-key-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.canvas-model-list { display: grid; gap: 9px; }
.canvas-model-item { min-width: 0; display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(280px, 1.8fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.canvas-model-copy, .canvas-model-specs { min-width: 0; display: grid; gap: 5px; }
.canvas-model-copy > div { display: flex; align-items: center; gap: 7px; }
.canvas-model-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.canvas-model-copy code { overflow: hidden; color: var(--pink-dark); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.canvas-model-specs span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.canvas-model-actions { display: flex; gap: 6px; justify-content: flex-end; }
.canvas-model-empty { padding: 34px 16px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.canvas-model-dialog { width: min(820px, calc(100% - 28px)); max-height: calc(100vh - 28px); overflow: hidden; background: var(--panel); }
.canvas-model-dialog form { max-height: calc(100vh - 30px); overflow-y: auto; }
.canvas-model-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.canvas-model-form-grid label, .canvas-pricing-grid label, .canvas-reference-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.canvas-form-wide { grid-column: 1 / -1; }
.canvas-duration-fieldset, .canvas-reference-fieldset { padding: 13px; border: 1px solid var(--line); border-radius: 8px; }
.canvas-duration-fieldset legend, .canvas-reference-fieldset legend { padding: 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.canvas-duration-grid { display: grid; grid-template-columns: repeat(10, minmax(42px, 1fr)); gap: 5px; }
.canvas-duration-grid label { min-width: 0; height: 32px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft-2); font-size: 10px; font-weight: 800; }
.canvas-duration-grid input { width: 13px; height: 13px; }
.canvas-reference-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.canvas-pricing-grid { display: grid; grid-template-columns: minmax(180px, .6fr) minmax(180px, 1fr); gap: 12px; align-items: end; }
.canvas-rate-fields { grid-column: 2; display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 8px; }
.canvas-rate-fields[hidden] { display: none; }
.canvas-enabled-control { width: fit-content; }
.price-matrix-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px 14px; }
.price-matrix-grid label { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft-2); }
.price-matrix-grid span { color: var(--muted); font-size: 11px; font-weight: 800; }
.provider-identity { display: grid; gap: 12px; align-self: stretch; align-content: center; }
.provider-identity .check-control { display: flex; }
.provider-settings-form > button { justify-self: start; }
.activation-code { display: flex; align-items: center; gap: 8px; min-width: 280px; }
.activation-code code { max-width: 330px; overflow-wrap: anywhere; color: var(--pink-dark); font-size: 11px; }
.secret-result { margin: 0 0 17px; padding: 14px; border: 1px solid #e7b4c7; border-radius: 12px; background: var(--soft); color: var(--pink-dark); word-break: break-all; white-space: pre-wrap; font: 12px/1.7 Consolas, monospace; }
.management-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, auto) minmax(130px, auto) auto auto auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}
.management-toolbar input, .management-toolbar select { min-height: 38px; padding: 8px 11px; border-radius: 9px; }
.management-toolbar .result-count { min-width: max-content; color: var(--muted); font-size: 11px; text-align: right; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 12px; }
th { color: var(--muted); font-size: 11px; }
td .row-title { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
td .row-subtitle { display: block; color: var(--muted); margin-top: 4px; font-size: 10px; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.selection-cell { width: 38px; text-align: center; }
.selection-cell input, td > input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--pink); }
.small-action { border: 0; background: none; color: var(--pink-dark); font-size: 11px; font-weight: 800; }
.small-action.danger { color: var(--red); }
.table-pagination { min-height: 36px; display: flex; justify-content: flex-end; align-items: center; gap: 9px; padding-top: 10px; color: var(--muted); font-size: 11px; }
.table-pagination button { min-width: 34px; height: 30px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--pink-dark); font-weight: 800; }
.table-pagination button:disabled { cursor: default; }
.log-table td:nth-child(4) { max-width: 760px; overflow-wrap: anywhere; }
.admin-log-list { display: grid; gap: 7px; }
.log-line { display: grid; grid-template-columns: 150px 55px minmax(0, 1fr); gap: 12px; padding: 9px 11px; border-bottom: 1px solid var(--line); font-size: 11px; }
.log-line time { color: var(--muted); }
.log-line .error { color: var(--red); }
.log-line .warn { color: var(--amber); }

@media (max-width: 1350px) {
  .customer-frame { grid-template-columns: 74px minmax(0, 1fr); }
  .customer-sidebar { padding: 10px; }
  .customer-sidebar nav button { grid-template-columns: 1fr; justify-items: center; padding: 8px 4px; font-size: 10px; text-align: center; }
  .customer-sidebar .sidebar-note { display: none; }
}

@media (max-width: 1180px) {
  .customer-layout { grid-template-columns: 1fr; }
  .result-panel { position: static; max-height: none; }
  .composer-panel { min-height: auto; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 920px) {
  .composer-panel form, .composer-bottom-controls { grid-template-columns: 1fr; }
  .composer-top-controls { grid-template-columns: 1fr; }
  .prompt-input-shell, .prompt-field textarea { min-height: 170px; height: 170px; }
}

@media (max-width: 720px) {
  .result-gallery.is-multiple { grid-template-columns: 1fr; }
  .site-header { height: auto; grid-template-columns: 1fr auto; padding: 11px 15px; align-items: center; }
  .media-nav { grid-column: 1 / -1; grid-row: 2; height: 42px; justify-content: center; gap: 34px; border-top: 1px solid var(--line); }
  .header-actions { gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
  .pool-status { display: none; }
  .customer-frame { width: calc(100% - 22px); margin-top: 12px; grid-template-columns: 1fr; }
  .customer-sidebar { min-height: 0; position: static; padding: 6px; border-radius: 14px; overflow-x: auto; }
  .customer-sidebar { scrollbar-width: none; }
  .customer-sidebar::-webkit-scrollbar { display: none; }
  .customer-sidebar nav { display: flex; min-width: max-content; }
  .customer-sidebar nav button { min-width: 82px; min-height: 40px; display: flex; justify-content: center; font-size: 11px; }
  .customer-sidebar nav button span { font-size: 14px; }
  .customer-layout, .admin-main { width: 100%; margin-top: 0; }
  .composer-panel, .result-panel, .admin-panel { border-radius: 15px; }
  .composer-panel, .admin-panel { padding: 16px; }
  .composer-panel > .section-heading { min-height: 112px; padding: 18px 108px 18px 18px; }
  .composer-panel > .section-heading p { display: none; }
  .composer-panel > .section-heading .price-note { top: auto; right: 94px; bottom: 16px; }
  .hero-logo { width: 90px; height: 90px; right: -5px; bottom: -8px; border-width: 5px; }
  .composer-panel form, .composer-top-controls, .composer-bottom-controls { grid-template-columns: 1fr; }
  .composer-top-controls, .composer-bottom-controls { gap: 14px; }
  .drop-zone { min-height: 112px; }
  .prompt-input-shell, .prompt-field textarea { min-height: 160px; height: 160px; }
  .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submit-row { align-items: stretch; flex-direction: column; }
  .generate-button { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-title, .admin-panel-heading { align-items: stretch; flex-direction: column; }
  .management-toolbar { grid-template-columns: 1fr 1fr; }
  .management-toolbar input[type="search"] { grid-column: 1 / -1; }
  .management-toolbar .result-count { text-align: left; }
  .inline-form, .wide-form, .quota-form { grid-template-columns: 1fr; }
  .provider-setting-body { grid-template-columns: 1fr; }
  #providerSettingsRows { grid-template-columns: 1fr; }
  .provider-setting-row .provider-model-list-grid { grid-template-columns: 1fr; }
  .canvas-key-form, .canvas-model-item { grid-template-columns: 1fr; }
  .canvas-model-actions { justify-content: flex-start; }
  .canvas-model-form-grid, .canvas-pricing-grid { grid-template-columns: 1fr; }
  .canvas-rate-fields { grid-column: 1; }
  .canvas-duration-grid { grid-template-columns: repeat(5, minmax(42px, 1fr)); }
  .concurrency-grid { grid-template-columns: 1fr; }
  .announcement-settings-grid { grid-template-columns: 1fr; }
  .price-matrix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wide-form label, .wide-form textarea, .wide-form button { grid-column: 1; grid-row: auto; }
  .login-card { padding: 28px 22px; }
  .account-dialog form, .transaction-dialog-card { padding: 18px 14px; }
  .account-summary-grid { grid-template-columns: 1fr; }
  .account-summary-grid div { display: flex; align-items: center; justify-content: space-between; }
  .account-summary-grid strong { margin-top: 0; }
  .account-history-heading { align-items: flex-start; flex-direction: column; }
  .account-transaction-item { grid-template-columns: 30px minmax(0, 1fr); }
  .account-transaction-amount { grid-column: 2; justify-items: start; text-align: left; }
  .account-redeem-row { grid-template-columns: 1fr; }
  .transaction-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.login-api-button { position: absolute; top: 24px; right: 28px; z-index: 2; }

body .image-composer .prompt-field textarea,
body .image-composer .prompt-field .prompt-highlight { padding-top: 58px; }

/* Saved prompts sit in a separate toolbar above, never inside the prompt box. */
body .image-composer .prompt-field { display: flex; flex-direction: column; }
body .image-composer .saved-prompt-control {
  position: relative;
  top: auto;
  right: auto;
  flex: 0 0 auto;
  justify-content: flex-end;
  margin: 0 0 8px;
}
body .image-composer .prompt-input-shell { flex: 1 1 auto; height: auto; }
body .image-composer .prompt-field textarea,
body .image-composer .prompt-field .prompt-highlight { padding-top: 18px; }

/* Customer workspace v11 */
.brand-button {
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.customer-workspace { min-width: 0; }
.workspace-view { width: 100%; }
.customer-sidebar nav button.is-active {
  color: var(--pink-dark);
  background: var(--soft);
}
.customer-sidebar nav button[data-media-nav].is-active { background: var(--soft); }

.home-view { display: grid; gap: 18px; }
.home-hero {
  min-height: 286px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  overflow: hidden;
  border: 1px solid var(--pink-light);
  border-radius: 20px;
  background: #ffe8f0;
  box-shadow: 0 10px 35px rgba(116, 61, 86, .07);
}
.home-hero-copy { align-self: center; padding: 30px 24px 28px 48px; }
.home-hero-copy h1 { margin: 0; font-size: 30px; }
.home-hero-copy > p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.home-hero-art {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 11px;
  padding: 24px;
  background: #f8ddea;
}
.home-hero-art::before,
.home-hero-art::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, .58);
  transform: rotate(45deg);
}
.home-hero-art::before { width: 18px; height: 18px; left: 28px; top: 46px; }
.home-hero-art::after { width: 10px; height: 10px; right: 32px; bottom: 48px; }
.home-hero-art img {
  position: relative;
  z-index: 1;
  width: 142px;
  height: 142px;
  border: 8px solid rgba(255, 255, 255, .76);
  border-radius: 38px;
  object-fit: cover;
  box-shadow: 0 18px 36px rgba(142, 65, 96, .16);
  transform: rotate(2deg);
}
.home-hero-art span { position: relative; z-index: 1; color: var(--pink-dark); font-size: 12px; font-weight: 800; }

.home-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.shortcut-item {
  min-height: 88px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  text-align: left;
  box-shadow: 0 8px 26px rgba(116, 61, 86, .05);
}
.shortcut-item:hover { border-color: var(--pink-light); transform: translateY(-1px); }
.shortcut-item > span:nth-child(2) { min-width: 0; display: grid; gap: 5px; }
.shortcut-item strong { font-size: 16px; }
.shortcut-item small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.shortcut-item > b { color: var(--muted); font-size: 24px; font-weight: 400; }
.shortcut-symbol {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #c43f72;
  background: #ffe1eb;
  font-size: 18px;
}
.shortcut-image .shortcut-symbol { color: #7055ae; background: #eee7ff; }

.inspiration-section { padding-bottom: 18px; }
.home-template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.image-template-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.image-template-card:hover { border-color: #df98b2; box-shadow: 0 9px 20px rgba(116, 61, 86, .09); transform: translateY(-2px); }
.template-art {
  position: relative;
  min-width: 0;
  height: 84px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  color: #7e3657;
  background: #f6dbe5;
}
.template-art::before,
.template-art::after,
.template-art i { content: ''; position: absolute; display: block; border: 1px solid rgba(255,255,255,.65); }
.template-art::before { width: 58px; height: 58px; transform: translate(-18px, -16px) rotate(16deg); }
.template-art::after { width: 42px; height: 42px; right: -14px; bottom: -16px; transform: rotate(28deg); }
.template-art i { width: 28px; height: 70px; right: 14px; top: 12px; transform: rotate(24deg); background: rgba(255,255,255,.22); }
.template-art b { position: relative; z-index: 1; padding: 7px 8px; border: 1px solid rgba(255,255,255,.8); background: rgba(255,255,255,.64); color: currentColor; font-size: 14px; font-weight: 900; }
.template-art.has-image::before,
.template-art.has-image::after { display: none; }
.template-art.has-image img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .22s ease; }
.image-template-card:hover .template-art.has-image img { transform: scale(1.035); }
.tone-rose { color: #a13d66; background: #f8d4e0; }
.tone-plum { color: #694387; background: #e7d8f3; }
.tone-peach { color: #ad5e48; background: #f9ddcf; }
.tone-mint { color: #36816e; background: #cdece0; }
.tone-sun { color: #a26e27; background: #f8e6be; }
.tone-sky { color: #37769b; background: #cde9f5; }
.tone-coral { color: #a65458; background: #f8d6d3; }
.tone-gold { color: #8b6829; background: #f0e2b2; }
.tone-lavender { color: #7356a4; background: #e3dcf5; }
.tone-lemon { color: #7b7330; background: #eef0bf; }
.tone-sand { color: #846749; background: #eedec9; }
.tone-slate { color: #4e6a78; background: #d7e1e5; }
.tone-blue { color: #416da0; background: #d9e7fb; }
.tone-teal { color: #347a78; background: #cce8e4; }
.tone-custom { color: #9b4f7e; background: #f1d8e8; }
.template-card-copy { min-width: 0; display: grid; gap: 5px; }
.template-category { width: max-content; max-width: 100%; overflow: hidden; padding: 3px 6px; border: 1px solid rgba(176, 96, 130, .2); border-radius: 6px; color: var(--pink-dark); background: var(--soft); font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.template-card-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.template-card-copy small { min-height: 29px; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.45; }
.template-open { color: var(--pink-dark); font-size: 19px; font-weight: 500; }
.image-template-card.is-compact { grid-template-columns: 58px minmax(0, 1fr); gap: 9px; padding: 9px; }
.image-template-card.is-compact .template-art { height: 65px; border-radius: 10px; }
.image-template-card.is-compact .template-art b { padding: 5px; font-size: 11px; }
.image-template-card.is-compact .template-art i { display: none; }
.image-template-card.is-compact .template-card-copy { gap: 3px; }
.image-template-card.is-compact .template-category { font-size: 8px; }
.image-template-card.is-compact .template-card-copy strong { font-size: 11px; }
.image-template-card.is-compact .template-card-copy small { min-height: 28px; font-size: 9px; }
.image-template-card.is-compact .template-open { display: none; }

.templates-view { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.templates-view > * { min-width: 0; width: 100%; }
.templates-page-heading {
  min-height: 126px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 26px 28px;
  border: 1px solid var(--pink-light);
  border-radius: 18px;
  background: #f9e8ef;
}
.templates-page-heading h1 { margin: 0; font-size: 25px; }
.templates-page-heading > div { min-width: 0; }
.templates-page-heading p { margin: 7px 0 0; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.templates-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.template-filter-control { min-width: 0; max-width: 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.template-filter-control::-webkit-scrollbar { display: none; }
.template-filter-control button { min-width: max-content; padding: 8px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.template-filter-control button.is-selected { color: var(--pink-dark); background: var(--soft); }
.template-search { width: min(270px, 32vw); min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; }
.template-search span { font-size: 17px; line-height: 1; }
.template-search input { width: 100%; min-width: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.template-result-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.template-result-meta strong { color: var(--pink-dark); font-size: 12px; }
.template-card-grid { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.template-card-grid .image-template-card { min-height: 108px; }
.template-empty { grid-column: 1 / -1; min-height: 180px; display: grid; place-content: center; gap: 7px; border: 1px dashed #dcb4c3; border-radius: 14px; color: var(--muted); text-align: center; }
.template-empty strong { color: var(--pink-dark); font-size: 14px; }
.template-empty span { font-size: 11px; }

.template-preview-dialog { width: min(900px, calc(100% - 28px)); height: min(640px, calc(100vh - 28px)); max-height: calc(100vh - 28px); overflow: hidden; }
.template-preview-dialog[open] { animation: template-dialog-in .18s ease-out; }
.template-preview-shell { position: relative; height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 560px) minmax(300px, 340px); }
.template-preview-close { position: absolute; z-index: 2; top: 12px; right: 12px; color: var(--text); background: rgba(255,255,255,.9); box-shadow: 0 4px 15px rgba(53,41,50,.1); }
.template-preview-media { min-height: 0; display: grid; place-items: center; overflow: hidden; background: var(--soft-2); }
.template-preview-media img { width: 100%; height: 100%; min-height: 0; display: block; object-fit: contain; }
.template-preview-media span { color: var(--pink-dark); font-size: 68px; font-weight: 900; }
.template-preview-content { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 40px 30px 28px; background: white; }
.template-preview-content h2 { margin: 13px 0 7px; font-size: 23px; }
.template-preview-content > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.template-preview-prompt { flex: 1 1 auto; min-height: 96px; margin: 24px 0; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft-2); }
.template-preview-prompt span { color: var(--pink-dark); font-size: 10px; font-weight: 900; }
.template-preview-prompt p { margin: 8px 0 0; color: var(--text); font-size: 12px; line-height: 1.75; }
.template-preview-content .primary-button { margin-top: auto; }
@keyframes template-dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.generated-image-dialog { width: min(1440px, calc(100vw - 28px)); max-width: calc(100vw - 28px); height: min(900px, calc(100vh - 28px)); max-height: calc(100vh - 28px); overflow: hidden; border-color: #4c4149; border-radius: 12px; background: #171417; }
.generated-image-dialog::backdrop { background: rgba(20,16,20,.84); }
.generated-image-viewer { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.generated-image-toolbar { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px 8px 18px; color: white; background: #211c20; border-bottom: 1px solid #3f353c; }
.generated-image-toolbar > span { font-size: 12px; font-weight: 800; }
.generated-image-toolbar > div { display: flex; align-items: center; gap: 9px; }
.generated-image-toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.generated-image-zoom-controls { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid #5c4c56; border-radius: 7px; background: #2d262b; }
.generated-image-zoom-button, .generated-image-zoom-value { min-width: 30px; height: 30px; padding: 0 7px; border: 0; border-radius: 5px; color: white; background: transparent; font: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.generated-image-zoom-value { min-width: 54px; font-size: 11px; font-weight: 800; }
.generated-image-zoom-button:hover:not(:disabled), .generated-image-zoom-value:hover { background: #483b43; }
.generated-image-zoom-button:disabled { opacity: .4; cursor: not-allowed; }
.generated-image-toolbar .secondary-button { color: white; border-color: #5c4c56; background: #2d262b; }
.generated-image-toolbar .close-button { color: white; background: #362d33; }
.generated-image-canvas { min-width: 0; min-height: 0; height: 100%; max-height: calc(100vh - 86px); display: grid; place-items: center; overflow: auto; padding: 14px; overscroll-behavior: contain; touch-action: none; cursor: default; }
.generated-image-canvas.is-zoomed { cursor: grab; }
.generated-image-canvas.is-dragging { cursor: grabbing; }
.generated-image-canvas img { width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 114px); display: block; object-fit: contain; touch-action: none; user-select: none; -webkit-user-drag: none; will-change: transform; }
.generated-image-canvas video { width: 100%; height: auto; max-width: 1400px; max-height: calc(100vh - 114px); display: block; object-fit: contain; background: #080708; }

.home-data-grid { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(0, 1.5fr); gap: 18px; }
.home-section {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: 0 10px 35px rgba(116, 61, 86, .06);
}
.home-section-heading { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.home-section-heading h2 { margin: 0; font-size: 19px; }
.home-section-heading > span { padding-top: 5px; color: var(--muted); font-size: 10px; }
.home-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.home-stats div { min-width: 0; padding: 13px; border-left: 3px solid var(--pink-light); background: var(--soft-2); }
.home-stats div:last-child { grid-column: 1 / -1; border-color: #b9e0cf; background: #f0faf6; }
.home-stats span, .home-stats strong { display: block; }
.home-stats span { color: var(--muted); font-size: 10px; }
.home-stats strong { margin-top: 6px; overflow: hidden; font-size: 21px; text-overflow: ellipsis; }
.home-stats div:last-child strong { color: var(--green); }

.recent-work-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.recent-work {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  text-align: left;
}
.recent-work:hover { border-color: #e7aac0; }
.recent-work-media { position: relative; height: 106px; display: block; overflow: hidden; background: #342c32; }
.recent-work-media img,
.recent-work-media video { width: 100%; height: 100%; display: block; object-fit: cover; }
.recent-work-media > .status-badge { position: absolute; right: 7px; bottom: 7px; }
.recent-work-placeholder { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: 5px; color: white; background: #4a3d45; }
.recent-work-placeholder span { color: #f3a7c1; font-size: 24px; font-weight: 800; }
.recent-work-placeholder small { color: #d9c7d1; font-size: 10px; }
.recent-work-copy { min-width: 0; display: grid; gap: 4px; padding: 10px; }
.recent-work-copy strong,
.recent-work-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-work-copy strong { font-size: 11px; }
.recent-work-copy small { color: var(--muted); font-size: 9px; }
.recent-work-grid > .empty-state { grid-column: 1 / -1; min-height: 150px; }

.customer-layout { grid-template-columns: minmax(460px, var(--creator-left, calc(100% - 368px))) 18px minmax(300px, 1fr); gap: 0; }
.composer-panel { min-height: auto; }
.result-panel { padding: 20px; }
.creator-resizer { position: relative; min-height: 300px; display: grid; place-items: center; cursor: col-resize; touch-action: none; outline: none; }
.creator-resizer::before { content: ''; position: absolute; top: 18px; bottom: 18px; left: 50%; width: 2px; border-radius: 999px; background: linear-gradient(180deg, transparent, var(--pink-light) 12%, var(--pink-light) 88%, transparent); transform: translateX(-50%); transition: width .16s ease, background .16s ease, box-shadow .16s ease; }
.creator-resizer::after { content: attr(data-tip); position: absolute; right: 30px; top: 50%; z-index: 4; width: max-content; max-width: 210px; padding: 7px 9px; border: 1px solid #4b4147; background: white; color: #4b4147; font-size: 11px; line-height: 1.25; white-space: nowrap; box-shadow: 0 5px 14px rgba(71,51,64,.14); opacity: 0; pointer-events: none; transform: translate(0, -50%); transition: opacity .14s ease, transform .14s ease; }
.creator-resizer:hover::after, .creator-resizer:focus-visible::after, .creator-resizer.is-dragging::after { opacity: 1; transform: translate(-4px, -50%); }
.creator-resizer span { position: relative; z-index: 1; width: 16px; height: 52px; display: grid; place-content: center; gap: 4px; border: 1px solid var(--pink-light); border-radius: 999px; background: white; box-shadow: 0 7px 18px rgba(108,67,91,.12); transition: transform .16s ease, border-color .16s ease; }
.creator-resizer i { width: 3px; height: 3px; border-radius: 50%; background: var(--pink); }
.creator-resizer:hover::before, .creator-resizer:focus-visible::before, .creator-resizer.is-dragging::before { width: 4px; background: var(--pink); box-shadow: 0 0 0 5px rgba(216,83,139,.08); }
.creator-resizer:hover span, .creator-resizer:focus-visible span, .creator-resizer.is-dragging span { border-color: var(--pink); transform: scale(1.05); }
body.is-creator-resizing { cursor: col-resize; user-select: none; }
.compact-stage { flex: 0 0 auto; min-height: 190px; aspect-ratio: auto; overflow: visible; grid-template-rows: minmax(190px, auto) auto; }
.compact-stage video { width: 100%; max-height: 260px; aspect-ratio: 16 / 9; object-fit: contain; }
.compact-stage .image-result { width: 100%; max-height: 300px; object-fit: contain; }
.compact-stage .result-media-buttons { position: relative; z-index: 2; width: 100%; flex: 0 0 auto; padding: 0 4px 4px; }
.compact-stage .result-media-buttons .primary-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.image-history-divider { display: none; }
.creator-recent-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.compact-job-list { min-height: 120px; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-gutter: stable; }
.all-tasks-button { flex: 0 0 auto; margin-top: 12px; }

/* Keep the preview frame stable. The image itself stays in its native ratio
   inside the frame, so a portrait result cannot resize the layout or squeeze
   the history area below it. */
.customer-frame.is-image-creator .result-panel {
  position: static;
  max-height: none;
  overflow: visible;
}
.customer-frame.is-image-creator .compact-stage {
  height: clamp(210px, 22vw, 240px);
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr) auto;
}
.customer-frame.is-image-creator .compact-stage .result-gallery {
  min-height: 0;
  height: 100%;
  overflow: auto;
}
.customer-frame.is-image-creator .compact-stage .result-gallery figure {
  min-height: 0;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
}
.customer-frame.is-image-creator .compact-stage .image-result-open {
  height: 100%;
  min-height: 0;
}
.customer-frame.is-image-creator .compact-stage .image-result {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}
.customer-frame.is-image-creator .compact-stage .image-result-open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.customer-frame.is-image-creator .image-history-divider {
  display: block;
  flex: 0 0 auto;
  height: 2px;
  margin: 8px 0;
  border-radius: 999px;
  background: var(--pink-light);
  box-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.customer-frame.is-image-creator .compact-job-list {
  /* Keep cards compact while giving the history window enough room for many items. */
  max-height: none;
  height: auto;
  flex: 0 0 auto;
  overflow: visible;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: auto;
  scrollbar-gutter: stable;
}

/* Desktop image history is a nested scroller: the right panel stays in the
   viewport and only its task list consumes wheel/trackpad movement. */
@media (min-width: 1181px) {
  .customer-frame.is-image-creator .result-panel {
    position: sticky;
    top: 94px;
    height: calc(100vh - 116px);
    min-height: 0;
    max-height: calc(100vh - 116px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .customer-frame.is-image-creator .job-heading,
  .customer-frame.is-image-creator .all-tasks-button {
    flex: 0 0 auto;
  }

  .customer-frame.is-image-creator .compact-job-list {
    min-height: 0;
    height: auto;
    max-height: none;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }
}

.customer-frame.is-image-creator .result-gallery {
  gap: 6px;
  padding: 6px;
}
.customer-frame.is-image-creator .compact-stage .result-media-buttons {
  gap: 5px;
  padding: 0 2px 2px;
}
.customer-frame.is-image-creator .compact-stage .result-media-buttons .primary-button {
  min-height: 32px;
  padding: 6px 13px;
  border-radius: 10px;
  font-size: 11px;
}
.customer-frame.is-image-creator .video-result-actions {
  min-height: 0;
  padding: 6px 8px;
}
.customer-frame.is-image-creator .video-result-actions small {
  font-size: 10px;
  line-height: 1.35;
}

/* Video creator: a compact material library keeps the prompt and controls wide. */
.video-composer { grid-template-columns: minmax(220px, 268px) minmax(0, 1fr); gap: 14px; }
.video-composer .composer-top-controls { grid-template-columns: minmax(300px, 1fr) minmax(220px, .72fr); gap: 10px; }
.video-composer .mode-fieldset { margin-bottom: 0; }
.video-composer .upload-section {
  grid-column: 1;
  grid-row: 2 / span 2;
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft-2);
}
.video-composer .upload-heading { flex: 0 0 auto; min-height: 31px; margin-bottom: 8px; }
.video-composer .upload-heading > div { min-width: 0; }
.video-composer .upload-heading strong { color: var(--text); font-size: 13px; }
.video-composer .upload-heading span { white-space: nowrap; }
.material-collapse-button { width: 28px; height: 28px; flex: 0 0 auto; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--pink-light); border-radius: 8px; background: white; color: var(--pink-dark); font-size: 22px; line-height: 1; }
.material-collapse-button:hover { border-color: var(--pink); background: var(--soft); }
.video-composer .material-collapse-button { margin-left: auto; }
.video-composer .drop-zone { min-height: 104px; padding: 12px; }
.video-composer .drop-zone strong { font-size: 12px; }
.video-composer .drop-zone span { font-size: 10px; line-height: 1.45; }
.video-composer .reference-grid { grid-template-columns: 1fr; gap: 7px; max-height: 342px; margin-top: 8px; padding-right: 2px; overflow-y: auto; scrollbar-gutter: stable; }
.video-composer .reference-card { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 7px; min-height: 58px; padding: 7px; cursor: pointer; }
.video-composer .reference-card:hover { border-color: var(--pink-light); background: #fff9fb; }
.video-composer .reference-card:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.video-composer .reference-copy { min-width: 0; }
.video-composer .reference-card-actions { display: flex; align-items: center; gap: 3px; }
.reference-rename { min-height: 25px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; }
.reference-rename:hover { color: var(--pink-dark); border-color: var(--pink-light); }
.video-composer .reference-remove { width: 22px; height: 25px; padding: 0; font-size: 17px; }
.video-composer .prompt-field { grid-column: 2; grid-row: 2; min-height: 0; }
.video-composer .prompt-input-shell,
.video-composer .prompt-field textarea { min-height: 300px; height: 100%; }
.video-composer .prompt-field textarea { padding: 17px 17px 32px; resize: vertical; border-color: var(--line); font-size: 15px; line-height: 1.72; }
.video-composer .prompt-highlight { padding: 17px 17px 32px; font-size: 15px; line-height: 1.72; }
.video-composer .composer-bottom-controls { grid-column: 2; grid-row: 3; grid-template-columns: minmax(180px, .85fr) minmax(0, 1.7fr); gap: 9px; padding-top: 11px; }
.video-composer .model-fieldset { grid-column: 1; }
.video-composer .parameter-grid { grid-column: 2; grid-template-columns: repeat(4, minmax(74px, 1fr)); gap: 7px; }
.video-composer .parameter-grid select { min-height: 38px; padding: 7px 9px; }
.video-composer .submit-row { grid-column: 1 / -1; gap: 10px; padding-top: 2px; }
.video-composer .generate-button { min-width: 148px; min-height: 44px; border-radius: 12px; }
.video-composer .compact-price { min-height: 34px; font-size: 12px; }
.video-composer.is-materials-collapsed { grid-template-columns: 50px minmax(0, 1fr); }
.video-composer.is-materials-collapsed .upload-section { padding: 8px; }
.video-composer.is-materials-collapsed .upload-heading { min-height: 34px; justify-content: center; }
.video-composer.is-materials-collapsed .upload-heading > div,
.video-composer.is-materials-collapsed #referenceAddLabel,
.video-composer.is-materials-collapsed .drop-zone,
.video-composer.is-materials-collapsed .reference-grid { display: none; }
.video-composer.is-materials-collapsed .material-collapse-button { margin: 0; }
.video-generation-dock { display: contents; }
.image-composer .composer-top-controls { grid-column: 1 / -1; grid-row: 1; }
.image-composer .upload-section { grid-column: 1; grid-row: 2; }
.image-composer .prompt-field { grid-column: 2; grid-row: 2; }
.image-composer .composer-bottom-controls { grid-column: 1 / -1; grid-row: 3; }

/* A narrow desktop editor must stack its own controls instead of letting the
   prompt column overflow across the preview panel. */
/* Video studio keeps the ruguo visual language while using a media-first layout. */
.customer-frame.is-video-studio { width: calc(100% - 36px); }
.is-video-studio .customer-workspace,
.is-video-studio .creator-view { min-width: 0; width: 100%; }
.is-video-studio .customer-layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  grid-template-rows: auto minmax(340px, auto) auto auto auto auto;
  gap: 12px 16px;
  align-items: start;
}
.is-video-studio.is-video-materials-collapsed .customer-layout { grid-template-columns: 54px minmax(0, 1fr); }
.is-video-studio .composer-panel,
.is-video-studio .video-composer,
.is-video-studio .result-panel { display: contents; }
.is-video-studio .composer-panel > .section-heading,
.is-video-studio .creator-resizer { display: none; }
.is-video-studio .video-composer .upload-section {
  grid-column: 1;
  grid-row: 1 / 7;
  min-height: calc(100vh - 110px);
  max-height: calc(100vh - 96px);
  position: sticky;
  top: 86px;
  padding: 14px;
  border-radius: 14px;
  background: white;
  box-shadow: 0 10px 32px rgba(116,61,86,.06);
}
.is-video-studio .video-composer .upload-heading { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.is-video-studio .video-composer .drop-zone { min-height: 150px; }
.is-video-studio .video-composer .reference-grid { max-height: none; flex: 1 1 auto; align-content: start; }
.is-video-studio .result-panel > .compact-heading { grid-column: 2; grid-row: 1; min-height: 50px; margin: 0; align-items: center; }
.is-video-studio .result-panel > .compact-heading h2 { font-size: 26px; }
.is-video-studio .video-stage {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  min-height: 320px;
  padding: 18px;
  overflow: visible;
  border: 1px solid var(--pink-light);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #fff8fb 72%, #fff1f7);
  box-shadow: 0 12px 34px rgba(190,102,143,.10), inset 0 1px rgba(255,255,255,.9);
}
.is-video-studio .video-stage > .empty-state {
  width: 100%;
  min-height: 284px;
  border: 1px dashed #f1b4cb;
  border-radius: 14px;
  color: var(--pink-dark);
  background: radial-gradient(circle at 18% 20%, rgba(255,255,255,.9) 0 3px, transparent 4px), radial-gradient(circle at 78% 72%, rgba(255,255,255,.82) 0 4px, transparent 5px), linear-gradient(145deg, #fff5f9, #ffeef5);
  box-shadow: inset 0 0 0 1px rgba(255,183,215,.18), 0 8px 24px rgba(190,102,143,.08);
}
.is-video-studio .video-stage > .empty-state > span { color: #ed79a7; text-shadow: none; }
.is-video-studio .video-stage > .empty-state small { color: #ae7c93; }
.is-video-studio .video-stage .result-gallery { padding: 0; }
.is-video-studio .video-stage .result-gallery,
.is-video-studio .video-stage .result-gallery.is-multiple { grid-template-columns: repeat(auto-fit, minmax(280px, 440px)); justify-content: start; align-content: start; }
.is-video-studio .video-stage .work-result { width: 100%; max-width: 440px; padding: 0 0 8px; border: 1px solid var(--pink-light); border-radius: 14px; background: linear-gradient(180deg, #fff, #fff8fb); box-shadow: 0 8px 22px rgba(190,102,143,.12); }
.is-video-studio .video-stage .work-result::after { content: '✦'; position: absolute; right: 11px; bottom: 44px; color: #f4a4c5; font-size: 13px; pointer-events: none; }
.is-video-studio .compact-stage video,
.is-video-studio .video-stage .result-gallery figure video { width: 100%; max-height: 250px; aspect-ratio: 16 / 9; border-radius: 13px 13px 0 0; object-fit: contain; background: #241f27; }
.is-video-studio .video-stage .result-media-buttons { display: flex; justify-content: center; gap: 7px; padding: 8px 10px 0; }
.is-video-studio .video-stage .result-media-buttons .secondary-button,
.is-video-studio .video-stage .result-media-buttons .primary-button { min-height: 34px; border-radius: 11px; }
.is-video-studio .result-panel > .creator-recent-panel { grid-column: 2; grid-row: 3 / span 3; display: contents; }
.is-video-studio .creator-recent-panel > .job-heading { grid-column: 2; grid-row: 3; margin: 2px 0 0; }
.is-video-studio .creator-recent-panel > .compact-job-list { grid-column: 2; grid-row: 4; min-height: 0; max-height: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; overflow: visible; padding: 0; }
.is-video-studio .compact-job-list > .empty-state { grid-column: 1 / -1; min-height: 112px; }
.is-video-studio .compact-job-list .job-item { min-height: 92px; }
.is-video-studio .creator-recent-panel > .all-tasks-button { grid-column: 2; grid-row: 5; width: auto; min-width: 150px; justify-self: end; margin: 0; }
.is-video-studio .video-generation-dock {
  grid-column: 2;
  grid-row: 6;
  align-self: end;
  display: grid;
  gap: 10px;
  position: sticky;
  bottom: 12px;
  z-index: 25;
  padding: 14px 16px 16px;
  border: 2px solid #ffd4e3;
  border-radius: 18px;
  background: radial-gradient(circle at 96% 8%, rgba(255,205,224,.48) 0 3px, transparent 4px), radial-gradient(circle at 92% 12%, rgba(255,205,224,.32) 0 2px, transparent 3px), linear-gradient(145deg, rgba(255,255,255,.99), rgba(255,244,249,.99));
  box-shadow: 0 18px 45px rgba(190,102,143,.16), inset 0 1px rgba(255,255,255,.92), 0 0 0 4px rgba(255,223,235,.28);
  backdrop-filter: blur(14px);
}
.is-video-studio .video-composer .composer-top-controls {
  grid-column: 1;
  grid-row: auto;
  position: relative;
  z-index: 1;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, .55fr);
  padding: 0;
}
.is-video-studio .video-composer .composer-top-controls.has-single-control { grid-template-columns: 1fr; }
.is-video-studio .video-composer .composer-top-controls[hidden] { display: none; }
.is-video-studio .video-composer .prompt-field {
  grid-column: 1;
  grid-row: auto;
  position: relative;
  z-index: 40;
  min-height: 0;
  padding: 0;
}
.is-video-studio .video-composer .prompt-field > label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0 0 7px 3px;
  padding: 4px 10px 4px 8px;
  border: 1px solid #ffd0e1;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff4f8, #fffafd);
  color: var(--pink-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
  box-shadow: 0 4px 12px rgba(232,95,145,.08);
}
.is-video-studio .video-composer .prompt-input-shell { min-height: 132px; height: auto; }
.is-video-studio .video-composer .prompt-field textarea {
  min-height: 132px;
  height: 132px;
  max-height: 420px;
  resize: vertical;
  overflow: auto;
  border: 1px solid #efbfd3;
  border-radius: 15px;
  background: transparent;
  box-shadow: none;
}
.is-video-studio .video-composer .prompt-input-shell {
  overflow: visible;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #fff5fa);
  box-shadow: inset 0 1px 8px rgba(239,143,181,.07);
}

@media (min-width: 1280px) {
  .is-video-studio .customer-layout { grid-template-columns: 286px minmax(0, 1fr) 280px; }
  .is-video-studio.is-video-materials-collapsed .customer-layout { grid-template-columns: 54px minmax(0, 1fr) 280px; }
  .is-video-studio .result-panel > .creator-recent-panel {
    grid-column: 3;
    grid-row: 1 / 7;
    display: flex;
    height: calc(100vh - 110px);
    max-height: calc(100vh - 110px);
    position: sticky;
    top: 86px;
    align-self: start;
    overflow: hidden;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 10px 32px rgba(0,0,0,.18);
  }
  .is-video-studio .creator-recent-panel > .job-heading { margin: 0 0 10px; }
  .is-video-studio .creator-recent-panel > .compact-job-list {
    min-height: 0;
    grid-template-columns: 1fr;
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .is-video-studio .creator-recent-panel > .all-tasks-button { width: 100%; justify-self: stretch; }
}
.is-video-studio .video-composer .mention-menu {
  z-index: 60;
  border-color: #efbfd3;
  background: rgba(255,255,255,.99);
  box-shadow: 0 16px 34px rgba(153,73,112,.22);
}
.is-video-studio .video-composer .prompt-input-shell::before {
  content: none;
  position: absolute;
  top: 9px;
  right: 13px;
  z-index: 3;
  color: #f3a1c2;
  font-size: 13px;
  pointer-events: none;
}
.is-video-studio .video-composer .prompt-resize-hint {
  position: absolute;
  right: 9px;
  bottom: 7px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  color: var(--pink);
  background: rgba(255,238,246,.86);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.is-video-studio .video-composer .prompt-field textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(232,95,145,.11), inset 0 1px 8px rgba(239,143,181,.07);
}
.is-video-studio .video-composer .prompt-highlight { min-height: 132px; padding: 17px 17px 32px; border-radius: 15px; }
.is-video-studio .video-composer .character-count {
  right: auto;
  left: 14px;
  bottom: 9px;
  z-index: 4;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,247,251,.88);
  color: #a77b91;
}
.is-video-studio .video-composer .composer-bottom-controls {
  grid-column: 1;
  grid-row: auto;
  position: relative;
  z-index: 1;
  grid-template-columns: minmax(190px, .8fr) minmax(0, 1.7fr);
  padding: 0;
  border-top: 0;
}
.is-video-studio .video-composer .model-fieldset legend,
.is-video-studio .video-composer .parameter-grid label > span { display: none; }
.is-video-studio .video-composer .submit-row { align-self: center; }
.is-video-studio .video-composer.is-materials-collapsed .upload-section { padding: 8px; }

.job-item {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
}
.job-media-mark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--pink-dark);
  background: var(--soft);
  font-size: 10px;
  font-weight: 800;
}
.job-media-mark.image { color: #7055ae; background: #eee7ff; }
.light-empty { min-height: 160px; color: var(--muted); background: var(--soft-2); border-radius: 12px; }
.light-empty > span { color: var(--pink); }

.tasks-view { display: grid; gap: 14px; }
.tasks-page-heading {
  min-height: 116px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  overflow: hidden;
  border: 1px solid var(--pink-light);
  border-radius: 18px;
  background: var(--soft);
}
.tasks-page-heading h1 { margin: 0; font-size: 25px; }
.tasks-page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.task-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.task-filters { display: flex; gap: 4px; overflow-x: auto; }
.task-filters button { min-width: max-content; padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.task-filters button.is-selected { color: var(--pink-dark); background: var(--soft); }
.task-toolbar input { width: min(280px, 32vw); min-height: 38px; padding: 8px 11px; }
.tasks-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.task-list-panel,
.task-preview-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 35px rgba(116, 61, 86, .05);
}
.task-preview-panel { position: sticky; top: 90px; }
.task-list-summary { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.task-list-summary strong { font-size: 13px; }
.task-list-summary span { color: var(--muted); font-size: 10px; }
.task-job-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.task-job-list .job-item { min-height: 112px; }
.task-detail { display: grid; gap: 0; margin-top: 13px; border-top: 1px solid var(--line); }
.task-detail > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; padding: 9px 1px; border-bottom: 1px solid var(--line); }
.task-detail span { color: var(--muted); font-size: 10px; }
.task-detail strong { min-width: 0; overflow-wrap: anywhere; font-size: 10px; text-align: right; }
.task-detail .task-expiry strong { color: var(--red); }
.status-text.succeeded { color: var(--green); }
.status-text.failed,
.status-text.cancelled,
.status-text.canceled { color: var(--red); }
.status-text.running,
.status-text.pending,
.status-text.queued,
.status-text.dispatching,
.status-text.submitting { color: var(--amber); }

.api-admin-panel { display: grid; gap: 16px; }
.community-admin-block { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.community-admin-block img { width: 150px; height: 150px; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; }
.community-admin-block h3 { margin: 4px 0 7px; }
.community-admin-block p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.api-access-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.api-access-block { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft-2); }
.api-access-block strong { display: block; overflow-wrap: anywhere; font-size: 15px; }
.api-access-block p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.api-access-block code, .api-code-heading code { color: var(--pink-dark); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-access-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.api-code-section { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #352932; }
.api-code-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 17px; color: white; border-bottom: 1px solid rgba(255,255,255,.12); }
.api-code-heading h3 { margin: 0; font-size: 15px; }
.api-code-heading p { margin: 6px 0 0; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.55; }
.api-code-heading code { color: #ffb9d1; }
.api-code-section pre { max-height: 405px; margin: 0; overflow: auto; padding: 18px; color: #f9e8ef; font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-code-section code { white-space: pre; }
.api-endpoint-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.api-endpoint-list article { display: grid; gap: 5px; padding: 13px 14px; border-bottom: 1px solid var(--line); background: white; }
.api-endpoint-list code { color: var(--pink-dark); font: 800 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-endpoint-list span, .api-notice { color: var(--muted); font-size: 12px; line-height: 1.6; }
.api-notice { margin: 0; padding: 11px 13px; border-left: 3px solid var(--pink); background: var(--soft); }
.refund-label { color: var(--green) !important; }

.api-docs-body { min-height: 100vh; background: var(--page); }
.api-docs-header { position: static; grid-template-columns: 1fr auto; }
.api-docs-main { width: min(1100px, calc(100% - 36px)); margin: 36px auto 70px; display: grid; gap: 24px; }
.api-docs-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .55fr); gap: 24px; align-items: end; padding: 32px 36px; border: 1px solid var(--pink-light); border-radius: 18px; background: var(--soft); }
.api-docs-hero h1 { margin: 0; font-size: 31px; }
.api-docs-hero p { max-width: 600px; margin: 10px 0 0; color: var(--muted); line-height: 1.7; }
.api-docs-base { padding: 16px; border: 1px solid var(--pink-light); border-radius: 13px; background: white; }
.api-docs-base strong { display: block; overflow-wrap: anywhere; color: var(--pink-dark); font: 800 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-docs-base button { margin-top: 10px; }
.api-docs-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 18px; align-items: start; }
.api-docs-section { min-width: 0; }
.api-docs-section h2 { margin: 0 0 12px; font-size: 20px; }
.api-docs-section > p { margin: 0 0 15px; color: var(--muted); line-height: 1.65; }
.api-docs-code { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #352932; }
.api-docs-code header { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; color: white; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 12px; font-weight: 800; }
.api-docs-code pre { margin: 0; max-height: 530px; overflow: auto; padding: 17px; color: #f9e8ef; font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-docs-code + .api-docs-code { margin-top: 14px; }
.api-docs-code code { white-space: pre; }
.api-docs-steps { display: grid; gap: 10px; }
.api-docs-steps article { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.api-docs-steps strong { display: block; font-size: 13px; }
.api-docs-steps p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.api-docs-steps code { color: var(--pink-dark); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-docs-endpoints { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.api-docs-endpoints article { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.api-docs-endpoints code { color: var(--pink-dark); font: 800 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-docs-endpoints p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

body.customer-body,
.customer-body .site-header,
.customer-body .customer-sidebar,
.customer-body .composer-panel,
.customer-body .result-panel,
.customer-body .home-hero,
.customer-body .home-section,
.customer-body .shortcut-item,
.customer-body .image-template-card,
.customer-body .templates-toolbar,
.customer-body .task-list-panel,
.customer-body .task-preview-panel,
.customer-body input,
.customer-body textarea,
.customer-body select { transition: color .32s ease, background-color .32s ease, border-color .32s ease, box-shadow .32s ease, filter .38s ease; }

html[data-theme="dark"] body.customer-body {
  background-color: var(--page);
  background-image: radial-gradient(circle at 9% -8%, rgba(93,65,170,.22), transparent 30%), radial-gradient(circle at 96% 12%, rgba(31,117,150,.13), transparent 28%), linear-gradient(180deg, #090a12, #0c0e16 58%, #080a11);
}
html[data-theme="dark"] .customer-body .login-screen { background: radial-gradient(circle at 50% 20%, #201731, #090a11 60%); }
html[data-theme="dark"] .customer-body input,
html[data-theme="dark"] .customer-body textarea,
html[data-theme="dark"] .customer-body select { color: var(--text); border-color: var(--line); background: #0e1119; }
html[data-theme="dark"] .customer-body input::placeholder,
html[data-theme="dark"] .customer-body textarea::placeholder { color: #6f7180; }
html[data-theme="dark"] .customer-body .site-header { background: rgba(11,13,20,.9); border-color: #252938; box-shadow: 0 12px 35px rgba(0,0,0,.18); }
html[data-theme="dark"] .customer-body .customer-sidebar { background: rgba(16,19,28,.92); box-shadow: 0 14px 40px rgba(0,0,0,.28); }
html[data-theme="dark"] .customer-body .composer-panel,
html[data-theme="dark"] .customer-body .result-panel,
html[data-theme="dark"] .customer-body .home-section,
html[data-theme="dark"] .customer-body .shortcut-item,
html[data-theme="dark"] .customer-body .image-template-card,
html[data-theme="dark"] .customer-body .templates-toolbar,
html[data-theme="dark"] .customer-body .task-list-panel,
html[data-theme="dark"] .customer-body .task-preview-panel,
html[data-theme="dark"] .customer-body .recent-work,
html[data-theme="dark"] .customer-body .job-item,
html[data-theme="dark"] .customer-body .reference-card,
html[data-theme="dark"] .customer-body .mention-menu,
html[data-theme="dark"] .customer-body .prompt-template-menu,
html[data-theme="dark"] .customer-body .creator-resizer span { color: var(--text); border-color: var(--line); background: var(--panel); box-shadow: 0 12px 35px rgba(0,0,0,.24); }
html[data-theme="dark"] .customer-body .home-hero { border-color: #3b315d; background: linear-gradient(135deg, #181320 0%, #101522 55%, #111827 100%); box-shadow: 0 18px 45px rgba(0,0,0,.28); }
html[data-theme="dark"] .customer-body .home-hero-art { background: linear-gradient(145deg, #171322, #111827); }
html[data-theme="dark"] .customer-body .home-hero-art::before,
html[data-theme="dark"] .customer-body .home-hero-art::after { background: rgba(130,101,255,.35); box-shadow: 0 0 14px rgba(111,80,255,.45); }
html[data-theme="dark"] .customer-body .templates-page-heading { border-color: #3a315a; background: linear-gradient(135deg, #181420, #111724); }
html[data-theme="dark"] .customer-body .template-search,
html[data-theme="dark"] .customer-body .secondary-button,
html[data-theme="dark"] .customer-body .danger-button,
html[data-theme="dark"] .customer-body .segmented button.is-selected,
html[data-theme="dark"] .customer-body .model-select-control select { color: var(--text); border-color: var(--line); background: #171a25; }
html[data-theme="dark"] .customer-body .api-header-button { color: #c4b6ff; border-color: #39315f; background: #19172a; }
html[data-theme="dark"] .customer-body .announcement-button,
html[data-theme="dark"] .customer-body .balance-button { border-color: #383047; background: #181522; }
html[data-theme="dark"] .customer-body .drop-zone,
html[data-theme="dark"] .customer-body .image-composer .drop-zone { border-color: #45405a; background: #121620; }
html[data-theme="dark"] .customer-body .video-composer .upload-section { border-color: #353042; background: #11141d; }
html[data-theme="dark"] .customer-body .is-video-studio .video-stage,
html[data-theme="dark"] .customer-body .is-video-studio .video-stage { border-color: #5b3c59; background: linear-gradient(145deg,#1c1724,#151421); box-shadow: 0 16px 38px rgba(0,0,0,.28); }
html[data-theme="dark"] .customer-body .is-video-studio .video-generation-dock { border-color: #5b3c59; background: rgba(25,18,31,.97); box-shadow: 0 16px 38px rgba(0,0,0,.28); }
html[data-theme="dark"] .customer-body .is-video-studio .video-stage .work-result { border-color: #5b3c59; background: linear-gradient(180deg,#1d1824,#17141e); box-shadow: 0 10px 26px rgba(0,0,0,.32); }
html[data-theme="dark"] .customer-body .is-video-studio .prompt-field > label { color: #ffd4eb; border-color: #5b3c59; background: linear-gradient(135deg,#24182b,#1a1724); box-shadow: 0 4px 12px rgba(0,0,0,.22); }
html[data-theme="dark"] .customer-body .is-video-studio .prompt-input-shell { background: linear-gradient(145deg,#171421,#12101b); box-shadow: inset 0 1px 8px rgba(255,112,194,.08); }
html[data-theme="dark"] .customer-body .is-video-studio .prompt-field textarea { border-color: #5b3c59; background: transparent; box-shadow: none; }
html[data-theme="dark"] .customer-body .is-video-studio .prompt-resize-hint,
html[data-theme="dark"] .customer-body .is-video-studio .character-count { color: #ff9bce; background: rgba(45,25,45,.92); }
html[data-theme="dark"] .customer-body .material-collapse-button,
html[data-theme="dark"] .customer-body .sidebar-collapse-button { color: #ffd4eb; border-color: #443349; background: #181522; }
html[data-theme="dark"] .customer-body .video-composer .reference-card:hover { border-color: #694158; background: #1b1520; }
html[data-theme="dark"] .customer-body .image-composer {
  border-color: #393351;
  background: radial-gradient(circle at 8% 0, rgba(121,82,255,.1), transparent 38%), linear-gradient(145deg, #131620, #10131c 62%, #111723);
  box-shadow: 0 18px 42px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.025);
}
html[data-theme="dark"] .customer-body .image-composer .composer-bottom-controls { border-color: #292d3b; }
html[data-theme="dark"] .customer-body .upload-section.is-dragging .drop-zone { border-color: var(--pink); background: #181329; box-shadow: inset 0 0 35px rgba(122,84,255,.12); }
html[data-theme="dark"] .customer-body .composer-panel > .section-heading { border-color: #3a315c; background: linear-gradient(120deg, #171321, #121824); }
html[data-theme="dark"] .customer-body .home-stats div:last-child { border-color: #315b4c; background: #10251e; }
html[data-theme="dark"] .customer-body .status-badge.failed,
html[data-theme="dark"] .customer-body .status-badge.error,
html[data-theme="dark"] .customer-body .status-badge.revoked { background: #2c151d; }
html[data-theme="dark"] .customer-body .status-badge.running,
html[data-theme="dark"] .customer-body .status-badge.uploading,
html[data-theme="dark"] .customer-body .status-badge.submitting,
html[data-theme="dark"] .customer-body .status-badge.dispatching,
html[data-theme="dark"] .customer-body .status-badge.preparing { background: #2b2113; }
html[data-theme="dark"] .customer-body .brand img,
html[data-theme="dark"] .customer-body .hero-logo,
html[data-theme="dark"] .customer-body .home-hero-art img,
html[data-theme="dark"] .customer-body .sidebar-note img { filter: grayscale(.28) saturate(.9) hue-rotate(178deg) contrast(1.08) brightness(.94); box-shadow: 0 0 0 1px #544677, 0 0 24px rgba(128,93,255,.34); }

/* Pink-neon dark theme: keep the existing product layout, but give it the
   warmer layered look of the visual reference. */
html[data-theme="dark"] {
  --page: #090611;
  --panel: #14101f;
  --soft: #21152d;
  --soft-2: #181221;
  --pink: #ff69bd;
  --pink-dark: #ff9bd5;
  --pink-light: #5b2d58;
  --text: #fff4fb;
  --muted: #bba8c5;
  --line: #35263f;
  --shadow: 0 22px 58px rgba(0,0,0,.42);
}
html[data-theme="dark"] body.customer-body {
  background-color: #090611;
  background-image: radial-gradient(circle at 15% 0, rgba(214,61,173,.2), transparent 27%), radial-gradient(circle at 82% 8%, rgba(119,70,224,.2), transparent 30%), linear-gradient(180deg, #0c0715, #090711 48%, #08060e);
}
html[data-theme="dark"] .customer-body .site-header {
  background: rgba(13,8,20,.9);
  border-color: rgba(255,100,190,.24);
  box-shadow: 0 12px 38px rgba(0,0,0,.32), 0 1px 18px rgba(255,75,177,.1);
}
html[data-theme="dark"] .customer-body .brand img,
html[data-theme="dark"] .customer-body .hero-logo,
html[data-theme="dark"] .customer-body .home-hero-art img,
html[data-theme="dark"] .customer-body .sidebar-note img {
  filter: none;
  box-shadow: 0 0 0 2px rgba(255,191,224,.74), 0 0 20px rgba(255,83,181,.48);
}
html[data-theme="dark"] .customer-body .media-nav { gap: 10px; }
html[data-theme="dark"] .customer-body .media-nav button {
  height: 40px;
  padding: 0 21px;
  border-radius: 999px;
}
html[data-theme="dark"] .customer-body .media-nav button::after { display: none; }
html[data-theme="dark"] .customer-body .media-nav button.is-active {
  color: #fff;
  background: linear-gradient(135deg, #d44baf, #ff78c6);
  box-shadow: inset 0 1px rgba(255,255,255,.28), 0 0 0 1px rgba(255,183,224,.45), 0 0 22px rgba(255,79,182,.42);
}
html[data-theme="dark"] .customer-body .api-header-button,
html[data-theme="dark"] .customer-body .announcement-button,
html[data-theme="dark"] .customer-body .balance-button {
  color: #f8d9ef;
  border-color: rgba(255,112,194,.26);
  background: linear-gradient(145deg, rgba(70,37,87,.72), rgba(28,20,42,.92));
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 7px 22px rgba(0,0,0,.18);
}
html[data-theme="dark"] .customer-body .customer-sidebar {
  border-color: rgba(255,105,189,.24);
  background: linear-gradient(180deg, rgba(23,14,33,.97), rgba(12,10,21,.98));
  box-shadow: 0 18px 48px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.025);
}
html[data-theme="dark"] .customer-body .customer-sidebar nav button:hover {
  color: #ffd7ee;
  background: rgba(255,91,184,.09);
}
html[data-theme="dark"] .customer-body .customer-sidebar nav button.is-active,
html[data-theme="dark"] .customer-body .customer-sidebar #homeNavButton.is-active,
html[data-theme="dark"] .customer-body .customer-sidebar nav button[data-media-nav].is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(221,65,171,.58), rgba(111,48,143,.2));
  box-shadow: inset 3px 0 #ff78c3, inset 0 0 0 1px rgba(255,146,210,.2), 0 0 22px rgba(242,70,178,.13);
}
html[data-theme="dark"] .customer-body .customer-sidebar nav button.is-active span { color: #ffd0ea; }
html[data-theme="dark"] .customer-body .sidebar-note {
  border-color: rgba(255,112,194,.34);
  background: radial-gradient(circle at 15% 0, rgba(255,91,187,.19), transparent 48%), linear-gradient(145deg, #201329, #15101e);
  box-shadow: inset 0 1px rgba(255,255,255,.03), 0 0 24px rgba(245,70,176,.08);
}
html[data-theme="dark"] .customer-body .composer-panel,
html[data-theme="dark"] .customer-body .result-panel {
  border-color: rgba(255,107,191,.25);
  background: linear-gradient(145deg, rgba(22,14,31,.98), rgba(13,12,22,.98));
  box-shadow: 0 22px 55px rgba(0,0,0,.38), 0 0 0 1px rgba(125,77,177,.08), 0 0 28px rgba(240,70,174,.08);
}
html[data-theme="dark"] .customer-body .composer-panel > .section-heading {
  border-color: rgba(255,111,195,.38);
  background: radial-gradient(circle at 74% 40%, rgba(144,71,209,.3), transparent 30%), radial-gradient(circle at 11% -15%, rgba(255,76,180,.3), transparent 42%), linear-gradient(125deg, #271335, #171027 55%, #111522);
  box-shadow: inset 0 1px rgba(255,255,255,.05), 0 0 24px rgba(232,67,171,.12);
}
html[data-theme="dark"] .customer-body .composer-panel > .section-heading::before {
  content: '';
  position: absolute;
  right: 164px;
  top: 24px;
  color: #ff91d0;
  font-size: 13px;
  letter-spacing: .45em;
  text-shadow: 0 0 12px #ff5ebc;
}
html[data-theme="dark"] .customer-body .hero-logo {
  border-color: rgba(255,208,232,.7);
  background: #f7b5d5;
  transform: rotate(-2deg) scale(1.03);
}
html[data-theme="dark"] .customer-body .composer-panel > .section-heading .price-note,
html[data-theme="dark"] .customer-body .compact-price {
  color: #ffd6ec;
  border-color: rgba(255,121,198,.35);
  background: linear-gradient(135deg, rgba(178,55,145,.72), rgba(88,47,112,.78));
  box-shadow: 0 0 16px rgba(255,82,182,.18);
}
html[data-theme="dark"] .customer-body .composer-panel form {
  padding: 18px;
  border: 1px solid rgba(255,107,191,.29);
  border-radius: 18px;
  background: radial-gradient(circle at 7% 0, rgba(198,66,164,.12), transparent 34%), linear-gradient(145deg, rgba(32,20,43,.94), rgba(17,14,27,.96));
  box-shadow: inset 0 1px rgba(255,255,255,.035), 0 16px 34px rgba(0,0,0,.22), 0 0 22px rgba(229,67,169,.07);
}
html[data-theme="dark"] .customer-body .image-composer { border-color: rgba(255,107,191,.32); }
html[data-theme="dark"] .customer-body .segmented {
  border: 1px solid rgba(255,128,199,.09);
  background: rgba(10,9,17,.48);
}
html[data-theme="dark"] .customer-body .segmented button.is-selected {
  color: #fff;
  background: linear-gradient(135deg, rgba(202,64,161,.78), rgba(104,57,139,.78));
  box-shadow: inset 0 0 0 1px rgba(255,154,213,.25), 0 0 17px rgba(255,76,180,.16);
}
html[data-theme="dark"] .customer-body .drop-zone,
html[data-theme="dark"] .customer-body .image-composer .drop-zone {
  color: #f8d8eb;
  border-color: rgba(255,114,194,.5);
  background: radial-gradient(circle at 50% 0, rgba(221,70,171,.14), transparent 58%), rgba(15,12,24,.78);
  box-shadow: inset 0 0 35px rgba(173,60,159,.06);
}
html[data-theme="dark"] .customer-body .drop-zone strong { color: #ff9bd2; text-shadow: 0 0 12px rgba(255,91,184,.28); }
html[data-theme="dark"] .customer-body input,
html[data-theme="dark"] .customer-body textarea,
html[data-theme="dark"] .customer-body select,
html[data-theme="dark"] .customer-body .model-select-control select {
  color: #fff2fa;
  border-color: rgba(210,111,180,.24);
  background: rgba(11,10,18,.76);
  box-shadow: inset 0 1px 12px rgba(0,0,0,.18);
}
html[data-theme="dark"] .customer-body input:focus,
html[data-theme="dark"] .customer-body textarea:focus,
html[data-theme="dark"] .customer-body select:focus {
  border-color: #ff71c2;
  box-shadow: 0 0 0 3px rgba(255,105,189,.12), 0 0 18px rgba(255,86,181,.12);
}
html[data-theme="dark"] .customer-body .prompt-field textarea { color: transparent; caret-color: var(--text); background: transparent; -webkit-text-fill-color: transparent; }
html[data-theme="dark"] .customer-body .prompt-highlight { color: var(--text); }
html[data-theme="dark"] .customer-body .prompt-highlight .prompt-mention { color: #79a7ff; }
html[data-theme="dark"] .customer-body .prompt-input-shell.has-selection textarea { color: var(--text); -webkit-text-fill-color: var(--text); }
html[data-theme="dark"] .customer-body .task-toolbar { border-color: #2c3040; background: #12151e; box-shadow: 0 10px 28px rgba(0,0,0,.2); }
html[data-theme="dark"] .customer-body .task-filters button { color: #aaa4b8; }
html[data-theme="dark"] .customer-body .task-filters button:hover { color: #eee9f7; background: #1d202c; }
html[data-theme="dark"] .customer-body .task-filters button.is-selected { color: #fff; background: #33264a; }
html[data-theme="dark"] .customer-body .task-toolbar input { color: #f1eff8; border-color: #303443; background: #0c0f16; }
html[data-theme="dark"] .customer-body .primary-button,
html[data-theme="dark"] .customer-body .generate-button {
  color: #fff;
  background: linear-gradient(135deg, #d94bad, #ff79c5);
  box-shadow: inset 0 1px rgba(255,255,255,.26), 0 0 0 1px rgba(255,178,220,.35), 0 8px 24px rgba(234,64,168,.34), 0 0 22px rgba(255,74,177,.18);
}
html[data-theme="dark"] .customer-body .primary-button:hover,
html[data-theme="dark"] .customer-body .generate-button:hover { background: linear-gradient(135deg, #e95bbb, #ff94d2); }
html[data-theme="dark"] .customer-body .video-stage {
  border: 1px solid rgba(255,114,194,.24);
  background: radial-gradient(circle at 50% 20%, rgba(151,67,143,.2), transparent 58%), #19111f;
  box-shadow: inset 0 0 35px rgba(255,82,181,.06);
}
html[data-theme="dark"] .customer-body .is-video-studio .video-stage > .empty-state {
  border-color: rgba(255,114,194,.32);
  color: #ffd6ec;
  background: radial-gradient(circle at 18% 20%, rgba(255,139,201,.22) 0 3px, transparent 4px), radial-gradient(circle at 78% 72%, rgba(150,107,255,.2) 0 4px, transparent 5px), linear-gradient(145deg, #211426, #17121f);
  box-shadow: inset 0 0 0 1px rgba(255,130,198,.08), 0 10px 28px rgba(0,0,0,.24);
}
html[data-theme="dark"] .customer-body .is-video-studio .video-stage > .empty-state small { color: #c7a9bb; }
html[data-theme="dark"] .customer-body .empty-state > span { color: #ff8bc9; text-shadow: 0 0 18px rgba(255,91,184,.36); }
html[data-theme="dark"] .customer-body .job-item:hover,
html[data-theme="dark"] .customer-body .job-item.is-active { border-color: rgba(255,112,194,.46); background: rgba(90,41,91,.34); box-shadow: 0 0 18px rgba(244,76,177,.08); }
html[data-theme="dark"] .customer-body .work-menu { color: var(--text); border-color: rgba(255,107,191,.27); background: #171020; box-shadow: 0 20px 48px rgba(0,0,0,.48), 0 0 24px rgba(255,76,180,.09); }
html[data-theme="dark"] .customer-body .work-menu-trigger { color: #ffe5f4; border-color: rgba(255,141,207,.36); background: rgba(29,17,39,.9); box-shadow: 0 0 18px rgba(255,76,180,.2); }
html[data-theme="dark"] .customer-body .work-menu .is-danger:hover { background: #351323; }
html[data-theme="dark"] .customer-body .creator-resizer::before { background: linear-gradient(180deg, transparent, rgba(255,100,189,.55) 16%, rgba(158,91,255,.7) 84%, transparent); }
html[data-theme="dark"] .customer-body .creator-resizer span { border-color: rgba(255,112,194,.42); background: #1b1126; box-shadow: 0 0 18px rgba(255,80,183,.22); }
html[data-theme="dark"] .customer-body .creator-resizer i { background: #ff76c2; box-shadow: 0 0 7px #ff62bb; }

html[data-theme="dark"] .customer-body {
  --pink: #55bd8d;
  --pink-dark: #9be2bd;
  --pink-light: #285541;
}
html[data-theme="dark"] .customer-body .brand img,
html[data-theme="dark"] .customer-body .hero-logo,
html[data-theme="dark"] .customer-body .home-hero-art img,
html[data-theme="dark"] .customer-body .sidebar-note img {
  filter: none;
  box-shadow: none;
}
html[data-theme="dark"] .customer-body .hero-logo { border-color: rgba(163,218,194,.45); background: transparent; }
html[data-theme="dark"] .customer-body .composer-panel > .section-heading::before { content: none; }

html[data-theme="dark"] .customer-body {
  --pink: #55bd8d;
  --pink-dark: #9be2bd;
  --pink-light: #285541;
}
html[data-theme="dark"] .customer-body .brand img,
html[data-theme="dark"] .customer-body .hero-logo,
html[data-theme="dark"] .customer-body .home-hero-art img,
html[data-theme="dark"] .customer-body .sidebar-note img {
  filter: none;
  box-shadow: none;
}
html[data-theme="dark"] .customer-body .hero-logo { border-color: rgba(163,218,194,.45); background: transparent; }
html[data-theme="dark"] .customer-body .composer-panel > .section-heading::before { content: none; }

@media (max-width: 1280px) {
  .home-data-grid { grid-template-columns: 1fr; }
  .home-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .home-stats div:last-child { grid-column: auto; }
  .tasks-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .task-job-list { grid-template-columns: 1fr; }
}

@media (max-width: 1180px) {
  .customer-layout,
  .tasks-layout { grid-template-columns: 1fr; }
  .creator-resizer { display: none; }
  .result-panel, .task-preview-panel { position: static; max-height: none; }
  .compact-job-list { max-height: min(52vh, 480px); flex: 0 1 auto; }
  .task-job-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-stage { min-height: 180px; }
}

@media (max-width: 920px) {
  .composer-panel form.video-composer { grid-template-columns: 1fr; }
  .video-composer .composer-top-controls { grid-template-columns: 1fr 1fr; }
  .video-composer .upload-section,
  .video-composer .prompt-field,
  .video-composer .composer-bottom-controls { grid-column: 1; grid-row: auto; }
  .video-composer .upload-section { min-height: 0; }
  .video-composer .prompt-input-shell,
  .video-composer .prompt-field textarea { min-height: 235px; height: 235px; }
  .video-composer .composer-bottom-controls { grid-template-columns: 1fr; }
  .video-composer .model-fieldset,
  .video-composer .parameter-grid,
  .video-composer .submit-row { grid-column: 1; }
  .video-composer.is-materials-collapsed { grid-template-columns: 1fr; }
  .video-composer.is-materials-collapsed .upload-section { min-height: 48px; }
  .video-composer.is-materials-collapsed .upload-heading { justify-content: flex-start; }
  .video-composer.is-materials-collapsed .upload-heading > div { display: flex; }
  .video-composer.is-materials-collapsed .material-collapse-button { margin-left: auto; }
}

@media (max-width: 860px) {
  .home-hero { grid-template-columns: 1fr 180px; }
  .home-hero-copy { padding-left: 26px; }
  .home-hero-art img { width: 112px; height: 112px; border-radius: 30px; }
  .recent-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-stats div:last-child { grid-column: auto; }
  .task-toolbar { align-items: stretch; flex-direction: column; }
  .task-toolbar input { width: 100%; }
  .api-access-grid { grid-template-columns: 1fr; }
  .community-admin-block { grid-template-columns: 1fr; }
  .community-admin-block img { width: min(240px, 100%); height: auto; }
  .api-docs-hero, .api-docs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .saved-prompt-control { flex-wrap: wrap; }
  .video-composer .composer-top-controls { grid-template-columns: 1fr; }
  .image-composer { grid-template-columns: 1fr; padding: 12px; }
  /* Keep the image composer truly single-column on phones. The desktop
     two-column placement otherwise creates an implicit narrow second column
     and squeezes the prompt textarea beside the material drop zone. */
  .image-composer .upload-section,
  .image-composer .prompt-field,
  .image-composer .composer-top-controls,
  .image-composer .composer-bottom-controls {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
  }
  .image-composer .upload-section { order: 1; }
  .image-composer .prompt-field { order: 2; }
  .image-composer .composer-top-controls { order: 3; }
  .image-composer .composer-bottom-controls { order: 4; }
  .image-composer .reference-grid { grid-template-columns: 1fr; }
  .image-composer .drop-zone { min-height: 88px; }
  .image-composer .prompt-input-shell,
  .image-composer .prompt-field textarea,
  .image-composer .prompt-field .prompt-highlight {
    min-height: 230px;
    height: 230px;
  }
  .image-composer .prompt-field textarea { resize: vertical; overflow: auto; }
  .image-composer .parameter-grid { flex: 1 1 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .image-composer .parameter-grid select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .image-composer .submit-row { flex-wrap: wrap; }
  .image-composer .generate-button { flex: 1 1 100%; }
  /* Keep the same fixed preview frame on phones. */
  .customer-frame.is-image-creator .compact-stage .image-result {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
  }
  .customer-frame.is-image-creator .compact-stage {
    height: min(300px, 78vw);
  }
  .customer-frame.is-image-creator .compact-stage .image-result-open {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .customer-frame.is-image-creator .compact-job-list {
    max-height: min(70vh, 540px);
    overflow-y: auto;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }
  /* On narrow screens let the page carry the scroll gesture. A nested task
     scroller can trap touch scrolling at its boundary on mobile browsers. */
  .customer-frame.is-image-creator .compact-job-list {
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    touch-action: auto;
    -webkit-overflow-scrolling: auto;
  }
  .home-view { gap: 12px; }
  .home-hero { min-height: 0; grid-template-columns: 1fr; }
  .home-hero-copy { padding: 24px 18px 18px; }
  .home-hero-copy h1 { font-size: 24px; }
  .home-hero-art { min-height: 125px; grid-template-columns: 1fr; justify-content: center; }
  .home-shortcuts { grid-template-columns: 1fr; gap: 10px; }
  .home-section { padding: 16px; border-radius: 15px; }
  .home-template-grid { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 3px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .home-template-grid::-webkit-scrollbar { display: none; }
  .home-template-grid .image-template-card { flex: 0 0 min(282px, 78vw); scroll-snap-align: start; }
  .templates-page-heading { min-height: 0; align-items: stretch; flex-direction: column; padding: 18px; }
  .templates-toolbar { align-items: stretch; flex-direction: column; }
  .template-filter-control { padding-bottom: 2px; }
  .template-search { width: 100%; }
  .template-card-grid { grid-template-columns: 1fr; }
  .template-card-grid .image-template-card { min-height: 94px; }
  .template-management-item { grid-template-columns: 1fr; gap: 10px; }
  .template-management-toolbar { grid-template-columns: 1fr 1fr; }
  .template-management-toolbar input { grid-column: 1 / -1; }
  .template-management-preview { width: 100%; aspect-ratio: 16 / 8; }
  .template-management-controls { flex-wrap: wrap; }
  .template-management-fields { grid-template-columns: 1fr; }
  .template-management-fields label:last-child { grid-column: auto; }
  .template-management-actions { align-items: stretch; flex-direction: column; }
  .template-preview-dialog { height: min(740px, calc(100vh - 28px)); overflow: auto; }
  .template-preview-shell { height: auto; grid-template-columns: 1fr; grid-template-rows: 240px auto; }
  .template-preview-media { height: 240px; min-height: 240px; max-height: none; }
  .template-preview-content { min-height: 0; overflow: visible; padding: 24px 18px 18px; }
  .template-preview-content h2 { font-size: 20px; }
  .template-preview-prompt { margin: 16px 0; max-height: 150px; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stats div:last-child { grid-column: 1 / -1; }
  .recent-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recent-work-media { height: 90px; }
  .tasks-page-heading { min-height: 0; align-items: stretch; flex-direction: column; padding: 18px; }
  .task-filters { padding-bottom: 3px; }
  .task-list-panel,
  .task-preview-panel { padding: 14px; border-radius: 14px; }
  .task-job-list { grid-template-columns: 1fr; }
  .task-list-summary span { display: none; }
  .api-code-heading { flex-direction: column; }
  .api-endpoint-list, .api-docs-endpoints { grid-template-columns: 1fr; }
  .api-docs-header { height: auto; min-height: 72px; grid-template-columns: 1fr; padding-top: 14px; padding-bottom: 14px; }
  .api-docs-main { width: min(100% - 24px, 1100px); margin-top: 18px; }
  .api-docs-hero { padding: 22px 18px; }
  .api-docs-hero h1 { font-size: 25px; }
}

@media (max-width: 420px) {
  .recent-work-grid { grid-template-columns: 1fr; }
  .recent-work-media { height: 130px; }
}

@media (max-width: 1000px) {
  .is-video-studio .customer-layout,
  .is-video-studio.is-video-materials-collapsed .customer-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(7, auto); }
  .is-video-studio .video-composer .upload-section { grid-column: 1; grid-row: 1; min-height: 0; max-height: none; position: static; }
  .is-video-studio .result-panel > .compact-heading { grid-column: 1; grid-row: 2; }
  .is-video-studio .video-stage { grid-column: 1; grid-row: 3; }
  .is-video-studio .creator-recent-panel { grid-column: 1; grid-row: 4 / span 3; }
  .is-video-studio .creator-recent-panel > .job-heading { grid-column: 1; grid-row: 4; }
  .is-video-studio .creator-recent-panel > .compact-job-list { grid-column: 1; grid-row: 5; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-video-studio .creator-recent-panel > .all-tasks-button { grid-column: 1; grid-row: 6; }
  .is-video-studio .video-generation-dock { grid-column: 1; grid-row: 7; }
}

@media (max-width: 720px) {
  .generated-image-toolbar { align-items: flex-start; }
  .generated-image-toolbar-actions { gap: 5px; }
  .generated-image-zoom-controls { order: 3; }
  .sidebar-collapse-button { display: none; }
  .customer-frame.is-sidebar-collapsed { grid-template-columns: 1fr; gap: 18px; }
  .customer-frame.is-sidebar-collapsed .customer-sidebar { padding: 6px; border-radius: 14px; }
  .customer-frame.is-sidebar-collapsed .customer-sidebar nav button { display: flex; min-width: 82px; padding: 8px 4px; font-size: 11px; }
  .is-video-studio .result-panel > .compact-job-list { grid-template-columns: 1fr; }
  .is-video-studio .video-composer .composer-top-controls,
  .is-video-studio .video-composer .composer-bottom-controls { grid-template-columns: 1fr; }
  .is-video-studio .video-composer .model-fieldset,
  .is-video-studio .video-composer .parameter-grid,
  .is-video-studio .video-composer .submit-row { grid-column: 1; }
  .is-video-studio .video-composer .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-video-studio .video-stage { min-height: 250px; padding: 12px; }
  .is-video-studio .video-stage > .empty-state { min-height: 226px; }
  .is-video-studio .video-generation-dock { position: static; }
  .is-video-studio .video-composer .prompt-field textarea { max-height: 320px; }
}
