@import url("./css/reset.css");
@import url("./css/global.css");
@import url("./css/components.css");
@import url("./css/views.css");

:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #687789;
  --line: #d8dee8;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --teal: #137b80;
  --teal-dark: #0f6266;
  --rose: #b6425b;
  --amber: #a96700;
  --blue: #2f5aa8;
  --shadow: 0 14px 40px rgba(31, 41, 51, 0.08);
  --site-footer-height: 34px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding-bottom: var(--site-footer-height);
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body:has(.app-shell[hidden]) {
  background: #101820;
}

body:has(.app-shell[hidden]) .toast {
  background: #ffffff;
  color: var(--ink);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(5, 14, 22, 0.96), rgba(10, 29, 38, 0.94)),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 34px);
  color: #eef4f8;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 38%, rgba(49, 196, 190, 0.18) 38% 39%, transparent 39%),
    linear-gradient(0deg, transparent 0 54%, rgba(120, 166, 255, 0.12) 54% 55%, transparent 55%);
  opacity: 0.85;
  pointer-events: none;
}

.auth-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 32px;
  align-items: center;
}

.auth-brand {
  min-width: 0;
}

.auth-brand h1 {
  margin: 10px 0 12px;
  font-size: clamp(36px, 7vw, 68px);
  line-height: 1.12;
  letter-spacing: 0;
}

.auth-brand p {
  max-width: 520px;
  margin: 0;
  color: #b8c6ce;
  line-height: 1.8;
}

.brand-mark.large {
  width: 58px;
  height: 58px;
  font-size: 24px;
  color: #ffffff;
  background: var(--teal);
}

.auth-visual {
  margin-top: 34px;
  width: min(520px, 100%);
  min-height: 170px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 22px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.auth-visual span {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(119, 234, 226, 0.88), transparent);
  transform: rotate(-18deg);
}

.auth-visual span:nth-child(1) {
  width: 72%;
  top: 42px;
  left: -8%;
}

.auth-visual span:nth-child(2) {
  width: 88%;
  top: 92px;
  left: 10%;
}

.auth-visual span:nth-child(3) {
  width: 58%;
  top: 138px;
  right: -6%;
}

.auth-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.14);
  color: #f8fbfd;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.auth-card h2 {
  margin: 4px 0 6px;
  font-size: 28px;
  letter-spacing: 0;
}

.auth-card-subtitle {
  margin: 0 0 22px;
  color: rgba(238, 244, 248, 0.72);
  font-weight: 700;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  overflow: hidden;
}

.auth-tabs button {
  min-height: 42px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(238, 244, 248, 0.78);
  font-weight: 900;
}

.auth-tabs button.active {
  background: rgba(121, 235, 226, 0.24);
  color: #ffffff;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 10px;
  align-items: stretch;
}

