:root {
  --shell: #f2f4f5;
  --nav: #fafbfb;
  --surface: #ffffff;
  --surface-soft: #f6f8f8;
  --surface-strong: #e9edef;
  --ink: #172023;
  --ink-soft: #3f4c51;
  --muted: #738086;
  --line: #dce2e4;
  --line-strong: #c8d1d4;
  --canvas: #171c1e;
  --canvas-soft: #202729;
  --canvas-line: #323b3e;
  --blue: #2864dc;
  --blue-soft: #eaf1ff;
  --teal: #008578;
  --teal-soft: #e3f5f1;
  --green: #16805a;
  --amber: #a66708;
  --amber-soft: #fff4d9;
  --red: #c84938;
  --red-soft: #fff0ed;
  --sidebar-width: 228px;
  --inspector-width: 318px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--shell);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--shell);
  color: var(--ink);
  font-size: 13px;
}

button,
input,
select,
textarea {
  border: 0;
  border-radius: 0;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(40, 100, 220, 0.34);
  outline-offset: 2px;
}

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

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.mobile-only[hidden] {
  display: none !important;
}

.icon-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 0;
}

.sidebar {
  position: relative;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--nav);
}

.brand {
  display: flex;
  height: 68px;
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border: 1px solid #b6d9d3;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
}

.brand-mark svg {
  width: 17px;
  height: 17px;
}

.brand > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.brand strong,
.brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 14px;
  font-weight: 720;
  line-height: 19px;
}

.brand span {
  color: var(--muted);
  font-size: 11px;
  line-height: 15px;
}

.primary-command {
  display: flex;
  min-height: 38px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 2px 12px 14px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  transition: background-color 140ms ease;
}

.primary-command:hover {
  background: #29363a;
}

.primary-command svg {
  width: 15px;
  height: 15px;
}

.main-nav {
  display: grid;
  flex: none;
  gap: 3px;
  padding: 0 9px 14px;
}

.nav-item {
  display: grid;
  min-height: 38px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  background: transparent;
  padding: 0 10px;
  color: var(--ink-soft);
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-item:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.nav-item.is-active {
  background: #e6ecee;
  color: var(--ink);
  font-weight: 700;
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-count {
  display: grid;
  min-width: 20px;
  height: 19px;
  place-items: center;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  font-weight: 750;
}

.recent-section {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.section-label {
  display: flex;
  height: 32px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 15px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
}

.recent-list {
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.recent-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 50px;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  border-radius: 6px;
  background: transparent;
  padding: 6px 5px 6px 8px;
  text-align: left;
}

.recent-item:hover,
.recent-item.is-active {
  background: var(--surface-strong);
}

.recent-item-main {
  min-width: 0;
}

.recent-item strong {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 670;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 13px;
}

.recent-meta svg {
  width: 11px;
  height: 11px;
}

.recent-open {
  width: 100%;
  min-width: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.recent-delete {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}

.recent-item:hover .recent-delete,
.recent-item.is-active .recent-delete {
  opacity: 1;
}

.recent-delete:hover {
  background: var(--red-soft);
  color: var(--red);
}

.recent-delete svg {
  width: 13px;
  height: 13px;
}

.sidebar-footer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 9px;
}

.worker-summary {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
}

.worker-row {
  display: grid;
  height: 27px;
  grid-template-columns: 7px 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 10px;
}

.worker-row svg {
  width: 13px;
  height: 13px;
}

.worker-row strong {
  color: var(--muted);
  font-size: 9px;
  font-weight: 680;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9c2c5;
  box-shadow: 0 0 0 3px rgba(185, 194, 197, 0.12);
}

.is-ready .status-dot,
.system-status.is-ready .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 128, 90, 0.12);
}

.is-busy .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(166, 103, 8, 0.12);
}

.is-offline .status-dot,
.system-status.is-offline .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 73, 56, 0.12);
}

.worker-row.is-ready strong {
  color: var(--green);
}

.worker-row.is-busy strong {
  color: var(--amber);
}

.worker-row.is-offline strong {
  color: var(--red);
}

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

.footer-actions button {
  display: flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 670;
}

.footer-actions button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.footer-actions svg {
  width: 13px;
  height: 13px;
}

.workspace {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.topbar {
  display: flex;
  height: 62px;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 0 18px;
}

.page-heading {
  min-width: 0;
  flex: 1;
}

.page-heading > span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  line-height: 13px;
}

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

