:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --line: #e1e4e8;
  --line-strong: #c9cfd6;
  --text: #1f2329;
  --muted: #6b7280;
  --red: #bd2028;
  --red-dark: #8e1820;
  --red-soft: #fff3f3;
  --gold: #a66c2d;
  --green: #167a50;
  --shadow: 0 10px 28px rgba(31, 35, 41, 0.08);
  --radius: 9px;
  --radius-sm: 7px;
  --focus-ring: 0 0 0 3px rgba(189, 32, 40, 0.12);
  --content-max: 1480px;
}

/* v29 non-blocking task synchronization and honest pending media states. */
.video-asset-error.pending { color: #6b7280; }
.video-asset-load-error.pending { color: #6b7280; }

/* v31 fast login and non-blocking video archival. */
/* v32 bounded startup requests and launch-screen recovery. */
/* v34 protects durable workspace and generation history during slow synchronization. */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-required {
  display: block;
  min-height: 100vh;
  background: #f4f5f7;
}

body.login-required > *:not(#loginDialog):not(#accountRequestDialog):not(#workspaceEntry):not(#appLaunch) {
  display: none !important;
}

#appSidebar[hidden], #appShell[hidden] {
  display: none !important;
}

.app-launch, .workspace-entry { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center; gap: 14px; color: #202833; background: #f5f6f7; opacity: 1; transition: opacity 420ms cubic-bezier(.22, 1, .36, 1); pointer-events: none; will-change: opacity; }
.app-launch[hidden], .workspace-entry[hidden] { display: none !important; }
.app-launch::before, .workspace-entry::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--red); }
.app-launch.leaving { opacity: 0; }
.launch-brand { display: grid; justify-items: center; gap: 12px; }
.launch-brand img { display: block; width: min(300px, 58vw); height: 74px; object-fit: contain; }
.launch-brand small { color: #737d89; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.app-launch > span, .workspace-entry > span { color: var(--muted); font-size: 13px; }
.launch-progress { width: 180px; height: 3px; overflow: hidden; background: #dfe3e7; }
.launch-progress i { display: block; width: 42%; height: 100%; background: var(--red); animation: launch-progress 1.15s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes launch-progress { from { transform: translateX(-110%); } to { transform: translateX(245%); } }
.workspace-entry { z-index: 1100; opacity: 0; }
.workspace-entry.active { opacity: 1; }
.workspace-entry strong { margin-top: 4px; font-size: 17px; font-weight: 650; }
.workspace-entry-steps { display: flex; gap: 7px; margin-top: 2px; }
.workspace-entry-steps i { width: 30px; height: 3px; background: #d8dde2; transition: background 220ms ease, transform 220ms ease; }
.workspace-entry-steps i.active { background: #d78a8f; transform: scaleX(1.05); }
.workspace-entry-steps i.done { background: var(--red); }


.toast {
  position: fixed;
  z-index: 1200;
  top: calc(var(--ui-topbar-height, 64px) + 12px);
  left: 50%;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #e8c5c3;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 700;
  transform: translateX(-50%);
}

.openai-inline-error {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--red);
  background: #fff4f4;
  color: var(--red-dark);
}
.openai-inline-error strong,
.openai-inline-error p,
.openai-inline-error small { display: block; margin: 0; }
.openai-inline-error p { margin-top: 4px; font-weight: 650; overflow-wrap: anywhere; }
.openai-inline-error small { margin-top: 5px; color: #75585a; }

.toast.success {
  border-color: #a8d7c4;
  color: #106b47;
  background: #f4fcf8;
}

.toast.error {
  border-color: #e5a2a6;
  color: var(--red-dark);
  background: #fff4f4;
}

.reference-picker {
  position: fixed;
  z-index: 110;
  width: min(320px, calc(100vw - 24px));
  max-height: 230px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.reference-picker-title {
  padding: 4px 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-picker-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.reference-picker-item:hover {
  background: var(--surface-soft);
}

.reference-picker-item img,
.reference-picker-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: #f3ece9;
}

.reference-picker-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-picker-item span {
  min-width: 0;
}

.reference-picker-item b,
.reference-picker-item small {
  display: block;
}

.reference-picker-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  background: var(--surface);
  box-shadow: 8px 0 24px rgba(31, 35, 41, 0.025);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 8px 34px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
}

.brand strong {
  display: block;
  letter-spacing: 0;
}

small, .muted, .node p {
  color: var(--muted);
}

.nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
}

.nav.active {
  position: relative;
  border-color: #e8d6d8;
  color: var(--red-dark);
  background: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(31, 35, 41, 0.06);
}

.nav.active::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--red);
}

.app {
  min-width: 0;
}

.topbar {
  min-height: 104px;
  padding: 22px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(31, 35, 41, 0.02);
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.16;
}

h2 {
  margin-bottom: 14px;
  font-size: 17px;
}

.status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.status span {
  border: 1px solid #e6c8ca;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--red-dark);
  background: var(--red-soft);
  font-weight: 700;
}

.canvas-switcher {
  min-height: 92px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 36px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  box-shadow: inset 0 -1px 0 rgba(31, 35, 41, 0.015);
}

.canvas-switcher-copy {
  display: grid;
  gap: 4px;
}

.canvas-switcher-copy strong {
  font-size: 14px;
}

.top-action {
  border-color: var(--red);
  color: var(--red-dark);
  background: #fff;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: 24px 36px 36px;
  align-items: start;
}

.connection-panel {
  position: static;
}

.connection-panel .box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  column-gap: 12px;
  align-items: end;
}

.connection-panel .section-title,
.connection-panel h2,
.connection-panel .compact,
.connection-panel .storage-settings {
  grid-column: 1 / -1;
}

.connection-panel h2 { margin-bottom: 0; }

.connection-panel label {
  margin: 4px 0;
}

.page-view {
  padding: 28px 36px 48px;
}

.page-hero {
  padding: 38px 6px 24px;
  border-bottom: 1px solid var(--line);
}

.page-hero h2 {
  margin: 8px 0;
  font-size: 28px;
}

.page-hero p {
  color: var(--muted);
}

.date-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.date-filter select {
  width: 132px;
  min-height: 34px;
  padding: 4px 30px 4px 10px;
}
.date-filter label { display: grid; gap: 4px; font-weight: 800; }

.page-grid {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(320px, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.page-textarea {
  min-height: 220px;
}

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

.asset-grid img, .asset-card img, .asset-card video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f7eeeb;
}

.image-reference-item {
  position: relative;
}

.image-reference-item button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: rgba(41, 34, 31, 0.8);
  color: #fff;
  box-shadow: none;
}

.image-reference-item button:hover {
  background: var(--red);
}

.job-page-list {
  display: grid;
  gap: 14px;
  max-width: 900px;
  margin-top: 22px;
}

.job-page-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.job-page-card > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.job-page-card p, .asset-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.generation-record {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.generation-record summary {
  color: var(--red-dark);
  cursor: pointer;
  font-weight: 700;
}

.generation-record-body {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.generation-record-body > span {
  color: var(--muted);
  font-size: 12px;
}

.generation-record pre {
  max-height: 280px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff9f7;
  color: var(--ink);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.generation-record .quiet-action {
  justify-self: start;
}

.queue-video {
  display: block;
  width: min(520px, 100%);
  max-height: 300px;
  border-radius: 8px;
  background: #201514;
}

.lazy-video-shell {
  position: relative;
  width: min(520px, 100%);
}

.lazy-video-shell .queue-video {
  width: 100%;
}

.lazy-video-start {
  position: relative;
  display: block;
  width: 100%;
  min-height: 180px;
  padding: 0;
  overflow: hidden;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #201514;
  color: #fff;
}

.lazy-video-start img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 300px;
  object-fit: contain;
}

.lazy-video-start span {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid #fff;
  border-radius: 50%;
  background: rgba(33, 22, 20, 0.84);
  font-size: 18px;
}

.asset-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.library-upload-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px);
  gap: 10px;
  margin: 0 0 16px;
}

.library-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.asset-category {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid #d9dfe7;
  border-radius: 4px;
  background: #f6f8fa;
  color: #475467;
  font-size: 11px;
  font-weight: 800;
}

.asset-card .asset-description {
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.asset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.asset-tags i {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: #667085;
  font-size: 11px;
  font-style: normal;
}

.prompt-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin: 0 0 10px;
}

.prompt-template-row label { margin: 0; }
.prompt-template-row button { min-height: 42px; white-space: nowrap; }

.asset-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.asset-card-actions button {
  min-height: 32px;
  font-size: 12px;
}

.quiet-action {
  color: var(--muted);
  background: transparent;
}

.asset-audio {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 42px;
}

.empty-page {
  margin-top: 22px;
  padding: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}

.canvas-shell, .box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 3px 10px rgba(31, 35, 41, 0.04);
}

.canvas-shell {
  overflow: hidden;
}

.canvas-head {
  height: 52px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.canvas-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  min-width: 0;
}

.canvas-tab {
  min-height: 54px;
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.2;
}

.video-project-tab {
  position: relative;
  min-width: 0;
}

.video-project-tab .canvas-tab {
  width: 100%;
  text-align: left;
}

.canvas-tab-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  box-shadow: none !important;
}

.canvas-tab-close:hover {
  background: #fff;
  color: var(--red-dark);
}

.canvas-tab strong {
  color: var(--text);
  font-size: 14px;
}

.canvas-tab span {
  font-size: 11px;
}

.canvas-tab.active {
  border: 2px solid var(--red);
  color: var(--red-dark);
  background: var(--red-soft);
  font-weight: 800;
}

.canvas-tab.active strong {
  color: var(--red-dark);
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(31, 35, 41, 0.08), 0 3px 7px rgba(31, 35, 41, 0.05);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

button:hover:not(:disabled) {
  border-color: #dc858b;
  color: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 2px rgba(31, 35, 41, 0.1), 0 6px 12px rgba(31, 35, 41, 0.08);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 2px rgba(31, 35, 41, 0.12);
}

button:focus-visible {
  outline: 3px solid rgba(201, 36, 45, 0.22);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
}

.nav {
  box-shadow: none;
}

.nav:hover:not(:disabled) {
  box-shadow: none;
  background: var(--surface-soft);
}

.nav.nav-coming-soon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #777b82;
  background: #f1f2f3;
  opacity: 1;
}

.nav.nav-coming-soon small {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid #cfd2d6;
  border-radius: 4px;
  color: #747980;
  background: #e6e8ea;
  font-size: 9px;
  line-height: 1.2;
}