.code-row .ghost-button {
  min-height: 54px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.code-row .ghost-button:disabled,
.auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.floating-field {
  position: relative;
  display: block;
}

.floating-field input {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 18px 14px 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.floating-field input:focus {
  border-color: rgba(121, 235, 226, 0.92);
  box-shadow: 0 0 0 4px rgba(56, 189, 181, 0.14);
  background: rgba(255, 255, 255, 0.14);
}

.floating-field span {
  position: absolute;
  left: 14px;
  top: 17px;
  color: rgba(238, 244, 248, 0.64);
  font-weight: 800;
  pointer-events: none;
  transition: transform 160ms ease, color 160ms ease, font-size 160ms ease;
}

.floating-field input:focus + span,
.floating-field input:not(:placeholder-shown) + span {
  transform: translateY(-11px);
  font-size: 11px;
  color: rgba(121, 235, 226, 0.92);
}

.auth-submit {
  min-height: 50px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10a9a4, #3178ff);
  color: #ffffff;
  border: 0;
  box-shadow: 0 14px 32px rgba(20, 158, 204, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 18px 42px rgba(49, 120, 255, 0.32);
}

.auth-submit.loading {
  opacity: 0.88;
}

.auth-submit.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 760ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.app-shell.asset-pane-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.app-shell.asset-pane-collapsed .asset-pane {
  display: none;
}

.global-sidebar {
  min-height: 100vh;
  padding: 14px 10px;
  background: #161b22;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.brand-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 8px;
  background: var(--teal);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
}

.pane-actions {
  display: flex;
  gap: 8px;
}

.account-badge {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  word-break: break-all;
}

.global-sidebar button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7d0dc;
  font-size: 12px;
  font-weight: 900;
}

.global-sidebar button.active,
.global-sidebar button:hover {
  background: #263140;
  color: #ffffff;
}

.asset-pane {
  min-height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-title {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-grid,
.settings-grid,
.queue-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.project-card,
.queue-card,
.shot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.project-card strong,
.queue-card {
  font-size: 15px;
  font-weight: 900;
}

.project-card span,
.shot-card span,
.library-note {
  color: var(--muted);
  line-height: 1.5;
}

.simple-image-view {
  display: flex;
  justify-content: center;
}

.simple-image-card {
  width: min(1440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.simple-image-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 14px;
}

.simple-image-grid label,
.simple-prompt-field,
.simple-upload-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.simple-upload-block {
  margin-top: 26px;
}

.video-ref-block {
  margin: 16px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-ref-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.video-ref-zone {
  min-height: 74px;
}

.video-ref-list {
  min-height: 34px;
}

.video-ref-empty {
  width: 100%;
  border: 1px dashed #d2d7de;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.simple-label {
  color: var(--ink);
  font-weight: 900;
}

.simple-upload-zone {
  min-height: 86px;
  border: 2px dashed #d2d7de;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.simple-upload-zone input {
  display: none;
}

.simple-upload-zone.dragover {
  border-color: #0969da;
  background: #f4f8ff;
}

.simple-upload-icon {
  color: #8a939f;
  font-size: 22px;
  line-height: 1;
}

.simple-ref-list,
.simple-result-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.simple-ref-card {
  width: 126px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.simple-ref-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.simple-ref-card span {
  display: block;
  padding: 7px 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-ref-card button {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: var(--rose);
  font-weight: 900;
}

.simple-prompt-field {
  margin-top: 24px;
}

#simpleImagePrompt {
  min-height: 92px;
  background: #f4f5f7;
  border-color: transparent;
}

.simple-submit-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.blue-button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: #0969da;
  color: #ffffff;
  font-weight: 900;
}

.blue-button:hover {
  background: #0757b8;
}

.blue-button:disabled {
  background: #7daee9;
}

.simple-result-block {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.section-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.simple-job-list {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

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

.simple-job-card[data-status="running"],
.simple-job-card[data-status="queued"] {
  border-color: #b7d4ff;
  background: #f7fbff;
}

.simple-job-card[data-status="completed"] {
  border-color: #bdded8;
  background: #f8fffd;
}

.simple-job-card[data-status="failed"] {
  border-color: #f0c2cb;
  background: #fff8fa;
}

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

.simple-job-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.simple-job-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  color: #ffffff;
  background: #6d7785;
  font-size: 12px;
  font-weight: 900;
}

.simple-job-status.queued {
  background: var(--blue);
}

.simple-job-status.running {
  background: var(--amber);
}

.simple-job-status.completed {
  background: var(--teal);
}

.simple-job-status.failed {
  background: var(--rose);
}

.simple-job-prompt {
  margin-top: 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.simple-job-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.simple-job-progress {
  margin-top: 12px;
}

.simple-job-note {
  margin-top: 9px;
  border-radius: 8px;
  background: #fff7e6;
  padding: 8px 10px;
  color: #9a5d00;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.simple-job-error {
  margin-top: 10px;
  border-radius: 8px;
  background: #fde8ec;
  padding: 9px 10px;
  color: #9f2437;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.simple-job-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.simple-job-retry {
  color: #ffffff;
  border-color: var(--rose);
  background: var(--rose);
}

.simple-job-retry:hover {
  background: #9f3148;
}

.simple-job-result-grid {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.simple-result-run {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.simple-result-run + .simple-result-run {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.simple-result-title,
.simple-empty-result {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.simple-result-card {
  width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.simple-result-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #eef1f5;
}

.simple-result-actions,
.image-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.simple-result-actions a,
.image-result-actions a {
  min-width: 0;
  padding: 9px 8px;
  color: var(--teal-dark);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.simple-result-actions a + a,
.image-result-actions a + a {
  border-left: 1px solid var(--line);
}

.canvas-view {
  min-height: calc(100vh - 44px);
  display: grid;
  grid-template-columns: 138px minmax(520px, 1fr) 320px;
  gap: 14px;
}

.canvas-tools,
.canvas-stage,
.canvas-props {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.canvas-tools,
.canvas-props {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.canvas-tools button {
  width: 100%;
}

.tool-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-tools {
  display: grid;
  grid-template-columns: 1fr;
}

.node-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.node-menu button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 8px;
}

.node-menu button:hover {
  background: #e8edf4;
}

.zoom-readout {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--ink);
  font-weight: 900;
}

.canvas-search {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.canvas-stage {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(520px, 1fr) auto;
  min-height: 700px;
}

.canvas-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

#canvasProjectName {
  max-width: 320px;
  border-color: transparent;
  background: #f4f7fb;
  font-weight: 900;
}

#canvasSaveStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.canvas-viewport {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  background:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    #111820;
  background-size: 28px 28px;
  cursor: grab;
}

.canvas-viewport.panning {
  cursor: grabbing;
}

.canvas-board {
  position: absolute;
  left: 0;
  top: 0;
  width: 1800px;
  height: 1100px;
  transform-origin: 0 0;
}

.canvas-nodes {
  position: absolute;
  inset: 0;
}

.workflow-node {
  position: absolute;
  width: 220px;
  border: 1px solid #3b4858;
  border-radius: 8px;
  background: #1f2933;
  color: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.24);
  z-index: 2;
  user-select: none;
  touch-action: none;
}

.workflow-node:hover,
.workflow-node.selected {
  border-color: #ffffff;
}

.workflow-node.selected {
  box-shadow: 0 0 0 3px rgba(19,123,128,0.42), 0 24px 50px rgba(0,0,0,0.34);
}

.workflow-node.dimmed {
  opacity: 0.26;
}

.node-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.node-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.node-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.node-kind {
  color: #aeb8c7;
  font-size: 12px;
  font-weight: 800;
}

.node-badge {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #dce6f3;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.node-body {
  min-height: 42px;
  color: #d9e1ea;
  font-size: 13px;
  line-height: 1.42;
  word-break: break-word;
}

.node-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.node-meta span {
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #b9c6d4;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
}

.workflow-node[data-node-type="text"] {
  border-left: 4px solid #d4a017;
}

.workflow-node[data-node-type="image"],
.workflow-node[data-node-type="image-gen"] {
  border-left: 4px solid var(--teal);
}

.workflow-node[data-node-type="video"],
.workflow-node[data-node-type="video-gen"] {
  border-left: 4px solid var(--blue);
}

.workflow-node[data-node-type="audio"] {
  border-left: 4px solid var(--rose);
}

.workflow-node[data-node-type="character"],
.workflow-node[data-node-type="scene"],
.workflow-node[data-node-type="storyboard"],
.workflow-node[data-node-type="merge"] {
  border-left: 4px solid #7a5fb8;
}

.node-port {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border: 2px solid #111820;
  border-radius: 50%;
  background: #dce6f3;
  color: #111820;
  font-size: 11px;
  font-weight: 900;
  padding: 0;
}

.node-port:hover,
.node-port.active {
  background: var(--teal);
  color: #ffffff;
}

.port-in {
  left: -15px;
}

.port-out {
  right: -15px;
}

.node-lines {
  position: absolute;
  inset: 0;
  width: 1800px;
  height: 1100px;
  pointer-events: none;
}

.node-lines path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(19,123,128,0.35));
}

.node-lines path.pending {
  stroke: var(--amber);
  stroke-dasharray: 8 8;
}

.canvas-minimap {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 138px;
  min-height: 76px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: rgba(17,24,32,0.78);
  color: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canvas-minimap span {
  color: #aeb8c7;
  font-size: 12px;
  font-weight: 800;
}

.canvas-reference-strip {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: #ffffff;
}

.edge-list,
.reference-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.edge-pill,
.reference-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  padding: 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.edge-pill button {
  border: 0;
  background: transparent;
  color: var(--rose);
  font-weight: 900;
  padding: 0;
}

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

.canvas-props label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.canvas-props textarea {
  min-height: 110px;
}

.canvas-props[aria-disabled="true"] {
  opacity: 0.72;
}

.compact-toggle {
  margin: 0;
}

.canvas-prop-actions {
  display: grid;
  gap: 8px;
}

/* 智能分镜：整体结构沿用站内浅色工作台，同时强化左右两步的操作顺序。 */
.storyboard-view {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid #25303d;
  border-radius: 12px;
  background:
    radial-gradient(circle at 85% 0%, rgba(29, 126, 133, 0.14), transparent 32%),
    #0d131b;
  color: #e7edf3;
  box-shadow: 0 20px 60px rgba(10, 18, 27, 0.18);
}

.storyboard-title {
  align-items: flex-end;
  margin-bottom: 14px;
}

.storyboard-title h2 {
  margin-bottom: 4px;
  color: #f4f8fb;
}

.storyboard-subtitle {
  max-width: 720px;
  margin: 0;
  color: #8e9baa;
  line-height: 1.6;
}

.storyboard-view .eyebrow {
  color: #43b7b2;
}

.storyboard-split-button {
  min-width: 112px;
  height: 40px;
}

.storyboard-split-button.loading::before,
.generate-shot-button.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: storyboard-spin 0.8s linear infinite;
}

@keyframes storyboard-spin {
  to {
    transform: rotate(360deg);
  }
}

.storyboard-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  gap: 14px;
  align-items: stretch;
}

.storyboard-script-panel,
.storyboard-results-panel {
  min-width: 0;
  min-height: 570px;
  border: 1px solid #2a3542;
  border-radius: 10px;
  background: #111923;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
}

.storyboard-script-panel {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.storyboard-results-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.storyboard-panel-heading {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #27323f;
  background: #151f2a;
}

.storyboard-panel-heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.storyboard-step {
  min-width: 28px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(55, 184, 179, 0.13);
  color: #64cbc7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.storyboard-panel-hint {
  color: #7f8d9d;
  font-size: 12px;
  white-space: nowrap;
}

.storyboard-agent-dock {
  padding: 12px 14px;
  border-bottom: 1px solid #27323f;
  background: #111923;
}

.storyboard-agent-dock.embedded {
  margin-top: 10px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.storyboard-split-dock {
  padding: 12px 14px;
  border-bottom: 1px solid #27323f;
  background:
    linear-gradient(135deg, rgba(55, 184, 179, 0.08), transparent 42%),
    #101923;
}

.storyboard-config-card,
.storyboard-advanced-panel {
  margin: 12px 14px 0;
  padding: 12px 14px;
  border: 1px solid #27323f;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(55, 184, 179, 0.055), transparent 48%),
    #101923;
}

.storyboard-config-card:first-of-type {
  margin-top: 14px;
}

.storyboard-script-card {
  padding-bottom: 0;
}

.storyboard-advanced-panel {
  background: #0f1720;
}

.storyboard-advanced-panel:last-child {
  margin-bottom: 14px;
}

.storyboard-advanced-panel summary {
  cursor: pointer;
  color: #aab7c6;
  font-size: 12px;
  font-weight: 900;
  user-select: none;
}

.storyboard-advanced-panel[open] summary {
  margin-bottom: 10px;
  color: #63cbc7;
}

.storyboard-agent-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.storyboard-agent-dock-head > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.agent-store-head-actions {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.agent-store-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #50c8a8;
  box-shadow: 0 0 0 4px rgba(80, 200, 168, 0.1), 0 0 12px rgba(80, 200, 168, 0.52);
}

.agent-store-count {
  color: #7f8d9d;
  font-size: 11px;
}

.agent-store-reload,
.shot-prompt-tools button {
  min-height: 27px;
  border: 1px solid #354354;
  border-radius: 6px;
  padding: 0 9px;
  background: #17222d;
  color: #9eacba;
  font-size: 11px;
  font-weight: 800;
}

.agent-store-reload.danger-lite {
  border-color: rgba(255, 122, 122, 0.38);
  color: #ffaaa5;
}

.agent-store-reload:hover,
.shot-prompt-tools button:hover {
  border-color: #3da9a5;
  color: #67d1cc;
}

.storyboard-agent-list {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 7px;
  scrollbar-width: thin;
}

.agent-store-empty {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  color: #728091;
  font-size: 12px;
}

.agent-store-chip {
  flex: 0 0 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #344253;
  border-radius: 7px;
  padding: 0 9px;
  background: #151f2a;
  color: #d8e0e7;
}

.agent-store-chip span {
  color: #728091;
  font-size: 10px;
}

.agent-store-chip strong {
  font-size: 12px;
}

.agent-store-chip:hover {
  border-color: #50647a;
  background: #1a2632;
}

.agent-store-chip.agent-type-character,
.shot-agent-chip.agent-type-character {
  border-color: rgba(77, 166, 255, 0.38);
}

.agent-store-chip.agent-type-scene,
.shot-agent-chip.agent-type-scene {
  border-color: rgba(72, 200, 151, 0.38);
}

.agent-store-chip.agent-type-voice,
.shot-agent-chip.agent-type-voice {
  border-color: rgba(190, 126, 255, 0.38);
}

.agent-store-chip.agent-type-style,
.shot-agent-chip.agent-type-style {
  border-color: rgba(245, 176, 65, 0.4);
}

.storyboard-agent-import {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid #27323f;
}

.storyboard-agent-import.compact {
  margin-top: 10px;
}

#storyboard-agent-paste {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid #344253;
  border-radius: 8px;
  padding: 9px 10px;
  background: #0f1720;
  color: #dfe7ee;
  font-size: 12px;
  line-height: 1.6;
}

#storyboard-split-agent-paste {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  border: 1px solid #344253;
  border-radius: 8px;
  padding: 9px 10px;
  background: #0f1720;
  color: #dfe7ee;
  font-size: 12px;
  line-height: 1.6;
}

#storyboard-split-agent-paste::placeholder {
  color: #647282;
}

#storyboard-split-agent-paste:focus {
  border-color: #3da9a5;
  box-shadow: 0 0 0 3px rgba(55, 184, 179, 0.12);
}

#storyboard-agent-paste::placeholder {
  color: #647282;
}

#storyboard-agent-paste:focus {
  border-color: #3da9a5;
  box-shadow: 0 0 0 3px rgba(55, 184, 179, 0.12);
}

.storyboard-agent-import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6f7d8d;
  font-size: 11px;
  line-height: 1.5;
}

.storyboard-control-label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: #7f8d9d;
  font-size: 11px;
  font-weight: 800;
}

.storyboard-control-label input,
.storyboard-control-label select,
.storyboard-control-label textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #344253;
  border-radius: 8px;
  padding: 0 10px;
  background: #0f1720;
  color: #dfe7ee;
}

.storyboard-control-label textarea {
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 1.65;
  resize: vertical;
}

.storyboard-control-label input::placeholder,
.storyboard-control-label textarea::placeholder {
  color: #647282;
}

.storyboard-control-label input:focus,
.storyboard-control-label select:focus,
.storyboard-control-label textarea:focus {
  border-color: #3da9a5;
  box-shadow: 0 0 0 3px rgba(55, 184, 179, 0.12);
}

.storyboard-selected-note {
  margin: 8px 0 0;
  color: #778698;
  font-size: 12px;
  line-height: 1.55;
}

.storyboard-mini-textarea {
  min-height: 76px;
}

.storyboard-model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 10px;
}