.title-line h1 {
  overflow: hidden;
  margin: 1px 0 0;
  font-size: 15px;
  font-weight: 740;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-editor {
  width: min(460px, 60vw);
  height: 30px;
  border: 1px solid var(--blue);
  border-radius: 5px;
  background: var(--surface);
  padding: 0 8px;
  font-size: 14px;
  font-weight: 680;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-status {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
}

.icon-button,
.mini-icon-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 34px;
  height: 34px;
}

.mini-icon-button {
  width: 26px;
  height: 26px;
}

.icon-button:hover,
.mini-icon-button:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.mini-icon-button svg {
  width: 13px;
  height: 13px;
}

.view-host {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.app-view {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.create-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--inspector-width);
}

.creation-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.media-stage {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 320px;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #111617;
  border-radius: 8px;
  background: var(--canvas);
  color: #eef2f3;
  box-shadow: 0 12px 28px rgba(20, 29, 31, 0.14);
}

.stage-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  height: 46px;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--canvas-line);
  padding: 0 10px 0 14px;
}

.stage-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9ca9ad;
  font-size: 10px;
  font-weight: 680;
}

.stage-status.is-ready {
  color: #b9c6c9;
}

.stage-status.is-busy {
  color: #efc26f;
}

.stage-status.is-failed {
  color: #ff9b8f;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stage-action {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  color: #a7b3b6;
}

.stage-action:hover {
  background: #2a3235;
  color: #fff;
}

.stage-action svg {
  width: 15px;
  height: 15px;
}

.stage-content {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  flex: 1;
  place-items: center;
  overflow: hidden;
  padding: 18px;
}

.stage-empty {
  display: grid;
  justify-items: center;
  color: #809094;
}

.stage-empty-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #3a4548;
  border-radius: 8px;
  background: #202729;
  color: #50b9ae;
}

.stage-empty-mark svg {
  width: 20px;
  height: 20px;
}

.stage-empty strong {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 660;
}

.stage-media {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.stage-loading,
.stage-error {
  display: grid;
  width: min(420px, 90%);
  justify-items: center;
  color: #b5c0c3;
  text-align: center;
}

.stage-loading svg,
.stage-error svg {
  width: 24px;
  height: 24px;
  margin-bottom: 12px;
}

.stage-loading svg {
  color: #edbd65;
  animation: rotate 900ms linear infinite;
}

.stage-error svg {
  color: #ff8e81;
}

.stage-loading strong,
.stage-error strong {
  font-size: 13px;
}

.stage-loading p,
.stage-error p {
  margin: 6px 0 0;
  color: #7f8d91;
  font-size: 11px;
  line-height: 1.6;
}

.version-rail {
  display: flex;
  height: 68px;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--canvas-line);
  padding: 8px 10px 8px 14px;
}

.version-label {
  flex: none;
  color: #738287;
  font-size: 9px;
  font-weight: 720;
}

.version-list {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
}

.version-item {
  position: relative;
  display: grid;
  width: 49px;
  height: 49px;
  flex: none;
  place-items: center;
  overflow: hidden;
  border: 1px solid #3b474a;
  border-radius: 6px;
  background: #242c2f;
  color: #91a0a4;
}

.version-item.is-active {
  border-color: #7ba3ff;
  box-shadow: 0 0 0 1px #7ba3ff;
}

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

.version-item span {
  font-size: 10px;
  font-weight: 720;
}

.prompt-composer {
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(31, 44, 48, 0.08);
}

.prompt-composer.is-dragging {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 100, 220, 0.1);
}

.composer-attachments {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
}

.composer-attachment {
  position: relative;
  width: 54px;
  height: 54px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.composer-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-attachment button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(18, 25, 27, 0.78);
  color: #fff;
}

.composer-attachment button svg {
  width: 10px;
  height: 10px;
}

.prompt-input-row {
  display: grid;
  min-height: 58px;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: end;
  gap: 8px;
  padding: 10px;
}

.composer-button,
.generate-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 6px;
}

.composer-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.composer-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.generate-button {
  background: var(--ink);
  color: #fff;
}

.generate-button:hover {
  background: #2a373b;
}

.composer-button svg,
.generate-button svg {
  width: 16px;
  height: 16px;
}

#prompt {
  width: 100%;
  min-height: 36px;
  max-height: 126px;
  resize: none;
  background: transparent;
  padding: 8px 2px 6px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  outline: none;
}