.canvas {
  position: relative;
  min-height: 2700px;
  background-color: #fbfcfd;
  background-image: linear-gradient(#e9edf1 1px, transparent 1px), linear-gradient(90deg, #e9edf1 1px, transparent 1px);
  background-size: 28px 28px;
}

.flow-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.flow-links path {
  fill: none;
  stroke: #c8a0a4;
  stroke-width: 2;
  stroke-linecap: round;
}

.node {
  position: absolute;
  width: 218px;
  min-height: 152px;
  padding: 14px;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 20px rgba(31, 35, 41, 0.09);
  cursor: grab;
  touch-action: none;
}

.node:active, .node.dragging-node {
  cursor: grabbing;
  box-shadow: 0 16px 34px rgba(31, 35, 41, 0.16);
  z-index: 5;
}
.node.material-drop-target,
.material-upload-zone.material-drop-target,
.image-reference-drop-area.material-drop-target,
.image-trusted-upload.material-drop-target {
  outline: 2px dashed var(--red);
  outline-offset: 4px;
  background: #fff7f6;
  box-shadow: 0 10px 24px rgba(167, 31, 37, 0.16);
}

.material-upload-zone {
  padding: 8px 0;
}

.material-source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.material-source-actions .upload-button,
.material-source-actions .library-pick-button { width: 100%; min-width: 0; min-height: 36px; margin-top: 10px; padding: 7px 8px; border-radius: 7px; font-size: 12px; white-space: nowrap; }
.library-pick-button { border: 1px solid #cfd5dc; background: #fff; color: #343a43; font-weight: 600; }
.library-pick-button:hover { border-color: #aeb6c0; background: #f7f8f9; }

.trusted-material-zone {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.image-node { left: 32px; top: 64px; width: 274px; }
.audio-node { left: 32px; top: 420px; width: 274px; }
.video-node { left: 32px; top: 624px; width: 274px; }
.prompt-node { display: none; }
.output-node {
  left: 348px;
  top: 64px;
  width: calc(100% - 382px);
  min-width: 460px;
  min-height: 520px;
  overflow: hidden;
  cursor: grab;
}

.fixed-output {
  resize: none;
}

.output-node #outputPreview {
  display: grid;
  min-height: 450px;
  align-content: center;
}

.output-node #outputPreview:has(.output-video) {
  align-content: start;
}

.flow-direction-node {
  position: absolute;
  z-index: 1;
  left: 348px;
  top: 620px;
  width: calc(100% - 382px);
  min-width: 330px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(300px, 0.8fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 20px rgba(31, 35, 41, 0.09);
  cursor: grab;
  touch-action: none;
}

.flow-direction-node::before {
  display: none;
}

.flow-direction-node::after {
  display: none;
}

.flow-direction-node.dragging-node { cursor: grabbing; z-index: 6; }

.flow-direction-node > .box {
  min-width: 0;
  padding: 14px;
  box-shadow: none;
}

.flow-direction-node > .box:first-child { grid-column: 1; grid-row: 1 / span 2; }
.flow-direction-node > .box:nth-of-type(2) { grid-column: 2; grid-row: 1; }
.flow-direction-node > .box:last-child { grid-column: 2; grid-row: 2; }

.flow-direction-node h2 { margin-bottom: 10px; }
.flow-direction-node #prompt {
  min-height: 660px;
  height: 660px;
}
.flow-direction-node .grid2 { grid-template-columns: 1fr 1fr; }
.flow-direction-node .short-textarea { min-height: 76px; }
.flow-direction-node .task-queue { max-height: 230px; overflow: auto; }

.node-title {
  display: flex;
  justify-content: space-between;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0f2;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 6px;
  min-height: 48px;
}

.asset-thumb {
  position: relative;
  width: 56px;
  height: 56px;
}

.cloud-state {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #e6bbb8;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.cloud-state.ready {
  border-color: #8bc5a9;
  background: #eef9f3;
  color: #157447;
}

.preview-grid img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}

.asset-video-item {
  position: relative;
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.asset-video-item video {
  width: 100%;
  max-height: 92px;
  border-radius: 6px;
  background: #1b1211;
}

.asset-video-item span,
.asset-audio-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-file-list {
  display: grid;
  gap: 6px;
}

.asset-audio-item {
  position: relative;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.remove-asset {
  position: absolute;
  z-index: 3;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: rgba(37, 22, 20, 0.82);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.remove-asset:hover {
  border-color: #fff;
  background: var(--red);
  color: #fff;
}

.storage-settings {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.storage-settings summary {
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.storage-settings[open] summary {
  margin-bottom: 10px;
}

.helper-link {
  display: inline-flex;
  margin: 4px 0 10px;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#prepareStorageBtn {
  width: 100%;
  margin-top: 4px;
}

.upload-button {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #e8c5c3;
  border-radius: 8px;
  color: var(--red-dark);
  background: var(--red-soft);
  cursor: pointer;
  font-weight: 800;
}

.upload-button.dragging {
  border-color: var(--red);
  background: #ffe2e3;
}

.trusted-upload-button {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #9acdb3;
  border-radius: 7px;
  background: #f1faf5;
  color: #256d4d;
  font-weight: 800;
}

.trusted-asset-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid #e6c7c3;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(52, 28, 24, 0.24);
}

.trusted-asset-dialog::backdrop { background: rgba(42, 24, 22, 0.36); }

.trusted-asset-form { padding: 20px; }

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head small { color: var(--red); font-weight: 900; }
.dialog-head h2 { margin: 4px 0 0; font-size: 20px; }
.dialog-close { min-width: 32px; padding: 2px 8px; font-size: 22px; line-height: 1; }
.trusted-asset-form label { display: grid; gap: 6px; margin-top: 14px; font-size: 13px; font-weight: 800; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-actions .primary { min-width: 142px; }
.login-dialog .secondary { width: 100%; margin-top: 10px; }
.admin-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; border: 0; border-radius: 0; }
.admin-dialog::backdrop { background: rgba(37, 22, 20, 0.4); }
.admin-dialog .trusted-asset-form { width: min(1680px, 100%); height: 100%; max-height: none; margin: 0 auto; overflow: auto; padding: 26px clamp(24px, 4vw, 72px) 42px; }
.admin-status { margin: 14px 0; padding: 10px 12px; border: 1px solid #d6e8dc; border-radius: 6px; color: #286548; background: #f4fbf6; font-size: 13px; }
.admin-section { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.admin-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.admin-panel { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.admin-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; user-select: none; }
.admin-panel summary::-webkit-details-marker { display: none; }
.admin-panel summary::after { content: "+"; color: var(--red); font-size: 20px; line-height: 1; }
.admin-panel[open] summary::after { content: "−"; }
.admin-panel summary span { font-weight: 900; font-size: 15px; }
.admin-panel summary small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 700; }
.admin-panel-content { display: grid; gap: 10px; padding: 0 18px 18px; border-top: 1px solid var(--line); }
.admin-panel-content > label { margin-top: 4px; }
.admin-subsection { display: grid; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.admin-assets-section { grid-column: 1 / -1; }
.admin-section > b { font-size: 14px; }
.admin-section label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
.admin-accounts { display: grid; gap: 8px; }
.admin-account { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.admin-account strong, .admin-account small { display: block; }
.admin-account small { margin-top: 3px; color: var(--muted); }
.admin-top-grid { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(400px, 1.1fr); gap: 24px; }
.admin-top-grid .admin-section { margin-top: 0; }
.admin-mail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.admin-mail-grid label { margin: 0; }
.admin-checkbox { display: flex !important; align-items: center; gap: 8px; padding-top: 26px; }
.admin-checkbox input { width: auto; }
.admin-account-requests { display: grid; gap: 10px; }
.admin-account-request { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(260px, 1.3fr) minmax(260px, 1.3fr) auto; gap: 14px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.admin-account-request strong, .admin-account-request small { display: block; }
.admin-account-request small { margin-top: 4px; color: var(--muted); }
.admin-request-purpose { margin: 0; color: var(--text); font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.admin-request-actions { display: grid; gap: 8px; min-width: 144px; }
.admin-request-actions input { min-width: 144px; }
.admin-request-state { color: var(--muted); font-size: 12px; }
.admin-assets-section { min-height: 0; }
.admin-assets-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.admin-assets-head label { min-width: 280px; margin: 0; }
.admin-generation-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.admin-generation-summary span { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); font-size: 13px; font-weight: 800; }
.admin-generations { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; max-height: 430px; overflow: auto; padding: 2px; }
.admin-generation { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.admin-generation header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-generation small { display: block; margin: 5px 0; color: var(--muted); }
.admin-generation video, .admin-generation img { display: block; width: 100%; height: 180px; margin: 8px 0; border-radius: 4px; background: #111; object-fit: contain; }
.admin-generation summary { cursor: pointer; font-size: 12px; font-weight: 800; color: var(--red); }
.admin-generation pre { white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; padding: 8px; border-radius: 4px; background: var(--surface-soft); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 900px) { .admin-dialog .trusted-asset-form { padding: 18px; } .admin-board, .admin-mail-grid { grid-template-columns: 1fr; gap: 12px; } .admin-account-request { grid-template-columns: 1fr; } .admin-assets-head { align-items: stretch; flex-direction: column; } .admin-assets-head label { min-width: 0; } .admin-generation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .admin-generations { grid-template-columns: 1fr; max-height: none; } }

/* Global design system: visual layer only; existing business markup and bindings remain intact. */
body { grid-template-columns: 216px minmax(0, 1fr); background: #f5f6f8; font-size: 14px; }
body, button, input, textarea, select { font-weight: 400; }
.sidebar { padding: 20px 12px; box-shadow: none; }
.brand { margin: 2px 10px 30px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; font-size: 14px; }
.brand strong { font-size: 14px; font-weight: 700; }
.brand small { font-size: 12px; }
.sidebar-nav { gap: 20px; }
.nav-group { display: grid; gap: 3px; }
.nav-group-label { padding: 0 10px 6px; color: #8a9099; font-size: 12px; font-weight: 500; }
.nav { min-height: 40px; margin: 0; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); color: #5f6671; font-size: 14px; font-weight: 500; }
.nav:hover { background: #f1f2f4; color: #252a31; }
.nav.active { border: 0; border-radius: var(--radius-sm); box-shadow: none; color: #252a31; background: #f7ecec; font-weight: 600; }
.nav.active::before { left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 0 2px 2px 0; }
.topbar { min-height: 64px; height: 64px; padding: 0 32px; border-bottom: 1px solid var(--line); box-shadow: none; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: 0; }
.status { gap: 10px; flex-wrap: nowrap; }
.model-badge, .status span.model-badge { border: 1px solid #d9e3db; border-radius: 999px; padding: 5px 9px; color: #31624b; background: #f5faf6; font-size: 12px; font-weight: 500; }
.task-entry { min-height: 34px; padding: 6px 10px; border-color: transparent; background: #f1f2f4; color: #444b55; font-size: 12px; font-weight: 500; }
.task-entry:hover { background: #e7e9ed; border-color: transparent; }
.user-menu { position: relative; }
.user-avatar { width: 34px; height: 34px; min-height: 34px; padding: 0; border: 0; border-radius: 50%; background: #272c33; color: #fff; font-size: 13px; font-weight: 600; }
.user-avatar:hover { background: #101418; }
.user-dropdown { position: absolute; z-index: 30; right: 0; top: calc(100% + 10px); display: grid; min-width: 176px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 12px 30px rgba(20, 24, 30, 0.15); }
.user-menu-name { padding: 8px 10px; color: #6d7480; font-size: 12px; border-bottom: 1px solid var(--line); }
.user-dropdown button { justify-content: flex-start; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: #303640; text-align: left; font-size: 13px; box-shadow: none; }
.user-dropdown button:hover { background: #f2f3f5; }
.user-dropdown .danger-menu { color: #ad2830; }
.canvas-switcher { min-height: 76px; padding: 14px 32px; background: #fff; box-shadow: none; }
.workspace, .page-view { width: min(100%, calc(var(--content-max) + 64px)); margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.workspace { padding-top: 22px; padding-bottom: 36px; }
.page-view { padding-top: 0; }
.page-hero { padding: 28px 0 22px; }
.page-hero h2 { margin: 0 0 8px; font-size: 24px; font-weight: 600; }
.page-hero p { margin: 0; font-size: 13px; }
.section-title { color: #707782; font-size: 12px; font-weight: 500; letter-spacing: 0; }
h2 { font-size: 16px; font-weight: 600; }
label { font-size: 13px; font-weight: 500; }
button, input, select, textarea { border-radius: var(--radius-sm); }
button { min-height: 40px; padding: 9px 13px; border: 1px solid #d9dde3; background: #fff; color: #303640; font-weight: 500; box-shadow: none; }
button:hover { border-color: #bcc3cc; background: #fafafa; }
button.primary, #generateBtn, #pageImagePlanBtn, #accountRequestSubmitBtn { border-color: var(--red); background: var(--red); color: #fff; font-weight: 600; }
button.primary:hover, #generateBtn:hover, #pageImagePlanBtn:hover, #accountRequestSubmitBtn:hover { border-color: var(--red-dark); background: var(--red-dark); }
.top-action, .upload-button, .trusted-upload-button { border-color: #d7dbe1; background: #fff; color: #343a43; font-weight: 500; }
input, select { min-height: 40px; border-color: #d7dbe1; background: #fff; color: #2b3139; font-size: 14px; }
textarea { border-color: #d7dbe1; background: #fff; color: #2b3139; font-size: 14px; line-height: 1.6; }
input:hover, select:hover, textarea:hover { border-color: #b9c0c9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #bd2028; box-shadow: var(--focus-ring); }
.box, .node, .job-page-card, .asset-card, .admin-generation, .admin-panel { border-color: #e0e3e7; border-radius: var(--radius); box-shadow: none; }
.job-page-card, .asset-card { box-shadow: none; }
.canvas-shell { box-shadow: none; }
dialog { border: 0; border-radius: 12px; box-shadow: 0 18px 56px rgba(20, 24, 30, 0.22); }
dialog::backdrop { background: rgba(17, 21, 27, 0.5); }
.trusted-asset-dialog .trusted-asset-form, .login-dialog .login-form { border-color: transparent; border-radius: 12px; box-shadow: none; }
@media (max-width: 900px) { body { grid-template-columns: 1fr; } .sidebar { display: none; } .topbar { padding: 0 18px; } .workspace, .page-view { padding-left: 18px; padding-right: 18px; } .canvas-switcher { padding: 12px 18px; grid-template-columns: 1fr auto; } .canvas-switcher-copy { display: none; } }

/* Video generation workspace: existing controls are retained, only their presentation changes. */
.canvas-switcher { width: 100%; max-width: none; height: 48px; margin: 0; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 12px; }
.canvas-switcher-copy { display: none; }
.canvas-tabs { display: flex; min-width: 0; height: 100%; gap: 2px; overflow-x: auto; }
.video-project-tab { position: relative; display: flex; align-items: stretch; }
.canvas-tab { min-width: 86px; height: 48px; padding: 0 14px; border: 0; border-radius: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.canvas-tab strong { font-weight: 500; }
.canvas-tab span { width: 7px; height: 7px; overflow: hidden; border-radius: 50%; background: #aab1ba; color: transparent; font-size: 0; }
.canvas-tab.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--red); }
.canvas-tab.active strong { font-weight: 600; }
.canvas-tab.active span { background: #28a66a; }
.canvas-tab-close { position: absolute; right: 3px; top: 12px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); opacity: 0; }
.video-project-tab:hover .canvas-tab-close { opacity: 1; }
.top-action { height: 32px; margin-left: auto; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 13px; }

.workspace { width: 100%; max-width: none; min-height: calc(100vh - 112px); height: auto; margin: 0; padding: 0 32px 24px; display: grid; grid-template-columns: 280px minmax(420px, 1fr) 320px; gap: 0; overflow: visible; position: relative; background: var(--surface); }
.material-panel, .creative-panel, .generation-panel { min-width: 0; min-height: 0; background: var(--surface); }
.material-panel { border-right: 1px solid var(--line); display: block; }
.material-panel-heading, .creative-tabs, .generation-settings > h2 { height: 64px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.material-panel-heading h2, .creative-heading h2, .generation-settings > h2, .task-drawer h2 { margin: 0; font-size: 16px; font-weight: 600; }
.material-panel-heading p, .creative-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.material-scroll { min-height: 0; height: auto; overflow: visible; padding: 0 20px 24px; background: transparent; }
.flow-links { display: none; }
.node { position: static !important; transform: none !important; width: auto !important; min-width: 0; min-height: 0; padding: 18px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
.material-group h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.material-group .node-title { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 600; }
.preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.asset-thumb { border-radius: 8px; overflow: hidden; }
.material-group .upload-button, .material-group .trusted-upload-button { width: 100%; margin-top: 10px; border-radius: 7px; }
.material-group .trusted-upload-button { border-color: #cfd5dc; background: #fff; color: var(--text); }
.material-group p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.material-group .asset-file-list, .material-group .video-preview { max-height: 180px; overflow: auto; }
.material-group .empty-icon { width: 36px; height: 36px; border-color: var(--line); color: var(--muted); background: #f8f9fa; font-size: 18px; }
.image-node { order: 1; }
.video-node { order: 2; }
.audio-node { order: 3; }

/* The header menu must sit above the fixed-height workspace instead of being painted under it. */
.topbar { position: relative; z-index: 100; }

.creative-panel { display: flex; flex-direction: column; }
.creative-tabs { display: flex; align-items: flex-end; gap: 22px; padding: 0 26px; }
.creative-tab { height: 64px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 14px; }
.creative-tab.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--red); }
.result-state-dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: #aab1ba; vertical-align: middle; }
.result-state-dot.processing { background: #d38b28; animation: status-pulse 1.3s ease-in-out infinite; }
.result-state-dot.done { background: #28a66a; }
.result-state-dot.failed { background: var(--red); }
@keyframes status-pulse { 50% { opacity: 0.42; } }
.creative-pane { min-height: 0; flex: 1; padding: 24px 26px; display: flex; flex-direction: column; overflow: hidden; }
.creative-heading { margin-bottom: 12px; }
.prompt-guide { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 14px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.prompt-template-row { display: flex; align-items: end; gap: 8px; margin-bottom: 14px; }
.prompt-template-row label { width: min(280px, 75%); margin: 0; }
.prompt-template-row label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.prompt-template-row select { height: 38px; }
.prompt-template-row button { height: 38px; border-radius: 7px; }
#prompt { min-height: 0; flex: 1; resize: none; border: 1px solid transparent; border-radius: 8px; background: #f7f8fa; font-size: 14px; line-height: 1.65; }
#prompt:focus { border-color: #d4d8de; background: #fff; }
.result-heading { height: 28px; display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 14px; }
.result-heading #runState { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
#outputPreview { min-height: 0; flex: 1; overflow: auto; padding-top: 12px; }
#outputPreview .output-video { max-height: calc(100vh - 255px); background: #111; }

.generation-panel { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.generation-settings { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: auto; }
.generation-settings > h2 { flex: 0 0 64px; }
.generation-settings > label, .generation-settings > .grid2, .advanced-settings, .generation-settings > .compact { margin-left: 20px; margin-right: 20px; }
.generation-settings > label { margin-top: 15px; }
.generation-settings .grid2 { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.generation-settings select, .generation-settings input { height: 40px; }
.advanced-settings { margin-top: 16px; border-top: 1px solid var(--line); }
.advanced-settings summary { height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--text); font-size: 13px; font-weight: 500; }
.advanced-settings-content { display: grid; gap: 12px; padding: 0 0 14px; }
.advanced-settings .short-textarea { min-height: 100px; }
.generation-settings > .compact { margin-top: 10px; font-size: 12px; }
.generation-footer { position: sticky; bottom: 0; margin-top: auto; padding: 16px 20px 20px; border-top: 1px solid var(--line); background: var(--surface); }
#generateBtn { width: 100%; min-height: 42px; }
.task-drawer-entry { position: absolute; right: 344px; bottom: 38px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 12px; }
.task-drawer { position: fixed; z-index: 50; top: 64px; right: 0; bottom: 0; width: min(420px, 92vw); padding: 20px; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -16px 0 36px rgba(20, 24, 30, 0.12); overflow: auto; }
.task-drawer-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.task-drawer-head button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 22px; }
.task-drawer .task-queue { margin-top: 16px; }

@media (max-width: 1440px) { .workspace { grid-template-columns: 248px minmax(360px, 1fr) 300px; padding-left: 20px; padding-right: 20px; } .task-drawer-entry { right: 322px; } }
@media (max-width: 1279px) { .workspace { grid-template-columns: 230px minmax(320px, 1fr) 280px; padding-left: 16px; padding-right: 16px; } .task-drawer-entry { right: 298px; } }

/* Let the prompt use the full height of the page row when the workspace scrolls as a page. */
.workspace { align-items: stretch; }
.creative-panel { align-self: stretch; height: 100%; }
#creativePromptPane { min-height: 0; }
#creativePromptPane #prompt { min-height: 0; height: 100%; }

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 72px; }
  .topbar h1 { font-size: 20px; }
  .status { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; scrollbar-width: thin; }
  .status .task-entry,
  .status .user-menu { flex: 0 0 auto; }
}

/* v10: compact admin forms, complete account controls and visible live support. */
.admin-panel-content > label,
.admin-subsection > label,
.admin-mail-grid,
.admin-ui-grid,
.admin-ui-logo,
.admin-prompt-create,
.mail-template-editor,
.admin-notification-editor { width: min(100%, 820px); }
.admin-panel-content > label input,
.admin-subsection > label input { width: 100%; }
.admin-mail-grid,
.admin-ui-grid,
.admin-support-filters,
.admin-notification-audience { justify-items: stretch; }
.admin-mail-grid label,
.admin-ui-grid label,
.admin-notification-audience label { max-width: 680px; }
#adminSmtpPort { max-width: 180px; }
#adminUiAccentColor { max-width: 180px; }
.admin-checkbox { width: max-content !important; max-width: 100%; padding-top: 6px; }
.admin-service-actions { max-width: 820px; }
.admin-service-actions button { flex: 0 1 auto; min-width: 150px; }
.admin-accounts { width: min(100%, 980px); }
.admin-account { grid-template-columns: minmax(220px, 1fr) auto; gap: 14px; }
.admin-account-identity { display: flex; align-items: center; min-width: 0; gap: 10px; }
.admin-account-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #eef0f3; font-size: 18px; }
.admin-account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.admin-account.is-deleted { background: #f4f5f6; opacity: .72; }
.admin-account.is-deleted strong { text-decoration: line-through; }
.admin-account-request { width: min(100%, 980px); }
.admin-request-actions,
.admin-approve-fields { max-width: 720px; }
.admin-support-filters { max-width: 720px; }

.status .task-entry {
  width: 108px;
  min-width: 108px;
  height: 36px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
  color: #444b55;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.status .task-entry:hover,
.status .prompt-request-entry:hover { border-color: #bfc6ce; color: #252d38; background: #f6f7f9; }
.status .prompt-request-entry { border-color: #dfe3e8; color: #444b55; background: #fff; }
.task-entry > span:not(.unread-badge) {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  color: #56606c;
  background: #eceff2;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.status .unread-badge { color: #fff; background: var(--red); }
.user-avatar { font-size: 18px; line-height: 1; }

.admin-support-alert {
  position: fixed;
  z-index: 150;
  top: 76px;
  right: 24px;
  width: min(360px, calc(100vw - 32px));
  padding: 16px 48px 16px 17px;
  border: 1px solid #e2e6ea;
  border-left: 3px solid var(--red);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(31, 38, 46, .16);
}
.admin-support-alert[hidden] { display: none; }
.admin-support-alert small { display: block; margin-bottom: 4px; color: var(--red-dark); font-size: 11px; font-weight: 700; }
.admin-support-alert strong { display: block; color: #252d38; font-size: 15px; }
.admin-support-alert p { margin: 7px 0 12px; overflow: hidden; color: #66717e; font-size: 13px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.admin-support-alert > .primary { min-height: 34px; padding: 6px 12px; }
.admin-support-alert-close { position: absolute; top: 9px; right: 9px; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; background: transparent; font-size: 18px; }

@media (max-width: 680px) {
  .admin-account { grid-template-columns: minmax(0, 1fr); }
  .admin-account-actions { justify-content: flex-start; }
  .status .task-entry { width: 104px; min-width: 104px; }
  .admin-support-alert { top: 82px; right: 16px; }
}

/* v12: real-time support, account controls and the published workspace editor. */
:root {
  --ui-page-bg: var(--bg);
  --ui-surface: var(--surface);
  --ui-text: var(--text);
  --ui-muted: var(--muted);
  --ui-border: var(--line);
  --ui-button-radius: 7px;
  --ui-card-radius: 7px;
  --ui-spacing-scale: 1;
  --ui-font-scale: 1;
  --ui-sidebar-width: 198px;
  --ui-topbar-height: 64px;
  --ui-content-width: 1440px;
}

body:not(.login-required) {
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  background: var(--ui-page-bg);
  color: var(--ui-text);
  font-size: calc(16px * var(--ui-font-scale));
}

.sidebar,
.topbar,
.workspace,
.page-view { border-color: var(--ui-border); background-color: var(--ui-surface); }
.topbar { min-height: var(--ui-topbar-height); height: var(--ui-topbar-height); }
.page-view:not(.home-page-view) { max-width: var(--ui-content-width); margin-inline: auto; }
button, input, textarea, select { border-radius: var(--ui-button-radius); }
.box, .node, .admin-panel, .media-asset-card, .video-asset-card { border-radius: var(--ui-card-radius); }
small, .muted, .node p { color: var(--ui-muted); }

.sidebar-nav > .nav { order: var(--nav-order, 0); }
.sidebar-nav .nav-group:has(.nav:not([hidden])) { display: contents; }
.sidebar-nav .nav-group-label { display: none; }
.home-hero { display: flex; flex-direction: column; }
.home-quick-module { width: 100%; }
.page-view:not(.home-page-view) { display: flex; flex-direction: column; }
.image-workspace { display: grid; }

.admin-support-dialog {
  width: min(1120px, calc(100vw - 36px));
  max-width: none;
  padding: 0;
}
.admin-support-dialog::backdrop { background: rgba(25, 30, 36, .42); backdrop-filter: blur(3px); }
.admin-support-shell { width: 100%; min-height: min(760px, calc(100vh - 48px)); max-height: calc(100vh - 48px); padding: 22px; overflow: hidden; }
.admin-support-layout { min-height: 420px; height: min(56vh, 590px); }
.admin-support-conversation { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; background: #fff; }
.admin-support-messages { max-height: none; min-height: 0; padding-right: 6px; }
.admin-support-reply { grid-template-columns: minmax(0, 1fr); padding-top: 12px; }
.admin-support-reply .admin-service-actions { justify-content: flex-end; }
.support-shell { min-height: min(720px, calc(100vh - 44px)); }
.support-history { max-height: none; min-height: 260px; }
.support-message p:empty { display: none; }
.support-compose-actions button,
.admin-support-reply button { min-height: 38px; }
.supportStatus.success { color: var(--green); }

.ui-editor-dialog {
  width: calc(100vw - 32px);
  max-width: 1680px;
  height: calc(100vh - 32px);
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #f5f6f8;
  box-shadow: 0 24px 80px rgba(22, 27, 34, .25);
}
.ui-editor-dialog::backdrop { background: rgba(24, 29, 35, .46); backdrop-filter: blur(4px); }
.ui-editor-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.ui-editor-header { display: flex; justify-content: space-between; gap: 24px; padding: 18px 22px; border-bottom: 1px solid #dde1e6; background: #fff; }
.ui-editor-header small { color: var(--red); font-size: 10px; font-weight: 800; }
.ui-editor-header h2 { margin: 3px 0 4px; font-size: 24px; }
.ui-editor-header p { margin: 0; color: #77808c; font-size: 13px; }
.ui-editor-body { display: grid; grid-template-columns: minmax(360px, 460px) minmax(0, 1fr); min-height: 0; }
.ui-editor-controls { overflow: auto; padding: 16px; border-right: 1px solid #dde1e6; background: #fff; }
.ui-editor-controls > details { margin-bottom: 10px; border: 1px solid #e1e4e8; border-radius: 6px; }
.ui-editor-controls > details > summary { padding: 12px 14px; font-weight: 750; cursor: pointer; }
.ui-editor-controls > details > *:not(summary) { margin-inline: 14px; }
.ui-editor-controls > details > :last-child { margin-bottom: 14px; }
.ui-editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ui-editor-fields label { display: grid; gap: 5px; color: #596370; font-size: 12px; font-weight: 650; }
.ui-editor-fields input { width: 100%; min-height: 38px; }
.ui-editor-theme-fields input[type="color"] { height: 38px; padding: 4px; }
.ui-editor-theme-fields input[type="range"] { min-height: 24px; padding: 0; }
.ui-editor-theme-fields output { color: #8a929d; font-size: 11px; }
.admin-ui-logo { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; margin-top: 12px; }
.admin-ui-logo img { width: 110px; height: 54px; object-fit: contain; border: 1px solid #e1e4e8; background: #fff; }
.ui-editor-module-list { display: grid; gap: 6px; margin-bottom: 16px; }
.ui-editor-module { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; min-height: 42px; padding: 7px 9px; border: 1px solid #dde1e6; border-radius: 6px; background: #fafbfc; cursor: grab; }
.ui-editor-module:active { cursor: grabbing; }
.ui-editor-drag-handle { color: #9aa1aa; font-size: 16px; }
.ui-editor-module label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.ui-editor-module input { width: 15px; height: 15px; }
.ui-editor-preview-panel { min-width: 0; overflow: auto; padding: 18px; }
.ui-editor-preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ui-editor-preview-head > div { display: grid; gap: 2px; }
.ui-editor-preview-head span { color: #7c8590; font-size: 12px; }
.ui-editor-preview { min-height: 520px; overflow: hidden; border: 1px solid #d9dde2; border-radius: 7px; background: var(--preview-bg); box-shadow: 0 10px 32px rgba(33, 39, 46, .08); }
.ui-preview-app { display: grid; grid-template-columns: 156px minmax(0, 1fr); min-height: 520px; color: var(--preview-text); }
.ui-preview-app > aside { display: flex; flex-direction: column; gap: 5px; padding: 18px 12px; border-right: 1px solid var(--preview-border); background: var(--preview-surface); }
.ui-preview-app > aside b { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 18px; border-radius: 6px; color: #fff; background: var(--preview-accent); }
.ui-preview-app > aside span { padding: 8px; color: var(--preview-muted); font-size: 11px; }
.ui-preview-app > main { min-width: 0; }
.ui-preview-app header { display: flex; justify-content: space-between; align-items: center; min-height: 58px; padding: 0 18px; border-bottom: 1px solid var(--preview-border); background: var(--preview-surface); }
.ui-preview-app header nav { display: flex; gap: 5px; }
.ui-preview-app header em { padding: 5px 7px; border: 1px solid var(--preview-border); border-radius: 5px; color: var(--preview-muted); font-size: 8px; font-style: normal; }
.ui-preview-content { padding: 42px 8%; }
.ui-preview-content > small { color: var(--preview-muted); }
.ui-preview-content > h2 { margin: 8px 0 24px; font-size: 30px; }
.ui-preview-content > section { display: grid; gap: 8px; margin-bottom: 10px; padding: 16px; border: 1px solid var(--preview-border); border-radius: 6px; background: var(--preview-surface); }
.ui-preview-content > section i { display: block; width: 86%; height: 8px; background: color-mix(in srgb, var(--preview-border) 70%, transparent); }
.ui-preview-content > section i:last-child { width: 58%; }
.ui-preview-composer { position: relative; min-height: 150px; padding: 18px; border: 1px solid var(--preview-border); border-radius: 8px; background: var(--preview-surface); color: var(--preview-muted); font-size: 12px; }
.ui-preview-composer button { position: absolute; right: 14px; bottom: 14px; padding: 8px 14px; border: 0; color: #fff; background: var(--preview-accent); }
.ui-editor-history { margin-top: 18px; }
.ui-editor-history h3 { font-size: 14px; }
.ui-editor-history article { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 7px; padding: 10px 12px; border: 1px solid #dfe3e7; border-radius: 6px; background: #fff; }
.ui-editor-history article div { display: grid; gap: 2px; }
.ui-editor-history article small { font-size: 11px; }
.ui-editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 12px 18px; border-top: 1px solid #dde1e6; background: #fff; }
.ui-editor-footer p { margin: 0; color: #69727d; font-size: 12px; }
.ui-editor-footer > div { display: flex; gap: 8px; }

@media (max-width: 980px) {
  .ui-editor-dialog { width: 100vw; height: 100vh; max-width: none; }
  .ui-editor-body { grid-template-columns: 1fr; }
  .ui-editor-controls { max-height: 50vh; border-right: 0; border-bottom: 1px solid #dde1e6; }
  .ui-editor-preview { min-height: 420px; }
  .ui-preview-app { min-height: 420px; }
  .admin-support-layout { grid-template-columns: 1fr; height: auto; max-height: 58vh; overflow: auto; }
  .admin-support-list { max-height: 210px; }
  .ui-editor-footer { align-items: flex-start; flex-direction: column; }
  .ui-editor-footer > div { width: 100%; overflow-x: auto; }
}

/* Compact prompt reference and team-managed prompt catalog. */
.prompt-reference-bar {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 9px 10px 9px 13px;
  border: 1px solid #e1e5e9;
  border-left: 3px solid var(--red);
  border-radius: 7px;
  background: #fafbfc;
}
.prompt-reference-bar h2 { margin: 0; color: #242c36; font-size: 14px; font-weight: 600; }
.prompt-reference-bar p { margin: 2px 0 0; color: #7a8490; font-size: 12px; }
.prompt-reference-open { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; }
.prompt-reference-open > span { color: #7a8490; font-size: 12px; font-weight: 500; white-space: nowrap; }
.icon-button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 7px;
  color: #4b5563;
  background: #fff;
  font-size: 17px;
}
.icon-button:hover { border-color: #b8c0c9; background: #f3f5f7; }
.prompt-request-entry { border-color: #e6c8ca; color: var(--red-dark); background: #fff; }
.prompt-request-entry:hover { border-color: #d89da2; color: var(--red-dark); background: #fff7f7; }

.prompt-reference-dialog { width: min(980px, calc(100vw - 28px)); max-width: none; }
.prompt-reference-shell { width: 100%; max-height: min(860px, calc(100vh - 36px)); padding: 24px 26px 20px; overflow: hidden; }
.prompt-reference-shell .dialog-head { margin-bottom: 14px; }
.prompt-reference-shell .dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.prompt-reference-content {
  min-height: 0;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 4px 18px 8px 2px;
  scrollbar-gutter: stable;
}
.prompt-reference-content section { padding: 15px 0; border-bottom: 1px solid #edf0f2; }
.prompt-reference-content section:first-child { padding-top: 2px; }
.prompt-reference-content section:last-child { border-bottom: 0; }
.prompt-reference-content h3 { margin: 0 0 7px; color: #252d38; font-size: 15px; font-weight: 650; }
.prompt-reference-content p { margin: 0; color: #4f5966; font-size: 14px; line-height: 1.85; }
.prompt-reference-actions { flex: 0 0 auto; padding-top: 14px; border-top: 1px solid #edf0f2; }

.prompt-request-dialog { width: min(680px, calc(100vw - 28px)); max-width: none; }
.prompt-request-dialog .trusted-asset-form { width: 100%; padding: 26px; }
.prompt-request-grid, .admin-prompt-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.prompt-request-dialog textarea { min-height: 100px; resize: vertical; }

.admin-prompt-section { grid-column: 1 / -1; }
.admin-prompt-create { display: grid; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid #edf0f2; }
.admin-prompt-create h3, .admin-subheading h3 { margin: 0; color: #202833; font-size: 15px; font-weight: 600; }
.admin-prompt-create > label, .admin-prompt-fields label, .admin-prompt-review > label, .admin-prompt-template > label {
  display: grid;
  gap: 7px;
  color: #65707d;
  font-size: 13px;
  font-weight: 500;
}
.admin-prompt-create textarea, .admin-prompt-review textarea, .admin-prompt-template textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  resize: vertical;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: #252d38;
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
}
.admin-prompt-create textarea:focus, .admin-prompt-review textarea:focus, .admin-prompt-template textarea:focus { outline: none; border-color: #d97b82; box-shadow: 0 0 0 3px rgba(195, 31, 43, 0.1); }
.admin-subheading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
.admin-subheading span { color: #7a8490; font-size: 12px; }
.admin-prompt-requests, .admin-prompt-templates { display: grid; gap: 12px; }
.admin-prompt-request, .admin-prompt-template { display: grid; gap: 13px; padding: 15px; border: 1px solid #e3e7eb; border-radius: 8px; background: #fafbfc; }
.admin-prompt-request header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.admin-prompt-request header strong, .admin-prompt-request header small { display: block; }
.admin-prompt-request header strong { color: #242c36; font-size: 14px; }
.admin-prompt-request header small { margin-top: 4px; color: #77818d; font-size: 12px; }
.admin-prompt-request header > span { flex: 0 0 auto; color: var(--red-dark); font-size: 12px; font-weight: 600; }
.admin-prompt-request dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.admin-prompt-request dl div { min-width: 0; }
.admin-prompt-request dt { margin-bottom: 4px; color: #7a8490; font-size: 12px; }
.admin-prompt-request dd { margin: 0; color: #4f5966; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.admin-prompt-review { display: grid; gap: 11px; padding-top: 13px; border-top: 1px solid #e4e8ec; }
.admin-prompt-review-actions { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; gap: 8px; align-items: center; }
.admin-prompt-review-actions button { min-height: 38px; }
.admin-prompt-template footer { display: flex; align-items: center; gap: 9px; }
.admin-prompt-template footer .admin-checkbox { margin-right: auto; }
.admin-prompt-template footer > span { color: #89929c; font-size: 11px; }
.admin-prompt-template footer button { min-height: 36px; }
.danger-button { color: #a12630; border-color: #e5c7ca; background: #fff; }
.danger-button:hover { border-color: #cf8f95; background: #fff7f7; }

@media (max-width: 760px) {
  .prompt-reference-shell { padding: 18px; }
  .prompt-reference-content { max-height: calc(100vh - 205px); padding-right: 8px; }
  .prompt-request-grid, .admin-prompt-fields, .admin-prompt-request dl { grid-template-columns: 1fr; }
  .admin-prompt-review-actions { grid-template-columns: 1fr; }
  .admin-prompt-template footer { align-items: stretch; flex-direction: column; }
  .admin-prompt-template footer .admin-checkbox { margin-right: 0; }
}

/* Team admin: visual layer only. Existing fields, controls and behavior stay intact. */
.admin-dialog { background: #f6f7f8; }
.admin-dialog::backdrop { background: rgba(24, 29, 36, 0.42); }
.admin-dialog .trusted-asset-form {
  width: min(1520px, 100%);
  padding: 28px clamp(24px, 3vw, 48px) 40px;
  background: #f6f7f8;
}
.admin-dialog .dialog-head { margin-bottom: 16px; }
.admin-dialog .dialog-head small { color: var(--red); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.admin-dialog .dialog-head h2 { margin-top: 4px; font-size: 24px; font-weight: 600; }
.admin-dialog .dialog-close { width: 36px; height: 36px; border-radius: 8px; color: #4b5563; background: #fff; border-color: #dfe3e8; }

.admin-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 9px 12px;
  border: 1px solid #d8e7dc;
  border-radius: 8px;
  background: #f4faf5;
  color: #347155;
  font-size: 13px;
  font-weight: 500;
}
.admin-board { grid-template-columns: minmax(0, 1fr); gap: 20px; }
.admin-board-columns { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.admin-board-column { min-width: 0; display: grid; gap: 20px; align-content: start; }
.admin-panel {
  border-color: #e1e5e9;
  border-radius: 9px;
  background: #fff;
}
.admin-panel summary { padding: 17px 20px; }
.admin-panel summary::after { color: #7a8490; font-size: 18px; font-weight: 400; }
.admin-panel summary span { font-size: 16px; font-weight: 600; color: #202833; }
.admin-panel summary small { color: #7a8490; font-size: 13px; font-weight: 400; }
.admin-panel-content { gap: 16px; padding: 18px 20px 22px; border-top-color: #edf0f2; }
.admin-service-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-service-actions button { flex: 1 1 220px; }
#adminHealthStatus { white-space: pre-line; line-height: 1.55; }
.admin-panel-content > label,
.admin-mail-grid label,
.admin-assets-head label {
  display: grid;
  gap: 7px;
  color: #65707d;
  font-size: 13px;
  font-weight: 500;
}
.admin-dialog input,
.admin-dialog select {
  min-height: 40px;
  border-color: #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: #252d38;
  font-size: 14px;
}
.admin-dialog input:hover,
.admin-dialog select:hover { border-color: #cbd2d9; }
.admin-dialog input:focus,
.admin-dialog select:focus { border-color: #d97b82; box-shadow: 0 0 0 3px rgba(195, 31, 43, 0.1); }
#saveServiceBtn {
  justify-self: start;
  min-height: 40px;
  padding-inline: 16px;
  border-color: #cfd6de;
  background: #fff;
  color: #34404e;
}
#saveServiceBtn:hover { border-color: #9ca8b5; background: #f8fafb; }
.admin-subsection {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid #edf0f2;
}
.admin-subsection > b { color: #202833; font-size: 16px; font-weight: 600; }
.admin-dialog .compact { margin: -5px 0 0; color: #77818d; font-size: 12px; font-weight: 400; line-height: 1.6; }
#createAccountBtn { justify-self: start; min-height: 40px; padding-inline: 16px; }
.admin-accounts { display: grid; gap: 8px; }
.admin-account {
  min-height: 58px;
  padding: 11px 12px;
  border-color: #e5e8ec;
  border-radius: 8px;
  background: #fafbfc;
}
.admin-account strong { font-size: 14px; font-weight: 600; color: #252d38; }
.admin-account small { color: #77818d; font-size: 12px; font-weight: 400; }
.admin-account button { min-height: 32px; padding-inline: 10px; border-radius: 7px; font-size: 12px; }

.admin-mail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-checkbox {
  display: flex !important;
  align-items: center;
  align-self: end;
  min-height: 40px;
  gap: 8px !important;
  color: #4b5563 !important;
}
.admin-checkbox input { min-height: auto; }
.admin-account-requests { display: grid; gap: 10px; }
.admin-account-request {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  padding: 14px;
  border-color: #e3e7eb;
  border-radius: 8px;
  background: #fafbfc;
}
.admin-account-request strong { color: #242c36; font-size: 14px; font-weight: 600; }
.admin-account-request small { color: #77818d; font-size: 12px; line-height: 1.55; }
.admin-request-purpose { margin: 0; color: #4f5966; font-size: 13px; line-height: 1.55; }
.admin-request-state { color: #66717e; font-size: 13px; }
.admin-request-actions { display: grid; gap: 8px; min-width: 0; }
.admin-approve-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.admin-approve-fields button { grid-column: 1 / -1; min-height: 38px; }
.admin-request-actions > button { min-height: 38px; }

.mail-template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.mail-template-editor { display: grid; align-content: start; gap: 14px; min-width: 0; }
.mail-template-editor + .mail-template-editor { padding-left: 24px; border-left: 1px solid #edf0f2; }
.mail-template-editor h3 { margin: 0; color: #202833; font-size: 15px; font-weight: 600; }
.mail-template-editor label { display: grid; gap: 7px; color: #65707d; font-size: 13px; font-weight: 500; }
.mail-template-editor textarea {
  width: 100%;
  min-height: 260px;
  padding: 12px;
  resize: vertical;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: #252d38;
  font: inherit;
  font-size: 14px;
  line-height: 1.65;
}
.mail-template-editor textarea:focus { outline: none; border-color: #d97b82; box-shadow: 0 0 0 3px rgba(195, 31, 43, 0.1); }
.mail-image-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mail-image-actions small { flex: 1 1 220px; color: #77818d; font-size: 12px; line-height: 1.55; }
.mail-template-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.mail-template-image { position: relative; min-width: 0; margin: 0; padding: 8px; border: 1px solid #e3e7eb; border-radius: 8px; background: #fafbfc; }
.mail-template-image img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 5px; background: #fff; }
.mail-template-image figcaption { margin-top: 6px; overflow: hidden; color: #65707d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.mail-template-image button { position: absolute; top: 4px; right: 4px; width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.94); }
.mail-attachment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 2px; border-top: 1px solid #edf0f2; }
.mail-attachment-actions small { flex: 1 1 220px; color: #77818d; font-size: 12px; line-height: 1.55; }
.mail-template-attachments { display: grid; gap: 8px; }
.mail-template-attachment { display: grid; grid-template-columns: 38px minmax(0, 1fr) 28px; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid #e3e7eb; border-radius: 8px; background: #fafbfc; }
.mail-template-attachment > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 6px; background: #f7e9ea; color: var(--red); font-size: 10px; font-weight: 750; }
.mail-template-attachment > div { display: grid; min-width: 0; gap: 3px; }
.mail-template-attachment strong { overflow: hidden; color: #303844; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mail-template-attachment small { color: #7a8490; font-size: 11px; }
.mail-template-attachment button { width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 50%; }
#mailTemplateStatus { min-height: 18px; }

.admin-assets-section { grid-column: 1 / -1; }
.admin-assets-head { align-items: end; margin-bottom: 2px; }
.admin-assets-head > b { color: #202833; font-size: 16px; font-weight: 600; }
.admin-assets-head label { min-width: 210px; }
.admin-generation-summary { gap: 10px; }
.admin-generation-summary span {
  padding: 12px 13px;
  border-color: #e3e7eb;
  border-radius: 8px;
  background: #fafbfc;
  color: #55606d;
  font-size: 13px;
  font-weight: 500;
}
.admin-generations { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; max-height: 500px; padding: 1px; }
.admin-generation { padding: 12px; border-color: #e1e5e9; border-radius: 8px; }
.admin-generation header strong { color: #27303a; font-size: 13px; font-weight: 600; }
.admin-generation header .job-status { border-radius: 999px; font-size: 12px; font-weight: 500; }
.admin-generation small { color: #77818d; font-size: 12px; }
.admin-generation video,
.admin-generation img { height: 170px; margin: 10px 0; border-radius: 7px; background: #1f252d; }
.admin-generation summary { color: #596574; font-size: 12px; font-weight: 500; }
.admin-generation pre { padding: 10px; border-radius: 7px; background: #f5f7f8; color: #4d5865; font-size: 12px; }
#adminStatus { min-height: 20px; margin: 14px 0 0; }

@media (max-width: 980px) {
  .admin-board,
  .admin-board-columns { grid-template-columns: 1fr; }
  .admin-assets-section { grid-column: auto; }
  .mail-template-grid { grid-template-columns: 1fr; }
  .mail-template-editor + .mail-template-editor { padding-top: 22px; padding-left: 0; border-top: 1px solid #edf0f2; border-left: 0; }
}
@media (max-width: 680px) {
  .admin-dialog .trusted-asset-form { padding: 20px 16px 28px; }
  .admin-mail-grid,
  .admin-approve-fields { grid-template-columns: 1fr; }
  .admin-approve-fields button { grid-column: auto; }
  .admin-generation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-assets-head { align-items: stretch; flex-direction: column; }
  .admin-assets-head label { min-width: 0; }
}

/* v9: one collapsible admin section per row, with stable single-field forms. */
.admin-board,
.admin-board-single { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.admin-board-columns { display: contents; }
.admin-board-column { display: contents; }
.admin-panel { width: 100%; min-width: 0; }
.admin-panel-content { min-width: 0; }
.admin-mail-grid,
.admin-ui-grid,
.admin-support-filters,
.admin-notification-audience { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.admin-mail-grid label,
.admin-ui-grid label,
.admin-support-filters label,
.admin-notification-audience label { width: 100%; min-width: 0; }
.admin-mail-grid input,
.admin-ui-grid input,
.admin-support-filters input,
.admin-notification-audience select { width: 100%; min-width: 0; }
.mail-template-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
.mail-template-editor + .mail-template-editor { padding-top: 24px; padding-left: 0; border-top: 1px solid #edf0f2; border-left: 0; }
.admin-account-request { grid-template-columns: minmax(0, 1fr); }
.admin-request-actions,
.admin-approve-fields { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; min-width: 0; gap: 10px; }
.admin-request-actions label,
.admin-approve-fields label { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 6px; color: #65707d; font-size: 12px; font-weight: 600; }
.admin-request-actions input,
.admin-approve-fields input { width: 100%; min-width: 0; max-width: 100%; }
.admin-approve-fields button { grid-column: auto; }
.admin-ui-logo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 16px; border-top: 1px solid #edf0f2; }
.admin-ui-logo img { display: block; width: min(260px, 100%); max-height: 100px; object-fit: contain; object-position: left center; }
#adminUiAccentColor { width: 100%; min-height: 42px; padding: 4px; }
.mail-template-images { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mail-template-image { padding: 9px; }
.mail-image-width { display: grid !important; gap: 5px !important; margin-top: 8px !important; color: #65707d !important; font-size: 11px !important; font-weight: 600 !important; }
.mail-image-width select { width: 100%; min-height: 34px; padding: 5px 8px; font-size: 12px; }

.unread-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 5px; border-radius: 999px; color: #fff; background: var(--red); font-size: 11px; font-weight: 700; }
.unread-badge[hidden] { display: none; }
.support-dialog { width: min(760px, calc(100vw - 28px)); }
.support-shell { display: grid; gap: 14px; max-height: min(88vh, 820px); overflow: hidden; }
.support-notice { margin: 0; padding: 12px 14px; border-left: 3px solid var(--red); background: var(--red-soft); color: #4f5966; font-size: 13px; line-height: 1.65; }
.support-history { display: grid; gap: 16px; min-height: 200px; max-height: 420px; overflow: auto; padding: 4px; }
.support-thread { display: grid; gap: 9px; }
.support-thread + .support-thread { padding-top: 14px; border-top: 1px solid var(--line); }
.support-thread-head { display: flex; justify-content: space-between; gap: 10px; color: #77818d; font-size: 12px; }
.support-message { width: min(82%, 560px); padding: 11px 13px; border: 1px solid #e2e6ea; border-radius: 8px; background: #f6f7f9; }
.support-message.is-own { justify-self: end; border-color: color-mix(in srgb, var(--red) 22%, #e2e6ea); background: var(--red-soft); }
.support-message.is-other { justify-self: start; }
.support-message header { display: flex; justify-content: space-between; gap: 12px; color: #697481; font-size: 11px; }
.support-message p { margin: 8px 0; color: #252d38; font-size: 14px; line-height: 1.6; }
.support-message > small { color: #7a8490; font-size: 11px; }
.support-message-images,
.notification-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 150px)); gap: 8px; margin-top: 8px; }
.support-message-images img,
.notification-images img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; object-fit: cover; background: #fff; }
.support-compose-label,
.admin-support-reply > label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.support-compose-label textarea,
.admin-support-reply textarea { width: 100%; resize: vertical; }
.support-compose-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.support-compose-actions small { flex: 1 1 180px; color: #77818d; }
.support-attachment-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 150px)); gap: 8px; }
.support-attachment-preview figure { position: relative; margin: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; }
.support-attachment-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.support-attachment-preview figcaption { overflow: hidden; margin-top: 5px; color: #687381; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.support-attachment-preview button { position: absolute; top: 3px; right: 3px; width: 26px; min-width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; }
.admin-support-layout { display: grid; grid-template-columns: minmax(240px, .75fr) minmax(0, 1.25fr); gap: 14px; min-height: 360px; }
.admin-support-list { display: grid; align-content: start; gap: 8px; max-height: 520px; overflow: auto; }
.admin-support-list-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; width: 100%; padding: 11px; text-align: left; }
.admin-support-list-item.active { border-color: var(--red); background: var(--red-soft); }
.admin-support-list-item > span { display: grid; gap: 2px; }
.admin-support-list-item > span:nth-child(2) { justify-items: end; }
.admin-support-list-item p { grid-column: 1 / -1; overflow: hidden; margin: 3px 0 0; color: #65707d; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-support-list-item b { display: inline-grid; place-items: center; min-width: 19px; height: 19px; border-radius: 999px; color: #fff; background: var(--red); font-size: 10px; }
.support-state { display: inline-flex; width: max-content; padding: 3px 7px; border-radius: 999px; color: #596472; background: #e9edf0; font-size: 11px; font-style: normal; }
.support-state.pending { color: #9c4c12; background: #fff0dc; }
.support-state.replied { color: #27704c; background: #e7f5ed; }
.admin-support-conversation { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.admin-support-conversation-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.admin-support-conversation-head small { display: block; margin-top: 3px; color: #77818d; }
.admin-support-messages { display: grid; gap: 9px; max-height: 450px; overflow: auto; }
.admin-support-reply { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }

.notification-dialog { width: min(820px, calc(100vw - 28px)); }
.notification-shell { display: grid; gap: 12px; max-height: 88vh; overflow: hidden; }
.notification-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notification-toolbar span { color: #687381; font-size: 13px; }
.notification-history { display: grid; align-content: start; gap: 10px; min-height: 240px; max-height: 620px; overflow: auto; }
.notification-item { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.notification-item.unread { border-left: 3px solid var(--red); }
.notification-item summary { display: flex; justify-content: space-between; gap: 14px; padding: 14px; cursor: pointer; }
.notification-item summary span { display: grid; gap: 5px; }
.notification-item summary i { width: max-content; color: var(--red); font-size: 11px; font-style: normal; }
.notification-item summary time { color: #77818d; font-size: 12px; }
.notification-content { padding: 0 14px 14px; border-top: 1px solid #edf0f2; color: #38424e; line-height: 1.65; }
.notification-content p { margin: 12px 0; }
.notification-content a { color: var(--red); }
.notification-content > small { display: block; margin-top: 14px; color: #7a8490; }
.admin-notification-editor { display: grid; gap: 12px; }
.admin-notification-editor > label { display: grid; gap: 6px; }
.notification-format-toolbar { display: flex; gap: 7px; }
.notification-format-toolbar button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.admin-notification-preview { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.admin-notification-preview > small { color: var(--red); }
.admin-notification-preview h3 { margin: 6px 0 14px; }
.admin-notification-preview p { margin: 9px 0; line-height: 1.65; }
.admin-notification-list { display: grid; gap: 10px; }
.admin-notification-record { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.admin-notification-record header { display: flex; justify-content: space-between; gap: 12px; }
.admin-notification-record header > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-notification-record header time,
.admin-notification-record > small { color: #77818d; font-size: 12px; }
.admin-notification-record p { margin: 0; color: #586472; font-size: 13px; }
.admin-notification-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.admin-notification-metrics span { padding: 8px; border-radius: 6px; background: #fff; color: #596472; font-size: 12px; }
.notification-state { padding: 3px 7px; border-radius: 999px; color: #5e6975; background: #e9edf0; font-size: 11px; font-style: normal; }
.notification-state.succeeded { color: #27704c; background: #e7f5ed; }
.notification-state.failed,
.notification-state.partial_failed { color: #a23b43; background: #fbe9eb; }
.notification-state.scheduled,
.notification-state.pending,
.notification-state.sending { color: #9c4c12; background: #fff0dc; }

@media (max-width: 760px) {
  .admin-support-layout { grid-template-columns: minmax(0, 1fr); }
  .support-message { width: 94%; }
  .admin-notification-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notification-item summary { flex-direction: column; }
  .status { gap: 5px; }
  .status .task-entry { padding-inline: 8px; font-size: 12px; }
}

/* Login and account request: preserve the existing form fields and handlers. */
body.login-required { overflow: hidden; background: #f5f6f7; }
#loginDialog {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  opacity: 0;
  transition: opacity 360ms cubic-bezier(.22, 1, .36, 1);
}
#loginDialog.login-ready { opacity: 1; }
#loginDialog::backdrop { background: #f5f6f7; opacity: 0; transition: opacity 360ms cubic-bezier(.22, 1, .36, 1); }
#loginDialog.login-ready::backdrop { opacity: 1; }
#loginDialog .trusted-asset-form {
  display: grid;
  grid-template-columns: minmax(360px, 44%) minmax(0, 56%);
  width: 100%;
  min-height: 100%;
  padding: 0;
}
#loginDialog .login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 44px;
  min-height: 100vh;
  padding: clamp(36px, 6vw, 96px);
  overflow: hidden;
  border-right: 1px solid #e3e6e9;
  background: #f5f6f7;
}
#loginDialog .login-brand::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--red);
}
#loginDialog .login-brand::after {
  content: "";
  position: absolute;
  right: -52px;
  bottom: -52px;
  width: 210px;
  height: 210px;
  border: 1px solid #d9dde1;
  border-radius: 50%;
}
#loginDialog .login-brand img {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 430px);
  height: auto;
  max-height: 150px;
  object-fit: contain;
  object-position: left center;
}
#loginDialog .login-brand > div { position: relative; z-index: 1; }
#loginDialog .login-brand small { color: #6f7884; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; }
#loginDialog .login-brand p { margin: 9px 0 0; color: #303943; font-size: 18px; font-weight: 500; }
#loginDialog .login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 36px 24px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 440ms 80ms cubic-bezier(.22, 1, .36, 1), transform 440ms 80ms cubic-bezier(.22, 1, .36, 1);
}
#loginDialog.login-ready .login-panel { opacity: 1; transform: translateY(0); }
#loginDialog .dialog-head { display: block; margin: 0 0 18px; }
#loginDialog .dialog-head h2 { margin: 0; color: #202833; font-size: 30px; font-weight: 600; line-height: 1.25; }
#loginDialog .dialog-head p { margin: 8px 0 0; color: #77818d; font-size: 14px; font-weight: 400; }
#loginDialog #loginHint {
  min-height: 20px;
  margin: 0 0 20px;
  color: #6f7884;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}
#loginDialog .trusted-asset-form label { gap: 7px; margin-top: 16px; color: #4b5563; font-size: 13px; font-weight: 500; }
#loginDialog .trusted-asset-form input { min-height: 44px; border-color: #dce1e6; border-radius: 8px; font-size: 14px; }
#loginDialog .trusted-asset-form input:hover { border-color: #c7ced6; }
#loginDialog .trusted-asset-form input:focus { border-color: #d57980; box-shadow: var(--focus-ring); }
#loginDialog #loginSubmitBtn { width: 100%; min-height: 44px; margin-top: 24px; border-radius: 8px; font-weight: 600; }
#loginDialog #loginSubmitBtn:disabled { opacity: 0.62; }
#loginDialog .login-request-copy { margin: 16px 0 0; color: #77818d; font-size: 13px; text-align: center; }
#loginDialog #accountRequestBtn {
  display: inline;
  width: auto;
  min-height: 0;
  margin: 0 0 0 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
#loginDialog #accountRequestBtn:hover { color: var(--red); background: transparent; }

#accountRequestDialog { width: min(560px, calc(100vw - 32px)); border-color: transparent; border-radius: 12px; }
#accountRequestDialog::backdrop { background: rgba(18, 23, 29, 0.5); }
#accountRequestDialog .trusted-asset-form { padding: 26px 28px 24px; }
#accountRequestDialog .dialog-head { margin-bottom: 8px; }
#accountRequestDialog .dialog-head small { color: var(--red); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; }
#accountRequestDialog .dialog-head h2 { margin-top: 5px; color: #202833; font-size: 24px; font-weight: 600; }
#accountRequestDialog .dialog-close { width: 34px; min-width: 34px; height: 34px; padding: 0; border-radius: 8px; color: #5f6b78; background: #fff; border-color: #e0e4e8; }
#accountRequestDialog > form > .muted { margin: 0 0 18px; color: #77818d; font-size: 13px; font-weight: 400; line-height: 1.55; }
#accountRequestDialog .trusted-asset-form label { gap: 7px; margin-top: 15px; color: #4b5563; font-size: 13px; font-weight: 500; }
#accountRequestDialog input,
#accountRequestDialog textarea { border-color: #dce1e6; border-radius: 8px; font-size: 14px; }
#accountRequestDialog input { min-height: 42px; }
#accountRequestDialog textarea { min-height: 132px; max-height: 150px; resize: vertical; }
#accountRequestDialog input:focus,
#accountRequestDialog textarea:focus { border-color: #d57980; box-shadow: var(--focus-ring); }
#accountRequestDialog .field-error { display: block; margin: 5px 0 -2px; color: #b4232d; font-size: 12px; line-height: 1.4; }
#accountRequestDialog .dialog-actions { margin-top: 22px; }
#accountRequestDialog .dialog-actions button { min-height: 40px; border-radius: 8px; }
#accountRequestDialog .dialog-actions .primary { min-width: 132px; }
#accountRequestDialog #accountRequestSubmitBtn:disabled {
  border-color: #e3e6e9;
  background: #e9ecef;
  color: #9aa3ad;
  cursor: not-allowed;
  opacity: 1;
}
#accountRequestDialog #accountRequestStatus { min-height: 19px; margin: 12px 0 0; color: #6f7884; font-size: 12px; }

@media (max-width: 760px) {
  body.login-required { overflow: auto; }
  #loginDialog { position: static; width: 100%; height: auto; min-height: 100vh; }
  #loginDialog .trusted-asset-form { grid-template-columns: 1fr; }
  #loginDialog .login-brand { min-height: 230px; gap: 20px; padding: 32px 28px; border-right: 0; border-bottom: 1px solid #e3e6e9; }
  #loginDialog .login-brand img { width: min(100%, 300px); max-height: 96px; }
  #loginDialog .login-brand p { font-size: 15px; }
  #loginDialog .login-panel { padding: 36px 28px 44px; }
}

/* Header task shortcuts and video asset actions keep a shared button box model. */
.task-entry { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 8px; }
.task-entry span { color: var(--red-dark); font-variant-numeric: tabular-nums; }
.video-asset-actions .download-link,
.video-asset-preview-actions .download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}
.video-asset-actions button,
.video-asset-actions .download-link,
.video-asset-preview-actions button,
.video-asset-preview-actions .download-link {
  box-sizing: border-box;
  margin-top: 0;
}

.hidden-file {
  display: none;
}

.empty-icon, .spark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #e8c5c3;
  border-radius: 8px;
  color: var(--red);
  background: var(--surface-soft);
  font-size: 24px;
}

.spark {
  margin: 10px auto 14px;
  color: var(--green);
}

.output-video {
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  max-height: none;
  object-fit: contain;
  border-radius: 5px;
  background: #1b1211;
}

.result-label {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.output-reference-strip {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.output-reference-strip > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.output-reference-strip > div {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.output-reference-strip figure {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 58px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-soft);
}

.output-reference-strip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.output-reference-strip figcaption {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 1px 3px;
  border-radius: 2px;
  color: #fff;
  background: rgba(31, 35, 41, 0.78);
  font-size: 10px;
  line-height: 1.2;
}

.result-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.download-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.panel {
  display: grid;
  gap: 16px;
}

.box {
  padding: 16px;
}

.section-title {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

label {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 16px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fdfefe;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: #df6c73;
  box-shadow: 0 0 0 3px rgba(201, 36, 45, 0.10);
}

input:disabled {
  color: var(--muted);
  background: #f1f3f5;
}

textarea {
  min-height: 210px;
  resize: vertical;
  line-height: 1.55;
}

#prompt {
  min-height: 420px;
}

.prompt-guide {
  display: grid;
  gap: 6px;
  margin: -4px 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  border-radius: 0 6px 6px 0;
  background: var(--red-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.short-textarea {
  min-height: 96px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary {
  width: 100%;
  margin-top: 10px;
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 2px 0 var(--red-dark), 0 7px 14px rgba(189, 32, 40, 0.18);
}

.primary:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
  color: #fff;
  box-shadow: 0 3px 0 #731018, 0 10px 18px rgba(189, 32, 40, 0.24);
}

.primary:active:not(:disabled) {
  box-shadow: 0 1px 0 #731018, 0 4px 8px rgba(201, 36, 45, 0.18);
}

.compact {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

pre {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #30343a;
  font-size: 12px;
  line-height: 1.55;
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.task-queue {
  display: grid;
  gap: 8px;
}

.job-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafbfc;
}

/* Stable tactile states for every command without changing control geometry. */
button {
  touch-action: manipulation;
  will-change: transform;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.96);
}

button.primary:not(:disabled),
#generateBtn:not(:disabled),
#pageImagePlanBtn:not(:disabled),
#accountRequestSubmitBtn:not(:disabled) {
  box-shadow: 0 2px 0 var(--red-dark), 0 7px 14px rgba(189, 32, 40, 0.18);
}

button[aria-busy="true"] {
  cursor: progress;
  transform: none;
  filter: saturate(0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

button:disabled:not([aria-busy="true"]) {
  transform: none;
  filter: grayscale(0.08);
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  button:hover:not(:disabled), button:active:not(:disabled) { transform: none; }
}

/* v15 first-login agreement */
.agreement-dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: min(900px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #20262f;
  background: #fff;
  box-shadow: 0 24px 70px rgba(23, 30, 40, .28);
}

.agreement-dialog::backdrop { background: rgba(16, 20, 26, .66); backdrop-filter: blur(5px); }

.agreement-form {
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto;
  max-height: min(900px, calc(100vh - 32px));
}

.agreement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid #e4e7eb;
}

.agreement-head small { color: var(--red); font-size: 11px; font-weight: 750; }
.agreement-head h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: 0; }
.agreement-version { flex: 0 0 auto; padding: 5px 8px; border-radius: 5px; color: #68717e; background: #f2f4f6; font-size: 12px; }
.agreement-intro { margin: 0; padding: 16px 28px 4px; color: #505966; line-height: 1.7; }

.agreement-clauses {
  min-height: 0;
  margin: 12px 28px 0;
  padding: 18px 24px 18px 46px;
  overflow: auto;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  background: #fafbfc;
  overscroll-behavior: contain;
}

.agreement-clauses li { padding-left: 6px; color: #303844; line-height: 1.75; }
.agreement-clauses strong { color: #202833; font-weight: 750; }
.agreement-clauses li + li { margin-top: 12px; }
.agreement-clauses li::marker { color: var(--red); font-weight: 750; }

.agreement-signature {
  display: grid;
  grid-template-columns: minmax(220px, .55fr) minmax(0, 1.45fr) auto;
  align-items: end;
  gap: 12px 18px;
  padding: 18px 28px 22px;
  border-top: 1px solid #e4e7eb;
  background: #fff;
}

.agreement-storage-note { grid-column: 1 / -1; margin: 0; color: #69727e; font-size: 12px; line-height: 1.55; }
.agreement-signature > label:first-of-type { display: grid; gap: 6px; color: #4d5661; font-size: 12px; font-weight: 650; }
.agreement-signature input[type="text"], .agreement-signature input:not([type]) { min-height: 42px; }
.agreement-confirm { display: flex; align-items: flex-start; gap: 9px; min-width: 0; color: #353d48; font-size: 13px; line-height: 1.55; }
.agreement-confirm input { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 2px; accent-color: var(--red); }
.agreement-confirm strong { color: #252b33; font-weight: 700; }
.agreement-signature button { min-width: 138px; min-height: 42px; }
.agreement-signature > button { grid-column: 3; grid-row: 2; }
.agreement-status { grid-column: 1 / -1; margin: -4px 0 0; color: var(--red); }

@media (max-width: 720px) {
  .agreement-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .agreement-form { max-height: calc(100vh - 16px); }
  .agreement-head { padding: 18px 18px 14px; }
  .agreement-head h2 { font-size: 20px; }
  .agreement-version { display: none; }
  .agreement-intro { padding: 13px 18px 0; font-size: 13px; }
  .agreement-clauses { margin: 10px 18px 0; padding: 15px 16px 15px 38px; font-size: 13px; }
  .agreement-signature { grid-template-columns: 1fr; gap: 12px; padding: 15px 18px 18px; }
  .agreement-storage-note, .agreement-status { grid-column: auto; }
  .agreement-signature > button { grid-column: auto; grid-row: auto; width: 100%; }
}

.job-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.job-status {
  color: var(--red-dark);
}

.job-status.done {
  color: var(--green);
}

.job-status.failed {
  color: var(--red-dark);
}

.job-detail {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.job-refresh {
  height: 30px;
  margin-top: 9px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.job-refresh:hover { border-color: #b8bec8; background: #f4f5f7; }
.job-refresh:disabled { color: var(--muted); cursor: wait; }

code {
  color: var(--red);
}

.image-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 350px);
  align-items: start;
  gap: 0;
  margin-top: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.project-switcher {
  display: grid;
  grid-template-columns: minmax(160px, 0.52fr) minmax(0, 1.48fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.project-switcher .canvas-tabs {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.image-project-switcher {
  min-height: 72px;
  padding: 10px 0;
}

.image-main-panel {
  min-width: 0;
  padding: 28px 32px 40px;
  border-right: 1px solid var(--line);
}

.image-settings-panel {
  position: sticky;
  top: 0;
  min-width: 0;
  padding: 28px 24px 24px;
}

.image-prompt-section,
.image-reference-panel,
.image-result-section {
  padding-bottom: 28px;
}

.image-reference-panel,
.image-result-section {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.image-section-heading,
.image-reference-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.image-section-heading h2,
.image-reference-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.image-section-heading p,
.image-reference-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.image-reference-heading h2 span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.image-prompt-toolbar {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(190px, 1.25fr) auto;
  align-items: end;
  gap: 10px;
  margin: 20px 0 12px;
}

.image-prompt-toolbar label,
.image-controls-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.image-prompt-toolbar button {
  height: 40px;
  white-space: nowrap;
}

.image-prompt-editor {
  display: block;
  width: 100%;
  min-height: 300px;
  height: 320px;
  max-height: 320px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  overflow-y: auto;
  resize: none;
}

.image-reference-heading .secondary-button {
  flex: 0 0 auto;
  min-height: 40px;
  white-space: nowrap;
}
.image-reference-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.library-picker-dialog { width: min(920px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 24px 64px rgba(31, 35, 41, .22); }
.library-picker-dialog::backdrop { background: rgba(25, 29, 34, .48); }
.library-picker-shell { display: grid; grid-template-rows: auto auto minmax(180px, 1fr) auto; max-height: min(760px, calc(100vh - 32px)); padding: 22px; }
.library-picker-shell .dialog-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.library-picker-toolbar { display: flex; align-items: center; gap: 14px; margin: 18px 0 14px; }
.library-picker-toolbar input { flex: 1 1 auto; min-width: 0; }
.library-picker-toolbar span { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.library-picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; overflow: auto; padding: 2px 2px 16px; align-content: start; }
.library-picker-card { position: relative; display: grid; grid-template-rows: auto auto; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); text-align: left; }
.library-picker-card:hover { border-color: #bbc2ca; background: #fff; }
.library-picker-card.selected { border-color: var(--red); box-shadow: 0 0 0 2px rgba(189, 32, 40, .1); }
.library-picker-card .asset-media-preview { aspect-ratio: 4 / 3; border-radius: 0; pointer-events: none; }
.library-picker-check { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; color: transparent; background: rgba(32,40,51,.46); font-size: 13px; }
.library-picker-card.selected .library-picker-check { color: #fff; background: var(--red); }
.library-picker-copy { display: grid; gap: 4px; min-width: 0; padding: 10px; }
.library-picker-copy strong, .library-picker-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-picker-copy strong { font-size: 13px; }
.library-picker-copy small { color: var(--muted); font-size: 11px; font-weight: 500; }
.library-picker-empty { display: grid; place-content: center; justify-items: center; gap: 7px; min-height: 220px; color: var(--muted); }
.library-picker-empty strong { color: var(--text); }
.library-picker-shell > .dialog-actions { padding-top: 16px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .library-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-picker-shell { padding: 18px; }
  .image-reference-actions { width: 100%; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .app-launch, .workspace-entry, #loginDialog, #loginDialog::backdrop, #loginDialog .login-panel { transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .launch-progress i { animation: none; width: 100%; }
}

.image-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.image-reference-grid .image-reference-item {
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.image-reference-grid .image-reference-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-reference-grid .image-reference-item span {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(34, 35, 38, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1.25;
}

.image-reference-grid .image-reference-item em {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(238, 248, 241, 0.96);
  color: #286b49;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.25;
}

.trusted-image-reference {
  border-color: #acd3ba !important;
}

.image-reference-grid .image-reference-item button {
  opacity: 0;
  transition: opacity 120ms ease;
}

.image-reference-grid .image-reference-item:hover button,
.image-reference-grid .image-reference-item:focus-within button {
  opacity: 1;
}

.image-reference-empty {
  grid-column: 1 / -1;
  padding: 14px 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.image-trusted-upload {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.image-reference-drop-area {
  padding: 2px 0;
}

.image-trusted-upload .trusted-upload-button {
  width: auto;
  min-height: 40px;
  margin: 0;
}

.image-trusted-upload p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.image-result-section {
  min-height: 120px;
}

.image-settings-group {
  margin-top: 22px;
}

.image-settings-group h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.image-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.image-basic-controls label:first-child {
  grid-column: 1 / -1;
}

.image-advanced-settings {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.image-advanced-settings summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  list-style-position: inside;
}

.image-advanced-settings[open] summary {
  margin-bottom: 16px;
}

.image-generate-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.image-generate-footer p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.image-generate-footer .primary {
  width: 100%;
  min-height: 44px;
}

.image-check {
  display: flex !important;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  margin: 0;
}

.image-check input {
  width: auto;
}

.image-parameter-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

.image-actions .primary {
  min-height: 43px;
  margin: 12px 0;
}

.image-plan-result {
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.trusted-asset-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 7px;
  margin-top: 10px;
}

.trusted-asset-entry input {
  min-width: 0;
}

.trusted-asset-entry button {
  min-width: 34px;
  padding: 0;
  font-size: 20px;
}

.trusted-asset-help {
  margin-top: 6px !important;
  font-size: 12px !important;
}

.trusted-asset-thumb {
  overflow: visible;
  border: 1px solid #9acdb3;
  border-radius: 6px;
  background: #f1faf5;
}

.trusted-placeholder {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #256d4d;
  background: #e7f5ed;
  font-size: 12px;
  font-weight: 900;
}

.trusted-state {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #1e6848;
  background: rgba(241, 250, 245, 0.94);
  font-size: 10px;
  font-weight: 900;
}

.asset-thumb { position: relative; }
.reference-index {
  position: absolute;
  left: 4px;
  top: 4px;
  min-width: 28px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(34, 27, 25, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

.generated-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.generated-image-grid a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.generated-image-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.video-assets-hero {
  padding-bottom: 16px;
}

.video-assets-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.video-assets-toolbar > span {
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.video-assets-toolbar .date-filter {
  margin: 0;
}

.video-asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 0 36px;
}

.video-asset-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

.video-asset-card:hover {
  border-color: #c5cbd3;
  background: #fff;
}

.video-asset-cover {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #22272d;
  color: #fff;
}

.video-asset-cover:hover {
  border: 0;
  background: #22272d;
}

.video-asset-cover-image,
.video-asset-cover-placeholder {
  position: absolute;
  inset: 0;
}

.video-asset-cover-image {
  background-position: center;
  background-size: cover;
}

.video-asset-cover-placeholder {
  display: grid;
  place-items: center;
  background: #303840;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.video-asset-play {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  padding-left: 2px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(18, 22, 27, 0.68);
  color: #fff;
  font-size: 15px;
}

.video-asset-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 10px;
}

.video-asset-info > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.video-asset-info strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-asset-info > div > span {
  color: var(--muted);
  font-size: 12px;
}

.asset-status-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f2f3f5;
  color: #68717d;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.asset-status-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.asset-status-badge.done { background: #edf8f1; color: #2d8057; }
.asset-status-badge.failed { background: #fff0f0; color: #b13b42; }
.asset-status-badge.processing { background: #f2f3f5; color: #6d7480; }

.video-asset-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 12px;
}

.video-asset-actions button,
.video-asset-actions .download-link {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #d9dde3;
  border-radius: 6px;
  background: #fff;
  color: #3e4651;
  font-size: 12px;
  line-height: 20px;
  text-decoration: none;
}

.video-asset-actions .download-link:hover,
.video-asset-actions button:hover {
  border-color: #b9c0c9;
  background: #fafafa;
}

.video-asset-actions .video-asset-more {
  width: 32px;
  margin-left: auto;
  padding: 0;
  font-weight: 700;
  letter-spacing: 1px;
}

.video-asset-error {
  margin: -4px 12px 12px;
  color: #a34146;
  font-size: 12px;
  line-height: 1.45;
}

.video-assets-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.video-assets-empty strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.video-assets-empty span { font-size: 13px; }

.video-asset-preview-dialog {
  width: min(1040px, calc(100vw - 48px));
  max-height: min(900px, calc(100vh - 48px));
  padding: 0;
  overflow: auto;
  background: var(--surface);
}

.video-asset-preview-content {
  padding: 24px;
}

.video-asset-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.video-asset-preview-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.video-asset-preview-head p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.video-asset-preview-player {
  overflow: hidden;
  border-radius: 8px;
  background: #20252b;
}

.video-asset-preview-player .lazy-video-shell,
.video-asset-preview-player .lazy-video-start,
.video-asset-preview-player .video-asset-preview-video {
  width: 100%;
  max-width: none;
}

.video-asset-preview-player .lazy-video-start,
.video-asset-preview-player .video-asset-preview-video {
  min-height: 0;
  max-height: none;
  aspect-ratio: 16 / 9;
}

.video-asset-preview-player .lazy-video-start img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.video-asset-load-error {
  display: grid;
  min-height: 420px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.video-asset-load-error strong { color: #fff; font-size: 16px; font-weight: 600; }
.video-asset-load-error span { max-width: 560px; font-size: 13px; line-height: 1.55; }

.video-asset-preview-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
}

.video-asset-preview-actions .download-link {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid #d9dde3;
  border-radius: 7px;
  color: #3e4651;
  font-size: 13px;
  line-height: 20px;
  text-decoration: none;
}

.video-asset-preview-actions button {
  min-height: 40px;
}

.video-asset-generation-record {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.video-asset-generation-record .generation-record {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

@media (min-width: 1500px) {
  .video-asset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .video-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .video-assets-toolbar { align-items: flex-start; flex-direction: column; }
  .video-asset-grid { grid-template-columns: 1fr; }
  .video-asset-preview-dialog { width: min(100vw - 24px, 1040px); }
  .video-asset-preview-content { padding: 18px; }
}

.media-assets-hero,
.media-library-hero {
  padding-bottom: 16px;
}

.media-assets-toolbar,
.media-library-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.media-assets-toolbar {
  justify-content: space-between;
}

.media-assets-toolbar > span,
.media-library-toolbar > span {
  margin-left: auto;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.media-assets-toolbar .date-filter {
  margin: 0;
}

.media-library-toolbar input {
  flex: 1 1 320px;
  min-width: 220px;
}

.media-library-toolbar select {
  width: 132px;
}

.media-library-toolbar .top-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

.media-asset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding: 20px 0 36px;
}

.media-asset-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

.media-asset-card:hover,
.media-asset-card:focus-within {
  border-color: #c5cbd3;
}

.asset-media-preview {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f4f5f7;
  color: #66707c;
}

button.asset-media-preview:hover {
  border: 0;
  background: #f4f5f7;
}

.asset-media-preview.image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-media-preview.video {
  background: #303840;
  color: #fff;
}

.asset-media-preview.audio {
  background: #f1f3f5;
}

.asset-media-poster {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}

.asset-media-symbol {
  position: relative;
  z-index: 1;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: rgba(35, 41, 47, 0.2);
  font-size: 15px;
}

.asset-media-preview.audio .asset-media-symbol {
  border: 0;
  border-radius: 8px;
  background: #e2e6ea;
  color: #4e5966;
  font-size: 19px;
}

.asset-media-label {
  position: absolute;
  left: 10px;
  bottom: 9px;
  color: inherit;
  font-size: 11px;
  font-weight: 500;
}

.asset-preview-fallback {
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 12px;
  color: #7b838e;
  font-size: 12px;
  text-align: center;
}

.asset-preview-fallback small {
  color: #969da6;
  font-size: 11px;
}

.media-asset-info {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 11px 12px;
}

.media-asset-info strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-asset-info > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-asset-hover {
  position: absolute;
  inset: auto 8px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid #d9dde3;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.media-asset-card:hover .media-asset-hover,
.media-asset-card:focus-within .media-asset-hover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.media-asset-hover button {
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #444c56;
  font-size: 12px;
}

.media-asset-hover button:hover { background: #f0f2f4; }

.media-asset-hover .asset-status-badge {
  margin-right: auto;
}

.media-asset-hover .media-asset-more,
.media-asset-hover .media-asset-remove {
  width: 28px;
  padding: 0;
  font-weight: 700;
}

.media-asset-hover .media-asset-remove { color: #ad3d43; font-size: 18px; }

.media-asset-tags {
  display: flex;
  gap: 4px;
  min-width: 0;
}

.media-asset-tags i {
  overflow: hidden;
  max-width: 82px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #f1f3f5;
  color: #68717d;
  font-size: 10px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-assets-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.media-assets-empty strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.media-assets-empty span { font-size: 13px; }

.asset-preview-dialog {
  width: min(900px, calc(100vw - 48px));
  max-height: min(900px, calc(100vh - 48px));
  padding: 0;
  overflow: auto;
  background: var(--surface);
}

.asset-preview-dialog-content {
  padding: 24px;
}

.asset-preview-dialog-content > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.asset-preview-dialog-content h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.asset-preview-dialog-content header p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.asset-modal-media {
  display: grid;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f4f5f7;
}

.asset-modal-media.image img {
  display: block;
  max-width: 100%;
  max-height: min(620px, 60vh);
  object-fit: contain;
}

.asset-modal-media.video {
  background: #20252b;
}

.asset-modal-media .lazy-video-shell,
.asset-modal-media .lazy-video-start,
.asset-modal-media .asset-modal-video {
  width: 100%;
  max-width: none;
}

.asset-modal-media .lazy-video-start,
.asset-modal-media .asset-modal-video {
  min-height: 0;
  max-height: none;
  aspect-ratio: 16 / 9;
}

.asset-modal-media .lazy-video-start img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.asset-modal-media.audio audio { width: min(520px, calc(100% - 40px)); }

.asset-modal-error {
  display: grid;
  place-content: center;
  gap: 6px;
  min-height: 220px;
  padding: 24px;
  color: #737d88;
  font-size: 13px;
  text-align: center;
}

.asset-modal-error strong { color: #4f5964; font-size: 15px; font-weight: 600; }

.asset-modal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
  margin: 18px 0 0;
}

.asset-modal-meta div { min-width: 0; }
.asset-modal-meta dt { color: var(--muted); font-size: 11px; }
.asset-modal-meta dd { overflow: hidden; margin: 3px 0 0; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.asset-modal-generation-record {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.asset-modal-generation-record .generation-record { margin-top: 0; padding-top: 0; border-top: 0; }

@media (min-width: 1540px) {
  .media-asset-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .media-asset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .media-asset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .media-library-toolbar { flex-wrap: wrap; }
  .media-library-toolbar > span { margin-left: 0; }
}

@media (max-width: 640px) {
  .media-assets-toolbar { align-items: flex-start; flex-direction: column; }
  .media-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-library-toolbar input { flex-basis: 100%; }
  .asset-preview-dialog { width: min(100vw - 24px, 900px); }
  .asset-preview-dialog-content { padding: 18px; }
  .asset-modal-media { min-height: 220px; }
}

@media (max-width: 1120px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 14px 18px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 12px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 8px;
    overflow-x: auto;
  }

  .nav {
    margin-bottom: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .connection-panel {
    position: static;
  }

  .canvas { min-height: 2300px; }

  .flow-direction-node {
    width: calc(100% - 42px);
    left: 21px;
    top: 720px;
    grid-template-columns: 1fr;
  }

  .flow-direction-node > .box,
  .flow-direction-node > .box:nth-of-type(2),
  .flow-direction-node > .box:last-child { grid-column: 1; grid-row: auto; }

  .image-node { left: 21px; top: 50px; }
  .output-node { left: 328px; top: 50px; width: calc(100% - 350px); }
  .audio-node { left: 21px; top: 410px; }
  .video-node { left: 21px; top: 588px; }

  .topbar {
    padding: 18px;
    display: grid;
    gap: 14px;
  }

  .canvas-switcher {
    grid-template-columns: 1fr auto;
    padding: 14px 18px;
  }

  .canvas-switcher-copy {
    display: none;
  }

  .page-view {
    padding: 18px;
  }

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

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

@media (max-width: 680px) {
  .canvas { min-height: 2500px; }
  .output-node { left: 21px; top: 50px; width: calc(100% - 42px); min-width: 0; min-height: 370px; }
  .output-node #outputPreview { min-height: 300px; }
  .image-node { left: 21px; top: 450px; }
  .audio-node { left: 21px; top: 810px; }
  .video-node { left: 21px; top: 990px; }
  .flow-direction-node { left: 21px; top: 1220px; width: calc(100% - 42px); }

  .sidebar-nav {
    grid-template-columns: repeat(4, 132px);
  }

  .canvas-switcher {
    grid-template-columns: 1fr;
  }

  .canvas-tabs {
    grid-template-columns: repeat(3, minmax(112px, 1fr));
    overflow-x: auto;
  }

  .canvas-switcher .top-action {
    width: 100%;
  }

  .image-actions {
    grid-template-columns: 1fr;
  }

  .image-controls-grid {
    grid-template-columns: 1fr;
  }

  .project-switcher {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .project-switcher .canvas-tabs {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .library-upload-box {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Video generation page: the prompt column follows the full page row height. */
.workspace { align-items: stretch; }
.creative-panel { align-self: stretch; height: 100%; }
#creativePromptPane { min-height: 0; }
#creativePromptPane #prompt { min-height: 0; height: 100%; }

/* v10 final cascade. */
.admin-panel-content > label,
.admin-subsection > label,
.admin-mail-grid,
.admin-ui-grid,
.admin-ui-logo,
.admin-prompt-create,
.mail-template-editor,
.admin-notification-editor { width: min(100%, 820px); }
.admin-mail-grid label,
.admin-ui-grid label,
.admin-notification-audience label { max-width: 680px; }
.admin-service-actions { max-width: 820px; }
.admin-service-actions button { flex: 0 1 auto; min-width: 150px; }
.admin-account { grid-template-columns: minmax(220px, 1fr) auto; }
.status .task-entry,
.status .prompt-request-entry {
  width: 108px;
  min-width: 108px;
  height: 36px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
  color: #444b55;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
}
.status .task-entry:hover,
.status .prompt-request-entry:hover { border-color: #bfc6ce; color: #252d38; background: #f6f7f9; }
.status .task-entry > span:not(.unread-badge) { color: #56606c; background: #eceff2; }
.status .unread-badge { color: #fff; background: var(--red); }

@media (max-width: 680px) {
  .admin-account { grid-template-columns: minmax(0, 1fr); }
  .status .task-entry,
  .status .prompt-request-entry { width: 104px; min-width: 104px; }
}

/* v11 home: the existing navigation and workspaces stay intact. */
.page-view.home-page-view {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 64px);
  padding: 0 32px;
  overflow-x: clip;
  background: #fbfbfa;
}

.home-page {
  width: 100%;
  min-height: calc(100vh - 64px);
}

.home-hero {
  width: min(100%, 1180px);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 72px 0 54px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.home-greeting {
  margin: 0 0 14px;
  color: #7a8088;
  font-size: 14px;
  line-height: 1.5;
}

.home-hero > h2 {
  max-width: 900px;
  margin: 0;
  color: #20242a;
  font-size: 54px;
  font-weight: 560;
  line-height: 1.16;
  letter-spacing: 0;
}

.home-composer {
  width: min(74%, 900px);
  min-width: 660px;
  min-height: 180px;
  margin-top: 34px;
  padding: 18px 18px 14px;
  display: grid;
  grid-template-rows: minmax(82px, 1fr) auto auto;
  gap: 10px;
  border: 1px solid #d9dde2;
  border-radius: 8px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.home-composer:focus-within {
  border-color: #b9bec5;
  box-shadow: 0 0 0 3px rgba(189, 32, 40, 0.07);
}

.home-composer.material-drop-target {
  border-color: var(--red);
  background: #fffafa;
}

.home-composer textarea {
  width: 100%;
  min-height: 82px;
  padding: 2px;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #252a31;
  font-size: 17px;
  line-height: 1.65;
  box-shadow: none;
}

.home-composer textarea:focus {
  border: 0;
  box-shadow: none;
}

.home-composer textarea::placeholder { color: #9a9fa7; }

.home-material-summary {
  color: #7a8088;
  font-size: 12px;
  line-height: 1.4;
}

.home-composer-footer {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-material-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.home-material-actions > span {
  margin-right: 3px;
  color: #555d67;
  font-size: 13px;
  font-weight: 600;
}

.home-material-actions button {
  min-width: 52px;
  min-height: 32px;
  height: 32px;
  padding: 5px 10px;
  border-color: #e0e3e7;
  background: #fff;
  color: #555d67;
  font-size: 12px;
}

.home-material-actions button:hover { border-color: #c5cad0; background: #f6f7f8; color: #242a31; }

.home-start-button {
  flex: 0 0 auto;
  width: 116px;
  min-height: 38px;
  height: 38px;
  padding: 7px 16px;
}

.home-quick-heading {
  width: min(74%, 900px);
  min-width: 660px;
  margin-top: 34px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.home-quick-heading strong { font-size: 14px; font-weight: 650; }
.home-quick-heading span { color: #90959d; font-size: 12px; }

.home-quick-links {
  width: min(74%, 900px);
  min-width: 660px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.home-quick-links button {
  min-height: 38px;
  padding: 7px 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #424951;
  font-size: 13px;
}

.home-quick-links button:hover { background: transparent; color: var(--red-dark); }
.home-quick-links button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.home-quick-links i { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #dde1e5; border-radius: 6px; color: #6a717a; font-size: 11px; font-style: normal; }
.home-quick-links button:hover i { border-color: #d8b3b6; color: var(--red-dark); }

@media (max-width: 1280px) {
  .status .task-entry,
  .status .prompt-request-entry {
    width: 86px;
    min-width: 86px;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 11px;
  }
  .home-hero { padding-top: 58px; }
  .home-hero > h2 { font-size: 48px; }
}

@media (max-width: 980px) {
  .home-composer,
  .home-quick-heading,
  .home-quick-links { width: 88%; min-width: 0; }
  .home-hero > h2 { font-size: 44px; }
}

@media (max-width: 900px) {
  .page-view.home-page-view { padding-right: 22px; padding-left: 22px; }
  .home-hero { padding-top: 48px; }
  .topbar { height: auto; min-height: 64px; gap: 14px; }
  .topbar .status { min-width: 0; overflow-x: auto; padding: 6px 0; }
}

@media (max-width: 680px) {
  .page-view.home-page-view { padding-right: 18px; padding-left: 18px; }
  .home-hero { padding: 38px 0 42px; }
  .home-greeting { margin-bottom: 10px; font-size: 13px; }
  .home-hero > h2 { font-size: 34px; line-height: 1.22; }
  .home-composer,
  .home-quick-heading,
  .home-quick-links { width: 100%; }
  .home-composer { min-height: 190px; margin-top: 26px; padding: 15px 14px 13px; }
  .home-composer-footer { align-items: flex-start; flex-direction: column; gap: 12px; }
  .home-material-actions { width: 100%; flex-wrap: wrap; }
  .home-material-actions > span { width: 100%; }
  .home-start-button { align-self: stretch; width: 100%; }
  .home-quick-heading { margin-top: 28px; }
  .home-quick-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
  .home-quick-links button { justify-content: flex-start; }
}

/* v13 final published theme cascade. Keep this last so administrator settings win. */
body:not(.login-required) {
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  background: var(--ui-page-bg);
  color: var(--ui-text);
  font-size: calc(16px * var(--ui-font-scale));
}

.sidebar,
.topbar,
.workspace,
.page-view { border-color: var(--ui-border); background-color: var(--ui-surface); }
.topbar { min-height: var(--ui-topbar-height); height: var(--ui-topbar-height); }
.page-view:not(.home-page-view) { width: 100%; max-width: var(--ui-content-width); margin-inline: auto; }
.page-view.home-page-view { background: var(--ui-page-bg); }
.home-hero > h2 { color: var(--ui-text); }
.home-greeting,
.home-quick-heading span,
.home-material-summary { color: var(--ui-muted); }

button,
input,
textarea,
select { border-radius: var(--ui-button-radius); }
.box,
.node,
.admin-panel,
.media-asset-card,
.video-asset-card { border-radius: var(--ui-card-radius); }

.sidebar-nav .nav-group { display: contents; }
.sidebar-nav .nav-group-label {
  display: block;
  margin-top: 8px;
  padding: 4px 10px 2px;
  color: var(--ui-muted);
}
.sidebar-nav > .nav-group > .nav { margin-bottom: 2px; }

#supportStatus.success { color: var(--green); }

/* v14 BUFFUN Campaign Studio: real data, existing routes, editable modules. */
body:not(.login-required) {
  background: var(--ui-page-bg, #f8f4ec);
}

body:not(.login-required) .sidebar {
  border-right-color: #292724;
  background:
    radial-gradient(circle at 55% 86%, rgba(183, 126, 49, .16) 0 1px, transparent 2px),
    linear-gradient(180deg, #151515 0%, #101111 100%);
  color: #fff;
}

body:not(.login-required) .sidebar::after {
  content: "BUFFUN\A BE REMARKABLE";
  position: absolute;
  left: 24px;
  bottom: 28px;
  color: #c99a52;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .14em;
  white-space: pre;
}

body:not(.login-required) .sidebar { position: relative; overflow: hidden; }
body:not(.login-required) .sidebar::before {
  content: "";
  position: absolute;
  left: -54px;
  bottom: 76px;
  width: 230px;
  height: 100px;
  border: 1px solid rgba(201, 154, 82, .5);
  border-radius: 50%;
  transform: rotate(-14deg);
  box-shadow: 0 0 0 12px rgba(201, 154, 82, .06), 0 0 0 28px rgba(201, 154, 82, .035);
}

body:not(.login-required) .brand { position: relative; z-index: 1; color: #fff; }
body:not(.login-required) .brand-mark { background: var(--red); color: #fff; }
body:not(.login-required) .brand small,
body:not(.login-required) .sidebar .nav-group-label { color: #8c8c8a; }
body:not(.login-required) .sidebar .nav { position: relative; z-index: 1; color: #c9c9c6; }
body:not(.login-required) .sidebar .nav:hover { color: #fff; background: rgba(255, 255, 255, .06); }
body:not(.login-required) .sidebar .nav.active { color: #fff; background: linear-gradient(90deg, #c9131e 0%, #a80f18 100%); }
body:not(.login-required) .sidebar .nav.active::before { display: none; }

body:not(.login-required) .topbar {
  border-bottom-color: rgba(174, 142, 96, .28);
  background: color-mix(in srgb, var(--ui-surface, #fffdf9) 92%, transparent);
  backdrop-filter: blur(16px);
}

.status .resource-space-entry { width: auto; min-width: 142px; border-color: #dfcfb9; background: #fffaf1; }
.status .resource-space-entry > span:not(.unread-badge) { border: 0; padding: 0; color: #8f5e22; background: transparent; }

.page-view.home-page-view {
  min-height: calc(100vh - var(--ui-topbar-height));
  padding: 0 clamp(22px, 3vw, 48px) 54px;
  background:
    radial-gradient(circle at 73% 11%, rgba(197, 142, 72, .08) 0 1px, transparent 2px),
    repeating-radial-gradient(ellipse at 105% 16%, transparent 0 54px, rgba(189, 128, 49, .16) 55px 56px, transparent 57px 72px),
    var(--ui-page-bg, #f8f4ec);
}

.home-page { max-width: var(--ui-content-width, 1480px); min-height: auto; margin: 0 auto; }
.home-hero { width: 100%; min-height: auto; padding: 34px 0 0; }
.home-greeting { margin: 0 0 5px; color: var(--ui-muted); font-size: 15px; letter-spacing: .02em; }
.home-hero > h2 {
  position: relative;
  max-width: none;
  margin: 0;
  color: var(--ui-text, #17130f);
  font-family: "Songti SC", STSong, "Noto Serif SC", serif;
  font-size: clamp(40px, 3.35vw, 50px);
  font-weight: 680;
  line-height: 1.18;
  letter-spacing: .025em;
}
.home-hero > h2 em { color: var(--red); font-style: normal; }
.home-hero > h2 > i { margin-left: 10px; color: var(--red); font-family: inherit; font-size: 16px; font-style: normal; vertical-align: top; }

.home-composer {
  width: min(100%, 1060px);
  min-width: 0;
  min-height: 150px;
  margin-top: 20px;
  padding: 15px 16px 13px;
  grid-template-rows: minmax(68px, 1fr) auto auto;
  border-color: #dec9ad;
  border-radius: 10px;
  background: rgba(255, 253, 249, .94);
  box-shadow: 0 14px 36px rgba(78, 52, 27, .05);
}
.home-composer:focus-within { border-color: #c89a60; box-shadow: 0 0 0 3px rgba(189, 32, 40, .07), 0 18px 42px rgba(78, 52, 27, .07); }
.home-composer textarea { min-height: 68px; color: #28211b; font-size: 16px; }
.home-composer textarea::placeholder { color: #9b938b; }
.home-composer-footer { padding-top: 10px; border-top: 1px solid #eee2d2; }
.home-material-actions > span { color: #5f554a; }
.home-material-actions button { border-color: #e5d9ca; background: #fffdf9; color: #554b42; }
.home-material-actions button:hover { border-color: #cda978; background: #fff9ef; }
.home-start-button { width: 124px; border-color: #a90e18; background: linear-gradient(180deg, #c71924, #ad111b); box-shadow: 0 7px 18px rgba(173, 17, 27, .16); }

.home-inspiration { width: min(100%, 1210px); margin-top: 17px; }
.home-section-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #24201c; }
.home-section-kicker i { font-style: normal; }
.home-section-kicker strong { font-size: 14px; font-weight: 700; }
.home-suggestion-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.home-suggestion-list button {
  min-height: 46px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e3d6c5;
  border-radius: 8px;
  color: #4a4037;
  background: rgba(255, 253, 249, .74);
  font-size: 12px;
  text-align: left;
}
.home-suggestion-list button:hover { border-color: #cda978; color: #1c1713; background: #fffaf2; transform: translateY(-1px); }
.home-suggestion-list button span { color: var(--red); font-size: 18px; }

.home-quick-module { margin-top: 20px; }
.home-quick-heading { width: 100%; min-width: 0; margin: 0 0 10px; padding-left: 11px; border-left: 2px solid var(--red); }
.home-quick-heading strong { color: #24201c; font-size: 16px; font-weight: 700; }
.home-quick-heading span { color: var(--ui-muted); }
.home-quick-links { width: min(100%, 1210px); min-width: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.home-quick-links .home-capability {
  position: relative;
  min-height: 88px;
  padding: 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  overflow: hidden;
  border: 1px solid #e1d3c1;
  border-radius: 8px;
  color: #251f1a;
  background: rgba(255, 253, 249, .88);
  text-align: left;
}
.home-quick-links .home-capability:hover { border-color: #cba56f; color: #17130f; background: #fffaf1; transform: translateY(-2px); box-shadow: 0 12px 24px rgba(80, 55, 30, .07); }
.home-capability-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #d7b98d; border-radius: 9px; color: var(--red); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 800; }
.home-capability-copy { min-width: 0; display: grid; gap: 5px; }
.home-capability-copy strong { font-size: 15px; }
.home-capability-copy small { overflow: hidden; color: #80766b; font-size: 11px; font-weight: 400; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.home-availability { position: absolute; top: 8px; right: 9px; padding: 2px 5px; border-radius: 999px; font-size: 9px; font-style: normal; }
.home-availability.available { color: #6c6b65; background: #f1eee8; }
.home-capability.coming { border-color: #d8dade; color: #777b82; background: #f2f3f4; }
.home-capability.coming::after { content: ""; position: absolute; right: -20px; bottom: -28px; width: 95px; height: 70px; border: 1px solid rgba(193, 128, 44, .5); border-radius: 50%; transform: rotate(-20deg); }
.home-availability.coming { color: #6f747b; border: 1px solid #cfd2d6; background: #e7e9eb; }
.home-quick-links .home-capability.coming:hover { border-color: #d8dade; color: #777b82; background: #f2f3f4; transform: none; box-shadow: none; }
.home-capability.coming .home-capability-icon { border-color: #cfd2d6; color: #8b9096; background: #e8eaec; }
.openai-setting-coming { color: #8a8f96; }
.openai-setting-coming small { margin-left: 5px; color: #777c83; font-size: 10px; font-weight: 600; }
.openai-setting-coming select:disabled { color: #7e8389; background: #eceef0; opacity: 1; }

.home-workspace-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(390px, 1.15fr) minmax(250px, .72fr);
  gap: 12px;
}
.home-workspace-summary > article,
.home-workspace-summary > aside > article,
.home-resource-strip { border: 1px solid #e0d2c0; border-radius: 10px; background: rgba(255, 253, 249, .9); }
.home-active-project,
.home-recent-tasks { min-width: 0; padding: 14px; }
.home-active-project > header,
.home-recent-tasks > header,
.home-notice-card > header,
.home-template-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.home-active-project header div,
.home-recent-tasks header div { display: grid; gap: 3px; }
.home-active-project header span,
.home-recent-tasks header span { color: #2a241e; font-size: 15px; font-weight: 700; }
.home-active-project header strong,
.home-recent-tasks header strong { color: #8b8177; font-size: 10px; font-weight: 500; }
.home-workspace-summary header button { min-height: 24px; padding: 2px 4px; border: 0; background: transparent; color: #8e8378; font-size: 10px; }
.home-workspace-summary header button:hover { color: var(--red); background: transparent; }
.home-active-project-body { min-height: 210px; display: grid; grid-template-columns: minmax(126px, 39%) minmax(0, 1fr); gap: 15px; }
.home-project-cover { position: relative; min-height: 210px; overflow: hidden; border-radius: 8px; background: linear-gradient(145deg, #2b2420, #7b181d 65%, #c89b55); background-size: cover; background-position: center; }
.home-project-cover::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(255, 231, 191, .5); }
.home-project-cover span { position: absolute; z-index: 1; left: 18px; bottom: 17px; color: #fff0d3; font-family: Georgia, serif; font-size: 11px; letter-spacing: .16em; }
.home-project-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.home-project-copy > div { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-project-copy > div > span { color: #8a7c70; font-size: 11px; }
.home-project-copy h3 { margin: 9px 0 7px; font-size: 18px; line-height: 1.35; }
.home-project-copy p { display: -webkit-box; overflow: hidden; margin: 0 0 7px; color: #776d63; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.home-project-copy > small { margin-bottom: 15px; color: #958a7f; font-size: 10px; }
.home-project-copy > button { min-height: 34px; padding: 7px 14px; }
.home-project-empty { min-height: 210px; display: flex; align-items: center; justify-content: center; gap: 13px; border: 1px dashed #d7c5ae; border-radius: 8px; background: #fffaf2; }
.home-project-empty > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--red); background: #f8e8e3; font-size: 22px; }
.home-project-empty div { max-width: 210px; }
.home-project-empty strong { display: block; font-size: 14px; }
.home-project-empty p { margin: 4px 0 0; color: #857a6f; font-size: 11px; line-height: 1.5; }
.home-project-empty button { margin-left: 4px; }

.home-task-list { display: grid; }
.home-task-row { min-height: 43px; padding: 6px 4px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; border: 0; border-top: 1px solid #eee3d5; border-radius: 0; background: transparent; text-align: left; }
.home-task-row:first-child { border-top: 0; }
.home-task-row:hover { color: inherit; background: #fff8ee; }
.home-task-type { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #d6b484; border-radius: 6px; color: var(--red); font: 700 10px ui-monospace, monospace; }
.home-task-copy { min-width: 0; }
.home-task-copy strong,
.home-task-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-task-copy strong { color: #332b24; font-size: 11px; }
.home-task-copy small { margin-top: 2px; color: #91867b; font-size: 9px; }
.home-task-row time { color: #94887c; font-size: 9px; }
.home-task-status { padding: 3px 6px; border-radius: 999px; font-size: 9px; font-style: normal; white-space: nowrap; }
.home-task-status.processing { color: #a10f18; border: 1px solid #e4b8b3; background: #fff3f1; }
.home-task-status.done { color: #376f50; background: #eaf5ed; }
.home-task-status.failed { color: #9e2f37; background: #fbe9eb; }
.home-list-empty { min-height: 200px; display: grid; place-content: center; gap: 5px; color: #8a8076; text-align: center; }
.home-list-empty strong { color: #4a4037; font-size: 13px; }
.home-list-empty span { font-size: 11px; }

.home-side-rail { display: grid; grid-template-rows: 1fr 1fr; gap: 10px; }
.home-side-rail article { min-width: 0; padding: 13px; }
.home-side-rail header strong { font-size: 13px; }
.home-notice-card > div,
.home-template-card > div { display: grid; }
.home-notice-card > div > button,
.home-template-card > div > button { min-height: 32px; padding: 5px 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 0; border-top: 1px solid #eee4d7; border-radius: 0; background: transparent; text-align: left; }
.home-notice-card > div > button:first-child,
.home-template-card > div > button:first-child { border-top: 0; }
.home-notice-card > div > button i { width: 4px; height: 4px; border-radius: 50%; background: var(--red); }
.home-notice-card > div > button span,
.home-template-card > div > button span { overflow: hidden; color: #4a4037; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.home-notice-card time,
.home-template-card small { color: #a0968c; font-size: 8px; }
.home-notice-card p,
.home-template-card p { margin: 16px 0; color: #958a7f; font-size: 10px; text-align: center; }

.home-resource-strip { grid-column: 1 / -1; min-height: 58px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.home-resource-strip > div { display: grid; gap: 3px; }
.home-resource-strip span { color: #26201b; font-size: 13px; font-weight: 700; }
.home-resource-strip strong { color: #8a7f74; font-size: 10px; font-weight: 500; }
.home-resource-strip nav { display: flex; gap: 7px; }
.home-resource-strip button { min-height: 30px; padding: 5px 10px; border-color: #e1d3c1; background: #fffaf2; color: #54493f; font-size: 10px; }

/* Login: exact official wordmark on a black campaign field. */
body.login-required { background: #111; }
#loginDialog { background: #fffdf9; }
#loginDialog::backdrop { background: #111; }
#loginDialog .trusted-asset-form { grid-template-columns: minmax(390px, 45%) minmax(0, 55%); }
#loginDialog .login-brand {
  justify-content: flex-start;
  gap: 0;
  padding: clamp(42px, 6vw, 92px);
  border-right: 0;
  background: linear-gradient(145deg, #171717, #0e0f0f 72%);
}
#loginDialog .login-brand::before { width: 6px; background: var(--red); }
#loginDialog .login-brand::after { right: -120px; bottom: -95px; width: 420px; height: 240px; border-color: rgba(207, 158, 83, .34); transform: rotate(-18deg); }
#loginDialog .login-official-logo { width: min(100%, 430px); height: 92px; margin-top: 12vh; object-fit: contain; object-position: left center; }
#loginDialog .login-brand-copy { margin-top: 78px; }
#loginDialog .login-brand small { color: #b7b2aa; letter-spacing: .16em; }
#loginDialog .login-brand p { color: #fff; font-size: 19px; }
.login-brand-orbit { position: absolute !important; z-index: 0 !important; inset: auto auto 10% -18%; width: 70%; height: 180px; }
.login-brand-orbit i { position: absolute; inset: 0; border: 1px solid rgba(207, 158, 83, .33); border-radius: 50%; transform: rotate(-16deg); }
.login-brand-orbit i:nth-child(2) { inset: 20px -25px; }
.login-brand-orbit i:nth-child(3) { inset: 42px -50px; }
.login-brand-signature { position: absolute; z-index: 2; left: clamp(42px, 6vw, 92px); bottom: 38px; margin: 0 !important; color: #ca9b52 !important; font: 14px/1.3 Georgia, serif !important; letter-spacing: .13em; }
.login-brand-signature span { font-size: 9px; }
#loginDialog .login-panel { width: min(100%, 430px); }
#loginDialog .dialog-head h2 { color: #191511; font-family: "Songti SC", STSong, serif; font-size: 34px; font-weight: 650; }
#loginDialog .dialog-head p { color: #7d746c; }
#loginDialog #loginHint { color: #7d746c; }
#loginDialog .trusted-asset-form label { color: #4a423b; }
#loginDialog .trusted-asset-form input { border-color: #dfd5c8; background: #fff; }
#loginDialog #loginSubmitBtn { background: linear-gradient(180deg, #c71924, #ad111b); }

/* Account request: same campaign language, existing form and handlers. */
#accountRequestDialog { width: min(650px, calc(100vw - 32px)); border: 1px solid #dfd1c0; border-radius: 16px; background: #fffdf9; box-shadow: 0 30px 80px rgba(13, 12, 11, .3); }
#accountRequestDialog::backdrop { background: rgba(12, 12, 12, .68); backdrop-filter: blur(3px); }
#accountRequestDialog .trusted-asset-form { position: relative; padding: 30px 32px 26px; }
#accountRequestDialog .trusted-asset-form::before { content: ""; position: absolute; top: 0; left: 32px; width: 42px; height: 3px; background: var(--red); }
#accountRequestDialog .dialog-head h2 { color: #1d1814; font-family: "Songti SC", STSong, serif; font-size: 28px; font-weight: 650; }
#accountRequestDialog > form > .muted { color: #7d746c; }
.account-request-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#accountRequestDialog .trusted-asset-form label { color: #4a423b; }
#accountRequestDialog input,
#accountRequestDialog textarea { border-color: #dfd5c8; background: #fff; }
#accountRequestDialog textarea { min-height: 116px; }
.account-request-facts { margin-top: 15px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 0; border: 1px solid #eadfce; border-radius: 8px; color: #7d7165; background: #fff9ef; font-size: 11px; }
.account-request-facts span { padding: 0 15px; border-left: 1px solid #e0d0bc; }
.account-request-facts span:first-child { border-left: 0; }
#accountRequestDialog .dialog-actions { align-items: center; }
#accountRequestDialog .dialog-actions > button:first-child { min-width: 76px; border-color: transparent; background: transparent; white-space: nowrap; }
#accountRequestDialog .dialog-actions .primary:not(:disabled) { background: linear-gradient(180deg, #c71924, #ad111b); }

@media (max-width: 1260px) {
  .home-workspace-summary { grid-template-columns: minmax(340px, 1fr) minmax(360px, 1fr); }
  .home-side-rail { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .home-resource-strip { grid-column: 1 / -1; }
}

@media (max-width: 1020px) {
  .home-suggestion-list,
  .home-quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-workspace-summary { grid-template-columns: 1fr; }
  .home-side-rail,
  .home-resource-strip { grid-column: auto; }
}

@media (max-width: 760px) {
  #loginDialog .trusted-asset-form { grid-template-columns: 1fr; }
  #loginDialog .login-brand { min-height: 250px; padding: 30px 26px; }
  #loginDialog .login-official-logo { width: min(100%, 300px); height: 62px; margin-top: 24px; }
  #loginDialog .login-brand-copy { margin-top: 32px; }
  .login-brand-signature { display: none; }
  .account-request-pair { grid-template-columns: 1fr; gap: 0; }
  .home-hero { padding-top: 26px; }
  .home-hero > h2 { font-size: 34px; }
  .home-suggestion-list,
  .home-quick-links { grid-template-columns: 1fr; }
  .home-active-project-body { grid-template-columns: 1fr; }
  .home-project-cover { min-height: 180px; }
  .home-task-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .home-task-row time { display: none; }
  .home-side-rail { grid-template-columns: 1fr; }
  .home-resource-strip { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .home-suggestion-list button,
  .home-capability { transform: none !important; transition-duration: 1ms !important; }
}

/* v15 media previews, deterministic home routing and compact controls. */
.ui-line-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
}

.home-quick-links .home-capability {
  grid-template-columns: 42px minmax(0, 1fr);
  padding-right: 86px;
  overflow: hidden;
}

.home-capability-icon {
  font-family: inherit;
  font-size: 0;
}

.home-capability-icon .ui-line-icon { width: 23px; height: 23px; }
.home-quick-links .home-availability {
  position: absolute;
  top: 10px;
  right: 10px;
  width: max-content;
  height: auto;
  max-width: none;
  padding: 3px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 999px;
  line-height: 1.15;
  text-align: center;
  word-break: keep-all;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.home-capability.coming::after { display: none; }

.home-composer.material-drop-target {
  position: relative;
  border-color: var(--red);
  background: #fff8f7;
  box-shadow: 0 0 0 3px rgba(189, 32, 40, .1);
}

.home-composer.material-drop-target::after {
  content: "松开即可添加素材";
  position: absolute;
  z-index: 4;
  inset: 10px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(189, 32, 40, .55);
  border-radius: 7px;
  color: var(--red);
  background: rgba(255, 248, 247, .94);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}

.home-material-summary {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 5px;
  color: #7f2026;
  background: #fff0ef;
  font-weight: 650;
}

.media-thumbnail,
.media-thumbnail-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumbnail-fallback {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .75);
  background: #303840;
}

.media-thumbnail.thumbnail-load-failed { opacity: .2; }
.asset-media-preview .asset-video-thumbnail,
.video-asset-cover .video-asset-thumbnail {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.asset-media-preview.video .asset-media-symbol,
.video-asset-play {
  width: 34px;
  height: 34px;
  font-size: 13px;
  background: rgba(18, 22, 27, .48);
}

.home-project-cover {
  background: #2d3237;
}

.home-project-cover .home-project-thumbnail {
  position: absolute;
  inset: 0;
}

.home-project-cover::after { pointer-events: none; }
.home-task-row {
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  min-height: 55px;
}

.home-task-preview {
  width: 48px;
  height: 34px;
  display: block;
  overflow: hidden;
  border: 1px solid #e3d6c7;
  border-radius: 5px;
  background: #303840;
}

.home-task-preview .ui-line-icon { width: 17px; height: 17px; }
.home-project-empty {
  min-height: 210px;
  padding: 24px;
  justify-content: space-between;
}

.home-project-empty div { max-width: 250px; }
.home-project-empty button { min-width: 118px; margin-left: 12px; }

.remove-asset,
.image-reference-item button,
.image-reference-grid .image-reference-item button {
  top: 3px;
  right: 3px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  opacity: .82;
}

.asset-thumb:hover .remove-asset,
.image-reference-item:hover button { opacity: 1; }

.canvas-tab-close {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  font-size: 13px;
}

.dialog-close,
.admin-dialog .dialog-close,
#accountRequestDialog .dialog-close {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}

button.is-pressing:not(:disabled),
a.download-link.is-pressing {
  transform: translateY(2px) scale(.965) !important;
  filter: brightness(.93) saturate(.92);
  box-shadow: inset 0 2px 5px rgba(28, 20, 16, .18) !important;
  transition-duration: 45ms !important;
}

button.command-acknowledged:not(:disabled),
a.download-link.command-acknowledged {
  animation: command-acknowledged 220ms ease-out;
}

@keyframes command-acknowledged {
  0% { filter: brightness(.93); }
  48% { transform: translateY(0) scale(1.018); filter: brightness(1.04); }
  100% { transform: none; filter: none; }
}

@media (max-width: 760px) {
  .home-quick-links .home-capability {
    grid-template-columns: 40px minmax(0, 1fr);
    padding-right: 86px;
  }
  .home-task-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .home-task-preview { width: 44px; height: 32px; }
  .home-project-empty { align-items: flex-start; flex-direction: column; }
  .home-project-empty button { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  button.command-acknowledged:not(:disabled),
  a.download-link.command-acknowledged { animation: none; }
}

/* v16 unified material upload and verified portrait authorization */
.material-add-button,
.material-group .material-add-button,
.image-reference-actions .material-add-button,
.image-trusted-upload .material-add-button,
.home-material-actions .material-add-button {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid #cfd5dc;
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.material-add-button:hover {
  border-color: var(--red);
  color: var(--red);
  background: #fff8f7;
}

.material-add-button:active,
.material-add-button.command-acknowledged { transform: translateY(1px) scale(.96); }

.material-source-actions {
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  margin-top: 10px;
}

.material-source-actions .upload-button,
.material-source-actions .library-pick-button { margin-top: 0; }

.trusted-material-zone,
.image-trusted-upload {
  display: grid;
  gap: 10px;
}

.trusted-path {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.trusted-path > strong,
.trusted-path > label {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.trusted-code-path {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 6px;
}

.trusted-code-path > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.trusted-code-path input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 7px 9px;
  border: 1px solid #d8dde3;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.trusted-code-path button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
  border-color: #cfd5dc;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.trusted-code-path button:hover { border-color: var(--red); color: var(--red); background: #fff8f7; }
.trusted-asset-help { grid-column: 1 / -1; }

.image-trusted-upload {
  grid-template-columns: minmax(120px, .45fr) minmax(250px, 1fr);
  align-items: end;
}

.image-trusted-upload > p { grid-column: 1 / -1; }

.trusted-code-preview {
  width: 100%;
  height: 100%;
  min-height: 72px;
  display: grid;
  place-items: center;
  color: #23704e;
  background: #eef9f3;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 720px) {
  .image-trusted-upload { grid-template-columns: 1fr; }
}

/* v18 unified OpenAI creation hub */
.openai-hub-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 0 64px;
  display: grid;
  gap: 18px;
}

.openai-hub-page > section {
  min-width: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.openai-hub-page section > header,
.openai-deliverable > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.openai-hub-page header span {
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
}

.openai-hub-page h2,
.openai-hub-page h3,
.openai-hub-page p { margin: 0; }
.openai-hub-page h2 { margin-top: 4px; font-size: 24px; }
.openai-hub-page header p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.openai-connection { padding: 6px 9px; border: 1px solid #e4c8ca; border-radius: 6px; color: var(--red); background: var(--red-soft); font-size: 11px; font-style: normal; white-space: nowrap; }
.openai-connection.ready { border-color: #b9ddcc; color: var(--green); background: #f2fbf6; }

#openAiRequest {
  width: 100%;
  min-height: 170px;
  margin-top: 22px;
  padding: 18px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font: inherit;
  line-height: 1.7;
}

.openai-upload-row,
.openai-delivery-panel > footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.openai-upload-row button { display: inline-flex; align-items: center; gap: 8px; }
.openai-upload-row small,
.openai-delivery-panel > footer p { color: var(--muted); font-size: 12px; }
.openai-file-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.openai-file-chip { max-width: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 9px; border: 1px solid var(--line); border-radius: 6px; color: #4b5563; background: var(--surface-soft); font-size: 12px; overflow-wrap: anywhere; }
.openai-file-chip button { width: 22px; min-width: 22px; height: 22px; min-height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 15px; }
.openai-optimize-button { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; }
.openai-optimize-button .ui-line-icon { width: 18px; height: 18px; }

.openai-delivery-panel > header label { width: min(280px, 42%); color: var(--muted); font-size: 12px; }
.openai-delivery-panel > header select { width: 100%; margin-top: 5px; }
.openai-output-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.openai-output-types button { min-width: 0; min-height: 76px; padding: 12px; display: grid; align-content: center; gap: 5px; border-color: var(--line); background: #fff; text-align: left; }
.openai-output-types button strong { font-size: 14px; }
.openai-output-types button span { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.35; }
.openai-output-types button.active { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); color: var(--red-dark); background: #fffafa; }

.openai-empty-result,
.openai-conversation-empty { margin-top: 20px; padding: 24px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); background: var(--surface-soft); text-align: center; }
.openai-empty-result strong,
.openai-conversation-empty strong { display: block; margin-bottom: 6px; color: var(--text); }
.openai-optimization-card { margin-top: 20px; display: grid; gap: 14px; }
.openai-result-arrived { scroll-margin-top: 92px; animation: openai-result-arrival 900ms ease-out; }
@keyframes openai-result-arrival {
  0% { box-shadow: 0 0 0 3px rgba(198, 31, 43, 0.22); }
  100% { box-shadow: 0 0 0 0 rgba(198, 31, 43, 0); }
}
.openai-optimization-card > header { display: grid; justify-content: start; gap: 4px; }
.openai-replacement-note { margin: 0; padding: 10px 12px; border-left: 3px solid var(--red); color: var(--muted); background: #fff7f6; font-size: 13px; line-height: 1.55; }
.openai-optimization-card label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
.openai-optimization-card textarea { width: 100%; min-height: 230px; padding: 14px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 7px; font: inherit; line-height: 1.65; }
.openai-preserve-list { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.openai-preserve-list strong { margin-right: 4px; font-size: 12px; }
.openai-preserve-list span { padding: 5px 8px; border-radius: 5px; color: #5b2a2e; background: var(--red-soft); font-size: 11px; }
.openai-questions { padding: 13px 15px; border-left: 3px solid #d5a348; background: #fffaf0; }
.openai-questions p { margin-top: 7px; color: #5f5138; font-size: 12px; }
.openai-image-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.openai-image-settings label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.openai-delivery-panel > footer { justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--line); }

.openai-deliverable { margin-top: 20px; }
.openai-deliverable > header span { display: block; margin-top: 4px; color: var(--muted); }
.openai-deliverable-summary { margin-top: 16px !important; color: #4b5563; line-height: 1.7; }
.openai-deliverable > section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.openai-deliverable > section h3 { font-size: 15px; }
.openai-deliverable > section p { margin-top: 8px; color: #4b5563; line-height: 1.75; }
.openai-result-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 16px; }
.openai-result-images img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }
.openai-slide-list { display: grid; gap: 8px; margin: 16px 0 0; padding-left: 24px; }
.openai-slide-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.openai-slide-list p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.openai-revision-box { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.openai-revision-box textarea { min-height: 84px; padding: 12px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 7px; font: inherit; }

/* OpenAI administrator controls are intentionally independent from the legacy provider. */
.openai-admin-panel { gap: 20px; }
.openai-admin-connection,
.openai-limit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.openai-admin-connection label,
.openai-limit-grid label,
.openai-route-row label,
.openai-model-row label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.openai-admin-block { display: grid; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.openai-admin-block h3 { margin: 0; font-size: 15px; }
.openai-ability-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.openai-ability-grid label { min-width: 0; display: flex; align-items: center; gap: 7px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.openai-route-list,
.openai-model-list,
.openai-record-list,
.openai-audit-list { display: grid; gap: 8px; }
.openai-route-row { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.openai-route-row strong { align-self: center; font-size: 13px; }
.openai-model-row { display: grid; grid-template-columns: minmax(120px, .6fr) repeat(4, minmax(0, 1fr)) auto; gap: 9px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.openai-model-row > strong { align-self: center; overflow-wrap: anywhere; font-size: 12px; }
.openai-capability-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.openai-capability-tags span { padding: 6px 8px; border: 1px solid #b9ddcc; border-radius: 5px; color: var(--green); background: #f2fbf6; font-size: 11px; }
.openai-capability-results details p { max-height: 180px; overflow: auto; color: var(--muted); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.openai-record-row,
.openai-audit-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.openai-record-row div,
.openai-audit-row div { min-width: 0; display: grid; gap: 3px; }
.openai-record-row small,
.openai-audit-row small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.openai-record-row span { max-width: 55%; color: var(--green); font-size: 11px; text-align: right; overflow-wrap: anywhere; }
.openai-record-row.failed span { color: var(--red); }
.openai-audit-row button { flex: 0 0 auto; }

@media (max-width: 900px) {
  .openai-output-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .openai-route-row,
  .openai-model-row { grid-template-columns: 1fr 1fr; }
  .openai-route-row strong,
  .openai-model-row > strong { grid-column: 1 / -1; }
  .openai-ability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .openai-hub-page { padding-top: 18px; }
  .openai-hub-page > section { padding: 18px; }
  .openai-hub-page section > header,
  .openai-delivery-panel > footer { align-items: stretch; flex-direction: column; }
  .openai-delivery-panel > header label { width: 100%; }
  .openai-output-types,
  .openai-image-settings,
  .openai-admin-connection,
  .openai-limit-grid,
  .openai-ability-grid,
  .openai-route-row,
  .openai-model-row { grid-template-columns: 1fr; }
  .openai-revision-box { grid-template-columns: 1fr; }
  .openai-upload-row { align-items: flex-start; flex-direction: column; }
  .openai-record-row,
  .openai-audit-row { align-items: flex-start; flex-direction: column; }
  .openai-record-row span { max-width: 100%; text-align: left; }
}

/* The published theme restores the desktop sidebar track late in the cascade.
   Remove that track again when the sidebar is hidden on compact screens. */
@media (max-width: 900px) {
  body:not(.login-required) {
    grid-template-columns: minmax(0, 1fr);
  }

  body:not(.login-required) .app {
    width: 100%;
    min-width: 0;
  }
}
/* v26 OpenAI prompt fidelity, flexible sizes and durable image-task feedback */
.openai-optimization-trace {
  display: block;
  margin: 8px 0 2px;
  color: #267653;
  font-weight: 600;
}

.openai-image-settings > small {
  align-self: end;
  padding-bottom: 9px;
  color: var(--muted, #766e64);
  line-height: 1.45;
}

.image-task-records {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.image-task-record {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid var(--workspace-border, #e7d8c5);
  border-radius: 8px;
  background: var(--workspace-surface, #fffdf9);
}

.image-task-record-preview {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f1ed;
  color: #bd2028;
}

.image-task-record-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-task-record-preview .ui-line-icon {
  width: 24px;
  height: 24px;
}

.image-task-record > div:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.image-task-record strong,
.image-task-record span,
.image-task-record small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-task-record span,
.image-task-record small {
  color: var(--workspace-muted, #766e64);
  font-size: 12px;
}

@media (max-width: 720px) {
  .image-task-record { grid-template-columns: 48px minmax(0, 1fr); }
  .image-task-record-preview { width: 48px; height: 48px; }
  .image-task-record > .home-task-status { grid-column: 2; justify-self: start; }

  .page-view:not(.home-page-view) {
    padding-inline: 12px;
    overflow-x: clip;
  }

  .image-workspace,
  .image-main-panel,
  .image-settings-panel,
  .image-prompt-section,
  .image-prompt-toolbar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .image-main-panel,
  .image-settings-panel {
    padding-inline: 12px;
  }

  .image-prompt-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-prompt-toolbar label,
  .image-prompt-toolbar select,
  .image-controls-grid label,
  .image-controls-grid input,
  .image-controls-grid select {
    width: 100%;
    min-width: 0;
  }

  .image-project-switcher {
    min-width: 0;
    padding-inline: 0;
  }

  .image-project-switcher .canvas-tabs {
    grid-template-columns: repeat(2, minmax(96px, 1fr));
  }
}

/* v28 mobile-only workspace polish. Keep overrides last in the cascade. */
@media (max-width: 720px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body:not(.login-required), body:not(.login-required) .app, body:not(.login-required) main,
  .page-view, .page-view.home-page-view, .home-page, .home-hero { width: 100%; min-width: 0; max-width: 100%; }
  body:not(.login-required) .topbar {
    min-width: 0; height: auto; min-height: 0; padding: 12px 14px 10px;
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; overflow: hidden;
  }
  .topbar h1 { width: 100%; font-size: 20px; line-height: 1.3; }
  .topbar .status {
    width: 100%; min-width: 0; padding: 2px 0 4px; display: flex; flex-wrap: nowrap; gap: 8px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .topbar .status::-webkit-scrollbar { display: none; }
  .topbar .status > * { flex: 0 0 auto; min-height: 44px; scroll-snap-align: start; }
  .page-view.home-page-view { padding: 0 14px 36px; }
  .home-hero { min-height: 0; padding: 24px 0 36px; }
  .home-greeting { margin-bottom: 8px; font-size: 14px; }
  .home-hero > h2 { max-width: 100%; font-size: 32px; line-height: 1.22; overflow-wrap: anywhere; }
  .home-composer, .home-quick-heading, .home-quick-links, .home-suggestion-list,
  .home-workspace-summary { width: 100%; min-width: 0; max-width: 100%; }
  .home-composer { min-height: 0; margin-top: 22px; padding: 14px; grid-template-rows: minmax(112px, auto) auto auto; }
  .home-composer textarea { min-height: 112px; font-size: 16px; }
  .home-composer-footer { width: 100%; align-items: stretch; flex-direction: column; gap: 12px; }
  .home-material-actions { width: 100%; min-width: 0; flex-wrap: wrap; }
  .home-material-actions > span { width: 100%; }
  .home-material-actions .material-add-button { width: 44px; min-width: 44px; max-width: 44px; height: 44px; min-height: 44px; }
  .home-start-button { width: 100%; min-height: 48px; height: 48px; }
  .home-section-kicker, .home-quick-heading { margin-top: 26px; }
  .home-suggestion-list, .home-quick-links, .home-workspace-summary, .home-side-rail { grid-template-columns: minmax(0, 1fr); }
  .home-suggestion-list { gap: 8px; }
  .home-suggestion-list button { width: 100%; min-width: 0; min-height: 52px; padding: 12px 14px; }
  .home-quick-links { gap: 8px; }
  .home-quick-links .home-capability { width: 100%; min-width: 0; min-height: 72px; }
  .home-active-project, .home-recent-tasks, .home-side-rail article { padding: 12px; }
  .home-active-project-body { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .home-task-row, .home-resource-strip { width: 100%; min-width: 0; }
  .home-resource-strip nav { width: 100%; flex-wrap: wrap; }
  .home-resource-strip button { min-height: 44px; }
  .openai-hub-page { width: 100%; min-width: 0; max-width: 100%; padding: 14px 0 36px; }
  .openai-hub-page > section { width: 100%; min-width: 0; padding: 14px; }
  #openAiRequest { min-height: 150px; margin-top: 16px; padding: 14px; font-size: 16px; }
  .openai-upload-row button, .openai-optimize-button, .openai-output-types button,
  .openai-delivery-panel > footer button { min-height: 48px; }
}