.storyboard-model-grid .api-key-field {
  grid-column: 1 / -1;
}

.storyboard-control-label.muted-control {
  opacity: 0.58;
}

#script-input {
  min-height: 310px;
  border-radius: 10px;
  padding: 14px 15px;
  background: #0f1720;
  color: #dfe7ee;
  line-height: 1.8;
}

#script-input::placeholder {
  color: #647282;
}

#script-input:focus {
  border-color: #3da9a5;
  box-shadow: 0 0 0 3px rgba(55, 184, 179, 0.12);
}

.storyboard-script-footer {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 12px;
  border-top: 0;
  color: #7f8d9d;
  font-size: 12px;
  line-height: 1.45;
}

#storyboard-status {
  color: #58c3bf;
  font-weight: 800;
  text-align: right;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}

.storyboard-card-grid {
  flex: 1;
  align-content: start;
  overflow: auto;
  padding: 12px;
  background:
    linear-gradient(rgba(12, 18, 26, 0.92), rgba(12, 18, 26, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, 0.035) 31px 32px);
}

.storyboard-result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #27323f;
  background: #0f1720;
}

.storyboard-result-toolbar.hidden {
  display: none;
}

.storyboard-result-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #8393a5;
  font-size: 12px;
}

.storyboard-result-info strong {
  color: #dbe5ef;
}