#prompt::placeholder {
  color: #9aa5a9;
}

.composer-meta {
  display: flex;
  height: 24px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 0 11px;
  color: var(--muted);
  font-size: 9px;
}

.inspector {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.inspector-header {
  display: flex;
  height: 58px;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
}

.inspector-header span,
.inspector-header strong {
  display: block;
}

.inspector-header span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
}

.inspector-header strong {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 720;
}

.inspector-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.inspector-section {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 15px;
}

.control-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 740;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  padding: 2px;
}

.segment {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(31, 44, 48, 0.12);
}

#imageMode.is-active {
  color: var(--blue);
}

#videoMode.is-active {
  color: var(--teal);
}

.segment svg {
  width: 14px;
  height: 14px;
}

.readonly-field {
  display: grid;
  height: 42px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 0 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 670;
}

.readonly-field svg {
  width: 15px;
  height: 15px;
  color: var(--blue);
}

.readonly-field small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 620;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 680;
}

.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  outline: none;
}

.field select {
  height: 36px;
  padding: 0 8px;
}

.field textarea {
  min-height: 70px;
  resize: vertical;
  padding: 9px;
  line-height: 1.5;
}

.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
}

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

.toggle-list {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-row {
  position: relative;
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  padding: 7px 9px;
}

.toggle-row + .toggle-row {
  border-top: 1px solid var(--line);
}

.toggle-row > span {
  min-width: 0;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 670;
}

.toggle-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 520;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
}

.toggle-row i {
  position: relative;
  width: 32px;
  height: 18px;
  flex: none;
  border-radius: 9px;
  background: #ccd4d7;
  transition: background-color 140ms ease;
}

.toggle-row i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 140ms ease;
}

.toggle-row input:checked + i {
  background: var(--teal);
}

.toggle-row input:checked + i::after {
  transform: translateX(14px);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title-row > span:last-child {
  color: var(--muted);
  font-size: 9px;
}

.upload-field {
  display: flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 670;
}

.upload-field:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.upload-field svg {
  width: 14px;
  height: 14px;
}

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

.reference-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

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

.reference-item button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(19, 27, 29, 0.76);
  color: #fff;
}

.reference-item button svg {
  width: 10px;
  height: 10px;
}

.collection-view {
  overflow-y: auto;
  padding: 24px;
}

.collection-header {
  display: flex;
  width: min(100%, 1240px);
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 18px;
}

.collection-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 740;
}

.collection-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.collection-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collection-tools select,
.search-field {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
}

.collection-tools select {
  min-width: 112px;
  padding: 0 9px;
}

.search-field {
  display: grid;
  width: 220px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  padding: 0 8px;
}

.search-field svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  background: transparent;
  outline: none;
}

.filter-segments {
  display: flex;
  height: 36px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  padding: 2px;
}

.filter-segments button {
  min-width: 48px;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 670;
}

.filter-segments button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(31, 44, 48, 0.1);
}

.task-table-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.task-table-head,
.task-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 90px 100px minmax(120px, 0.5fr) 118px 44px;
  align-items: center;
  gap: 12px;
}

.task-table-head {
  height: 38px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 0 12px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
}

.task-row {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row:hover {
  background: #fbfcfc;
}

.task-identity {
  display: grid;
  min-width: 0;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: transparent;
  padding: 0;
  text-align: left;
}

.task-thumb {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--muted);
}

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

.task-thumb svg {
  width: 16px;
  height: 16px;
}

.task-copy {
  min-width: 0;
}

.task-copy strong,
.task-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-copy strong {
  font-size: 11px;
  font-weight: 680;
}

.task-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.media-chip,
.status-chip {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 5px;
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 9px;
  font-weight: 700;
}

.media-chip svg {
  width: 12px;
  height: 12px;
}

.media-chip.image {
  background: var(--blue-soft);
  color: var(--blue);
}

.media-chip.video {
  background: var(--teal-soft);
  color: var(--teal);
}

.status-chip.completed {
  background: #e8f5ef;
  color: var(--green);
}