.storyboard-result-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.storyboard-result-actions button {
  min-height: 30px;
  border: 1px solid #354354;
  border-radius: 7px;
  padding: 0 10px;
  background: #16212c;
  color: #aebdcb;
  font-size: 12px;
  font-weight: 800;
}

.storyboard-result-actions button:hover {
  border-color: #3da9a5;
  color: #67d1cc;
}

.storyboard-empty-state {
  grid-column: 1 / -1;
  min-height: 460px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 36px;
  color: #7f8d9d;
  text-align: center;
}

.storyboard-empty-state p {
  max-width: 360px;
  margin: 0;
  line-height: 1.6;
}

.storyboard-empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border: 1px dashed #405061;
  border-radius: 14px;
  background: #151f2a;
  color: #55c1bd;
  font-size: 26px;
}

.storyboard-shot-card {
  min-width: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-radius: 10px;
  border-color: #2b3744;
  background: #151e28;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
}

.shot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid #2a3542;
  background: #19232e;
}

.shot-card-header strong {
  font-size: 15px;
  color: #f1f5f8;
}

.storyboard-shot-card .shot-card-badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(55, 184, 179, 0.14);
  color: #67d1cc;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shot-card-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.shot-agent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.shot-agent-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #3a4858;
  border-radius: 999px;
  padding: 2px 8px;
  background: #111923;
  color: #aeb9c4 !important;
  font-size: 10px;
  font-weight: 800;
}

.shot-agent-empty {
  color: #788697 !important;
  font-size: 11px;
}

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

.shot-field {
  display: grid;
  gap: 6px;
}

.shot-field > span {
  color: #8d9baa;
  font-size: 12px;
  font-weight: 800;
}

.shot-text-input {
  min-height: 260px;
  border-color: #334151;
  background: #0e151e;
  color: #dfe7ee;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.7;
}

.shot-prompt-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: -5px;
  color: #788697;
  font-size: 11px;
}

.storyboard-view select {
  border-color: #344253;
  background: #101822;
  color: #e2e8ee;
}

.storyboard-view select:focus,
.storyboard-view textarea:focus {
  border-color: #3da9a5;
  box-shadow: 0 0 0 3px rgba(61, 169, 165, 0.15);
}

.shot-preview {
  position: relative;
  min-height: 176px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #415164;
  border-radius: 8px;
  background: #0c131b;
  color: #778596;
  text-align: center;
}

.shot-preview img {
  width: 100%;
  height: 100%;
  min-height: 176px;
  max-height: 320px;
  display: block;
  object-fit: cover;
  background: #eef1f5;
}

.shot-preview-placeholder {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 22px;
}

.shot-preview-placeholder::before {
  content: "▧";
  color: #8b98a8;
  font-size: 28px;
}