.status-chip.pending,
.status-chip.dispatched {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-chip.failed {
  background: var(--red-soft);
  color: var(--red);
}

.task-worker,
.task-time {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
}

.task-actions button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.task-actions button:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.task-actions svg {
  width: 14px;
  height: 14px;
}

.asset-grid {
  display: grid;
  width: min(100%, 1240px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 auto;
}

.asset-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.asset-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(31, 44, 48, 0.1);
  transform: translateY(-1px);
}

.asset-media {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: #e9edef;
}

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

.asset-type {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  height: 24px;
  align-items: center;
  gap: 5px;
  border-radius: 5px;
  background: rgba(21, 28, 30, 0.78);
  padding: 0 7px;
  color: #fff;
  font-size: 9px;
  font-weight: 680;
}

.asset-type svg {
  width: 12px;
  height: 12px;
}

.asset-info {
  padding: 10px 11px 11px;
}

.asset-info strong,
.asset-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-info strong {
  font-size: 11px;
  font-weight: 680;
}

.asset-info span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.empty-collection {
  display: grid;
  min-height: 280px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.task-table-shell .empty-collection {
  min-height: 240px;
}

.load-more {
  display: block;
  min-width: 120px;
  height: 36px;
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 680;
}

.load-more:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.mobile-nav,
.mobile-only,
.sidebar-close,
.sidebar-backdrop,
.inspector-backdrop {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 27, 29, 0.58);
}

.dialog {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(18, 27, 29, 0.24);
}

.api-dialog {
  width: min(620px, 100%);
  max-height: calc(100dvh - 40px);
}

.dialog-header {
  display: flex;
  height: 66px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
}

.dialog-header span {
  display: block;
  color: var(--teal);
  font-size: 9px;
  font-weight: 740;
}

.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 740;
}

.dialog-body {
  max-height: calc(100dvh - 106px);
  overflow-y: auto;
  padding: 17px;
}

.api-field {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
}

.copy-field {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.api-field:nth-of-type(2) .copy-field {
  grid-template-columns: minmax(0, 1fr) 34px 34px;
}

.copy-field input {
  min-width: 0;
  background: transparent;
  padding: 0 10px;
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  outline: none;
}

.api-endpoints {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.api-endpoints > div {
  display: grid;
  min-height: 38px;
  grid-template-columns: 18px 42px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  background: var(--surface);
  padding: 0 10px;
}

.api-endpoints svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.api-endpoints span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 680;
}

.api-endpoints code {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 15px 0 8px;
}

.segmented.compact {
  width: 180px;
}

.button-secondary,
.primary-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 680;
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.button-secondary:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.primary-link {
  background: var(--ink);
  color: #fff;
}

.button-secondary svg,
.primary-link svg {
  width: 14px;
  height: 14px;
}

.code-block {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  border-radius: 6px;
  background: #192123;
  padding: 13px;
  color: #d9e2e4;
  font: 10px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.copy-status {
  min-height: 18px;
  padding-top: 6px;
  color: var(--green);
  font-size: 9px;
}

.inline-alert {
  margin-bottom: 12px;
  border: 1px solid #f0c2ba;
  border-radius: 6px;
  background: var(--red-soft);
  padding: 9px;
  color: var(--red);
  font-size: 10px;
}

.asset-dialog {
  display: grid;
  width: min(1040px, 100%);
  max-height: calc(100dvh - 40px);
  grid-template-columns: minmax(0, 1fr) 310px;
  background: var(--canvas);
}

.asset-preview {
  display: grid;
  min-height: 520px;
  place-items: center;
  overflow: hidden;
  padding: 18px;
}

.asset-preview img,
.asset-preview video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 76px);
  object-fit: contain;
}

.asset-detail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: var(--surface);
  padding: 18px;
}

.asset-detail header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.asset-detail header span {
  color: var(--teal);
  font-size: 9px;
  font-weight: 720;
}

.asset-detail h2 {
  margin: 3px 0 0;
  font-size: 15px;
}

.asset-detail > p {
  overflow: auto;
  margin: 24px 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.asset-detail dl {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.asset-detail dt,
.asset-detail dd {
  margin: 0;
}

.asset-detail dd {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-dialog-actions {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding-top: 24px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 150;
  display: grid;
  width: min(320px, calc(100vw - 36px));
  gap: 7px;
}

.toast {
  border: 1px solid #394548;
  border-radius: 6px;
  background: #1d2527;
  padding: 10px 12px;
  color: #f5f8f8;
  box-shadow: 0 10px 28px rgba(18, 27, 29, 0.2);
  font-size: 10px;
  animation: toast-in 160ms ease-out;
}

.sidebar-backdrop,
.inspector-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(19, 27, 29, 0.46);
}

.login-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: auto;
  background: var(--shell);
  padding: 24px;
}

.login-shell {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 30px;
  box-shadow: 0 18px 48px rgba(31, 44, 48, 0.11);
}

.brand-mark-large {
  width: 42px;
  height: 42px;
}

.login-heading {
  margin: 18px 0 24px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 9px;
  font-weight: 740;
}

.login-heading h1 {
  margin: 4px 0 0;
  font-size: 22px;
}

.login-form {
  display: grid;
  gap: 8px;
}

.field-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
}