.shot-preview.loading .shot-preview-placeholder::before {
  content: "";
  width: 24px;
  height: 24px;
  border: 3px solid #d7dee7;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: storyboard-spin 0.8s linear infinite;
}

.shot-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px 14px;
}

.storyboard-shot-card .shot-generate-status {
  min-width: 0;
  color: #8391a1;
  font-size: 12px;
  line-height: 1.4;
}

.generate-shot-button {
  flex: 0 0 auto;
  min-width: 100px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.library-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.library-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
  font-weight: 900;
}

.library-tabs button.active {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.library-empty {
  min-height: 160px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.library-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.05);
}

.library-preview {
  aspect-ratio: 16 / 10;
  background: #eef1f5;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-weight: 900;
}

.library-preview img,
.library-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.library-card-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-card-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace {
  min-width: 0;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pane-head,
.toolbar,
.section-head,
.toolbar-actions,
.toggle-row,
.chip-row,
.query-form,
.task-meta {
  display: flex;
  align-items: center;
}

.pane-head,
.section-head,
.toolbar {
  justify-content: space-between;
  gap: 16px;
}

.toolbar {
  min-height: 62px;
  padding: 0 0 6px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.compact h2 {
  font-size: 16px;
}

.api-config {
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(220px, 360px) minmax(220px, 360px);
  align-items: end;
  gap: 10px;
  flex: 1;
}

.api-config.image-only {
  grid-template-columns: minmax(260px, 420px);
}

.api-config label,
.storage-panel label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

label span,
.control-group > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  grid-column: 1 / -1;
}

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

input,
select {
  height: 38px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(19, 123, 128, 0.14);
}

.dropzone {
  min-height: 112px;
  border: 1px dashed #aeb8c7;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.dropzone.dragover {
  border-color: var(--teal);
  background: #eef9f8;
}

.dropzone input {
  display: none;
}

.drop-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e9f5f5;
  color: var(--teal);
  font-size: 24px;
  line-height: 1;
}