.text-field {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 0 10px;
  outline: none;
}

.text-field:focus {
  border-color: var(--blue);
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
}

.button-primary {
  background: var(--ink);
  color: #fff;
}

.button-wide {
  width: 100%;
  margin-top: 10px;
}

.form-error {
  min-height: 18px;
  color: var(--red);
  font-size: 10px;
}

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

@keyframes toast-in {
  from {
    transform: translateY(5px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  :root {
    --inspector-width: 292px;
  }

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

  .task-table-head,
  .task-row {
    grid-template-columns: minmax(220px, 1fr) 82px 92px 110px 104px 40px;
    gap: 8px;
  }
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: min(280px, calc(100vw - 48px));
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block !important;
  }

  .sidebar-close,
  .mobile-only {
    display: inline-flex !important;
  }

  .icon-button.mobile-only,
  .sidebar-close {
    display: inline-grid !important;
  }

  .create-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .inspector {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 50;
    width: min(330px, calc(100vw - 36px));
    transform: translateX(102%);
    box-shadow: -16px 0 38px rgba(24, 34, 37, 0.2);
    transition: transform 180ms ease;
  }

  body.inspector-open .inspector {
    transform: translateX(0);
  }

  body.inspector-open .inspector-backdrop {
    display: block !important;
    z-index: 45;
  }

  .collection-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .collection-tools {
    width: 100%;
  }

  .search-field {
    flex: 1;
    width: auto;
  }

  .task-table-head {
    display: none;
  }

  .task-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
  }

  .task-row .media-chip,
  .task-row .task-worker,
  .task-row .task-time {
    display: none;
  }

  .asset-dialog {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 56px;
    min-height: 56px;
    padding: 0 10px;
  }

  .page-heading > span {
    display: none;
  }

  .title-line h1 {
    margin-top: 0;
    font-size: 13px;
  }

  .system-status {
    width: 30px;
    justify-content: center;
    padding: 0;
  }

  .system-status span:last-child {
    display: none;
  }

  .creation-main {
    gap: 8px;
    padding: 8px;
    padding-bottom: 70px;
  }

  .media-stage {
    min-height: 260px;
  }

  .stage-content {
    padding: 10px;
  }

  .version-rail {
    height: 60px;
    min-height: 60px;
  }

  .version-item {
    width: 42px;
    height: 42px;
  }

  #prompt {
    font-size: 16px;
  }

  .composer-meta {
    display: none;
  }

  .collection-view {
    padding: 16px 10px 78px;
  }

  .collection-header {
    gap: 14px;
    margin-bottom: 12px;
  }

  .collection-header h2 {
    font-size: 17px;
  }

  .collection-tools {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-field {
    min-width: 100%;
  }

  .collection-tools select {
    flex: 1;
  }

  .filter-segments {
    width: 100%;
  }

  .filter-segments button {
    flex: 1;
  }

  .task-row {
    min-height: 62px;
    padding: 8px;
  }

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

  .asset-info {
    padding: 8px;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 25;
    display: grid !important;
    height: 62px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-nav button {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
  }

  .mobile-nav button.is-active {
    color: var(--ink);
  }

  .mobile-nav svg {
    width: 17px;
    height: 17px;
  }

  .modal {
    align-items: end;
    padding: 8px;
  }

  .api-dialog {
    max-height: calc(100dvh - 16px);
  }

  .asset-dialog {
    display: flex;
    width: 100%;
    max-height: calc(100dvh - 16px);
    flex-direction: column;
  }

  .asset-preview {
    min-height: 280px;
    max-height: 50dvh;
  }

  .asset-detail {
    min-height: 270px;
  }

  .toast-region {
    right: 10px;
    bottom: 72px;
  }
}

@media (max-width: 430px) {
  .asset-grid {
    grid-template-columns: 1fr;
  }

  .asset-media {
    aspect-ratio: 16 / 11;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