.url-form {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 72px auto;
  gap: 8px;
}

.storage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.storage-panel summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--ink);
}

.storage-panel label,
.storage-panel button,
.storage-panel .asset-name {
  margin-top: 10px;
}

.mode-switch {
  height: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.mode-switch button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
}

.mode-switch button:last-child {
  border-right: 0;
}

.mode-switch button.active {
  background: var(--ink);
  color: #ffffff;
}

.asset-list,
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asset-list {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.asset-group-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 2px 4px;
  color: var(--teal-dark);
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 900;
}

.asset-card,
.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.asset-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

.asset-card.referenced {
  border-color: rgba(19, 123, 128, 0.55);
  background: #f4fbfa;
}

.asset-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: #eef1f5;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-weight: 900;
}

.asset-thumb img,
.asset-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-title {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.asset-title strong,
.task-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-expiry {
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #eef6f6;
  color: var(--teal-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-expiry.urgent {
  background: #fff1f2;
  color: #be123c;
}

.asset-review-row {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.asset-review-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #9aa7b3;
  flex: 0 0 auto;
}

.asset-review-row.approved {
  color: var(--teal-dark);
}

.asset-review-row.approved .asset-review-dot {
  background: var(--teal);
}

.asset-review-row.processing {
  color: #725a12;
}

.asset-review-row.processing .asset-review-dot {
  background: var(--amber);
}

.asset-review-row.rejected,
.asset-review-row.failed {
  color: #a3313e;
}

.asset-review-row.rejected .asset-review-dot,
.asset-review-row.failed .asset-review-dot {
  background: #c3475a;
}

.asset-review-protocol {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 700;
}

.asset-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.asset-role-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.asset-role-select {
  min-width: 0;
  height: 30px;
  padding: 4px 26px 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.badge,
.summary-pill,
.chip,
.status-badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.badge {
  background: #eef1f5;
  color: var(--blue);
}

.badge.audio {
  color: var(--rose);
}

.badge.video {
  color: var(--amber);
}

.summary-pill {
  background: #edf4ff;
  color: var(--blue);
}

.compose-layout,
.status-layout {
  display: grid;
  gap: 18px;
}

.compose-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.status-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
}

.editor-surface,
.settings-surface,
.preview-surface,
.task-surface {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.admin-panel {
  margin-top: 18px;
}

.workspace-title.compact {
  margin-bottom: 12px;
}

.workspace-title.compact h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

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

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

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.admin-card-head div {
  display: grid;
  gap: 4px;
}

.admin-card-head span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

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

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

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #edf2f7;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
}

.status-pill.ok {
  background: #e7f7f4;
  color: var(--teal-dark);
}

.status-pill.warn {
  background: #fff3d9;
  color: #9a6415;
}

.status-pill.danger {
  background: #ffe9ec;
  color: #b43a4b;
}

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

.image-advanced summary {
  cursor: pointer;
  color: var(--teal-dark);
  font-weight: 900;
}

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

.textarea-wrap {
  position: relative;
  margin-top: 14px;
}

#promptInput {
  min-height: 230px;
}

.mention-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-height: 166px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(31, 41, 51, 0.14);
  z-index: 5;
  padding: 6px;
}

.mention-item {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 9px;
  color: var(--ink);
}

.mention-item:hover,
.mention-item.active {
  background: #edf7f7;
}

.chip-row {
  gap: 8px;
  flex-wrap: wrap;
  min-height: 34px;
  margin-top: 12px;
}

.chip {
  background: #f2f4f7;
  color: var(--ink);
}

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

.field-grid label,
.json-field,
.control-group,
.range-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

.prompt-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.segmented {
  height: 38px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

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

.segmented button:disabled {
  background: #f3f5f8;
  color: #a7b0bd;
}

.json-field {
  margin-top: 12px;
}

.range-field {
  margin-top: 12px;
}

.range-field input {
  padding: 0;
}

.range-field output {
  color: var(--teal);
  font-weight: 900;
}

#extraParams,
#imageExtraParams {
  min-height: 92px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

#negativePrompt {
  min-height: 82px;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c8d0dc;
  transition: background 0.16s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(31, 41, 51, 0.25);
  transition: transform 0.16s ease;
}

.switch input:checked + span {
  background: var(--teal);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.toggle-row {
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
}

.primary-button,
.solid-button,
.ghost-button,
.icon-button,
.mini-button,
.danger-button {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 12px;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.solid-button {
  color: #ffffff;
  background: var(--ink);
}

.ghost-button {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.icon-button,
.mini-button,
.danger-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.icon-button {
  width: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
}

.danger-button {
  min-height: 30px;
  color: #a3313e;
}

.hidden {
  display: none !important;
}

pre {
  margin: 12px 0 0;
  min-height: 258px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #151a21;
  color: #dce6ef;
  font: 12px/1.55 "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.query-form {
  margin-top: 12px;
  gap: 8px;
}

.task-list {
  margin-top: 12px;
}

.task-card {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-meta {
  justify-content: space-between;
  gap: 10px;
}

.status-badge {
  color: #ffffff;
  background: var(--blue);
}

.status-badge.pending {
  background: #6d7785;
}

.status-badge.processing,
.status-badge.running {
  background: var(--amber);
}

.status-badge.completed,
.status-badge.succeeded {
  background: var(--teal);
}

.status-badge.failed {
  background: var(--rose);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e5e9f0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--teal);
  transition: width 0.2s ease;
}

.task-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-links a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.task-video {
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.task-error {
  color: #a3313e;
  line-height: 1.45;
}

.image-result-list {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.image-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 132px;
}

.image-result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef1f5;
}

.image-result-card .image-result-actions a,
.image-result-card span {
  padding: 8px;
  color: var(--teal-dark);
  font-weight: 900;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: calc(22px + var(--site-footer-height));
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #1f2933;
  color: #ffffff;
  box-shadow: 0 18px 50px rgba(31, 41, 51, 0.2);
  z-index: 20;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 72px 300px minmax(0, 1fr);
  }

  .app-shell.asset-pane-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .compose-layout,
  .status-layout {
    grid-template-columns: 1fr;
  }

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

  .canvas-view,
  .storyboard-layout {
    grid-template-columns: 1fr;
  }

  .storyboard-script-panel,
  .storyboard-results-panel {
    min-height: auto;
  }

  .storyboard-model-grid {
    grid-template-columns: 1fr;
  }

  #script-input {
    min-height: 280px;
  }

  .canvas-tools {
    flex-direction: row;
    overflow: auto;
  }

  .canvas-tools button {
    min-width: 96px;
  }
}

@media (max-width: 820px) {
  :root {
    --site-footer-height: 86px;
  }

  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-brand h1 {
    font-size: 30px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.asset-pane-collapsed {
    grid-template-columns: 1fr;
  }

  .global-sidebar {
    min-height: auto;
    flex-direction: row;
    overflow: auto;
    padding: 10px;
  }

  .brand-mark {
    flex: 0 0 44px;
    margin: 0;
  }

  .global-sidebar button {
    min-width: 58px;
  }

  .asset-pane {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .simple-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .pane-head {
    align-items: stretch;
    flex-direction: column;
  }

  .storyboard-title,
  .storyboard-script-footer,
  .storyboard-panel-heading,
  .storyboard-result-toolbar,
  .storyboard-agent-import-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .storyboard-config-card,
  .storyboard-advanced-panel {
    margin-left: 10px;
    margin-right: 10px;
  }

  .storyboard-split-button {
    width: 100%;
  }

  .storyboard-panel-hint,
  #storyboard-status {
    text-align: left;
    white-space: normal;
  }

  .shot-grid,
  .shot-parameter-grid {
    grid-template-columns: 1fr;
  }

  .storyboard-result-actions {
    width: 100%;
  }

  .storyboard-result-actions button {
    flex: 1;
  }

  .api-config,
  .url-form,
  .field-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1;
  }
}
