:root {
  --bg: #1a1a1a;
  --surface: #262626;
  --surface-2: #303030;
  --border: #333333;
  --text: #ededed;
  --muted: #9ca3af;
  --brand: #E56A4A;
  --brand-soft: #f4b59c;
  --green: #22c55e;
  --amber: #fbbf24;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; color-scheme: dark; }
body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(700px 380px at 8% -10%, rgba(229, 106, 74, .16), transparent 62%),
    radial-gradient(560px 320px at 98% 2%, rgba(244, 181, 156, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.app-loading {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: block;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.app-loading.booting {
  inset: 0;
  width: auto;
  display: grid;
  place-items: center;
  background: var(--bg);
  pointer-events: auto;
}
.app-loading[hidden],
.app-loading.booting[hidden] { display: none; }
.app-loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(38, 38, 38, .94);
  padding: 14px;
  box-shadow: 0 24px 90px -38px rgba(0, 0, 0, .9);
}
.app-loading.booting .app-loading-card {
  width: min(380px, calc(100vw - 48px));
  padding: 22px;
}
.app-loading-card strong,
.app-loading-card span:not(.brand-icon) { display: block; }
.app-loading-card span:not(.brand-icon) { margin-top: 5px; color: var(--muted); font-size: 13px; }
.loading-copy {
  min-width: 0;
  flex: 1;
}
.loading-meter {
  position: relative;
  overflow: hidden;
  height: 8px;
  margin-top: 12px;
  border: 1px solid rgba(229, 106, 74, .28);
  border-radius: 999px;
  background: rgba(26, 26, 26, .82);
}
.loading-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-soft));
  transition: width .22s ease;
}
.app-loading-card .loading-percent {
  margin-top: 7px;
  color: var(--brand-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
}

.app-shell {
  width: min(1440px, 100vw);
  height: 100vh;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.brand-block,
.status-dock,
.panel-title,
.icon-row,
.app-tabs,
.metric,
.socket-badge {
  display: flex;
  align-items: center;
}
.brand-block { gap: 12px; min-width: 0; }
.brand-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #a23f28);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 16px 36px -22px rgba(229, 106, 74, .9);
}
h1 { margin: 0; font-size: 24px; line-height: 1.1; letter-spacing: 0; }
p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.status-dock { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.metric,
.socket-badge,
.version-pill {
  min-height: 38px;
  border: 1px solid rgba(229, 106, 74, .3);
  border-radius: 999px;
  background: rgba(38, 38, 38, .8);
  color: var(--text);
  padding: 0 12px;
}
.metric { gap: 8px; }
.metric span { color: var(--brand-soft); }
.metric strong { color: var(--brand); }
.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 38px;
  border: 1px solid rgba(229, 106, 74, .3);
  border-radius: 999px;
  background: rgba(26, 26, 26, .72);
  padding: 3px;
}
.language-toggle button {
  min-width: 36px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.language-toggle button.active {
  border-color: rgba(229, 106, 74, .48);
  background: rgba(229, 106, 74, .18);
  color: #fff;
}
.language-toggle button:hover {
  color: var(--brand-soft);
}
.socket-badge { gap: 8px; }
.socket-badge span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}
.socket-badge.online span { background: var(--green); }
.socket-badge.offline span { background: var(--danger); }
.socket-badge em { font-style: normal; }
.version-pill { color: var(--brand-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 800; }

.app-tabs {
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(38, 38, 38, .72);
}
.tab {
  width: 44px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}
.tab.active {
  border-color: rgba(229, 106, 74, .45);
  background: rgba(229, 106, 74, .13);
  color: var(--brand-soft);
}
.workflow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.workflow-step {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(38, 38, 38, .78);
  color: var(--muted);
  padding: 8px 10px;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.workflow-step span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  font-weight: 900;
}
.workflow-step strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.workflow-step.done {
  border-color: rgba(34, 197, 94, .25);
  color: #bbf7d0;
}
.workflow-step.done span {
  background: rgba(34, 197, 94, .13);
  color: #bbf7d0;
}
.workflow-step.active {
  border-color: rgba(229, 106, 74, .52);
  background: rgba(229, 106, 74, .13);
  color: #fff;
}
.workflow-step.active span {
  background: var(--brand);
  color: #fff;
}

.view {
  height: 100%;
  min-height: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.view.active { display: grid; }
#workbenchView {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(430px, 1fr) minmax(210px, .36fr);
  gap: 16px;
  align-content: stretch;
  padding-right: 6px;
  padding-bottom: 28px;
  scroll-padding-bottom: 28px;
}
#reviewView {
  grid-template-columns: none;
  grid-template-rows: none;
  gap: 16px;
  align-content: start;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-right: 6px;
  padding-bottom: 28px;
  scroll-padding-bottom: 28px;
}
#reviewView.active { display: flex; }
#assetsView {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  padding-right: 6px;
  padding-bottom: 28px;
  scroll-padding-bottom: 28px;
}
#settingsView {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  align-items: start;
  padding-right: 6px;
  padding-bottom: 28px;
  scroll-padding-bottom: 28px;
}
.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(38, 38, 38, .92);
  box-shadow: 0 20px 80px -54px rgba(0, 0, 0, .9);
}
.wide-panel { padding-bottom: 14px; }
.panel-title {
  min-height: 52px;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(48, 48, 48, .72);
  font-weight: 800;
}
.panel-title > span { display: inline-flex; align-items: center; gap: 8px; }
.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  background: var(--brand);
}
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.icon-row { gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.result-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(17, 17, 17, .42);
  padding: 3px;
}
.icon-btn,
.chip-btn,
.cta-btn,
.zoom-reset-btn {
  border: 1px solid rgba(229, 106, 74, .35);
  border-radius: 7px;
  background: rgba(26, 26, 26, .7);
  color: var(--brand-soft);
}
.icon-btn {
  width: 36px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.zoom-reset-btn {
  min-width: 56px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
}
.result-zoom-controls .icon-btn {
  width: 28px;
  height: 28px;
}
.icon-btn.primary,
.chip-btn.active,
.cta-btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.icon-btn.danger {
  border-color: rgba(239, 68, 68, .42);
  color: #fecaca;
}
.icon-btn.danger:hover {
  background: rgba(239, 68, 68, .16);
}
.chip-btn {
  min-height: 32px;
  padding: 0 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.chip-btn.action-remove { border-color: rgba(239, 68, 68, .38); color: #fecaca; }
.chip-btn.action-extract { border-color: rgba(229, 106, 74, .42); color: var(--brand-soft); }
.chip-btn.action-keep { border-color: rgba(34, 197, 94, .34); color: #bbf7d0; }
.cta-btn {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.cta-btn span {
  flex: 0 0 auto;
  font-weight: 900;
}
.cta-btn:hover:not(:disabled),
.workflow-step:hover {
  border-color: rgba(244, 181, 156, .62);
  background: rgba(229, 106, 74, .13);
}
.cta-btn:disabled {
  border-color: var(--border);
  background: rgba(26, 26, 26, .55);
  color: rgba(156, 163, 175, .62);
}
.cta-btn.primary:disabled {
  background: rgba(229, 106, 74, .16);
  color: rgba(244, 181, 156, .55);
}
.review-action-bar {
  grid-column: 1 / -1;
  flex: 1 0 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(38, 38, 38, .9);
  padding: 10px 12px;
}
.next-step-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.next-step-copy strong {
  color: #f2e7df;
  font-size: 13px;
}
.next-step-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.review-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-grid,
.result-grid {
  height: calc(100% - 52px);
  display: grid;
  gap: 12px;
  padding: 12px;
}
.preview-grid { grid-template-columns: minmax(0, 1fr) 310px; }
#workbenchView .preview-grid { grid-template-columns: minmax(0, 1fr) 320px; }
.result-grid {
  grid-template-columns: 1fr 1fr;
  height: auto;
  overflow: visible;
}
.reference-map {
  grid-column: 1 / -1;
  min-height: 230px;
}
.preview-box {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #202020;
}
.preview-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.preview-box img[hidden] { display: none; }
.preview-label {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: grid;
  gap: 2px;
  max-width: calc(100% - 20px);
  border: 1px solid rgba(229, 106, 74, .32);
  border-radius: 7px;
  background: rgba(26, 26, 26, .78);
  padding: 7px 9px;
  pointer-events: none;
}
.preview-label strong {
  color: #f2e7df;
  font-size: 12px;
  line-height: 1.1;
}
.preview-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.reference-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.reference-overlay:empty { display: none; }
.reference-bbox {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  min-width: 44px;
  min-height: 28px;
  border: 2px solid var(--brand-soft);
  border-radius: 7px;
  background: rgba(229, 106, 74, .08);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .02);
}
.reference-bbox em {
  position: absolute;
  left: -2px;
  top: -25px;
  max-width: min(188px, calc(100vw - 44px));
  border: 1px solid rgba(244, 181, 156, .42);
  border-radius: 7px;
  background: rgba(17, 17, 17, .86);
  color: #fff;
  padding: 4px 7px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reference-bbox.is-right em { right: -2px; left: auto; }
.reference-bbox.is-low em { top: auto; bottom: -25px; }
.reference-bbox.action-remove {
  border-color: #f87171;
  background: rgba(239, 68, 68, .13);
}
.reference-bbox.action-remove em {
  border-color: rgba(248, 113, 113, .42);
  color: #fecaca;
}
.reference-bbox.action-extract {
  border-color: var(--brand-soft);
  background: rgba(229, 106, 74, .14);
}
.reference-bbox.action-extract em {
  color: var(--brand-soft);
}
.reference-bbox.action-keep {
  border-color: #4ade80;
  background: rgba(34, 197, 94, .12);
}
.reference-bbox.action-keep em {
  border-color: rgba(74, 222, 128, .36);
  color: #bbf7d0;
}
.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  color: rgba(244, 181, 156, .76);
  text-align: center;
  background: rgba(26, 26, 26, .24);
}
.preview-placeholder[hidden] { display: none; }
.preview-placeholder.quiet {
  grid-template-rows: auto auto;
  color: rgba(231, 222, 216, .82);
  background: rgba(22, 22, 22, .5);
}
.placeholder-icon {
  width: 64px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(244, 181, 156, .36);
  border-radius: 8px;
  background: rgba(26, 26, 26, .48);
  color: rgba(244, 181, 156, .78);
  font-size: 23px;
  font-weight: 900;
}
.preview-placeholder strong {
  color: #e7ded8;
  font-size: 13px;
  line-height: 1.2;
}
.preview-placeholder small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.analysis-box {
  overflow: auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
#workbenchView .mini-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.span-control { width: 100%; }
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #1f1f1e;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}
select:focus,
input:focus,
textarea:focus { border-color: rgba(229, 106, 74, .65); }
.scene-summary {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(26, 26, 26, .55);
  padding: 12px;
  color: #d6d3cf;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.scene-summary div,
.scene-summary strong {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.object-panel,
.prompt-panel,
.result-panel,
.asset-panel { min-height: 0; }
.object-panel {
  flex: .92 1 380px;
  max-width: 100%;
}
.result-panel {
  flex: 1.08 1 480px;
  max-width: 100%;
  --result-zoom: 1;
  --result-zoom-size: 100%;
}
.result-panel .preview-box {
  overflow: auto;
  scrollbar-gutter: stable;
  cursor: grab;
  touch-action: none;
}
.result-panel .preview-box.is-dragging { cursor: grabbing; }
.result-panel .preview-box img {
  width: var(--result-zoom-size);
  height: var(--result-zoom-size);
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}
.result-panel .reference-overlay {
  width: var(--result-zoom-size);
  height: var(--result-zoom-size);
  min-width: 100%;
  min-height: 100%;
}
.object-panel {
  display: grid;
  grid-template-rows: auto auto auto;
  align-self: start;
}
.object-decision-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
}
.decision-stat {
  min-width: 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: 28px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(26, 26, 26, .62);
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
}
.decision-stat span {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  font-weight: 900;
}
.decision-stat strong {
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
.decision-stat small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.decision-stat.danger { border-color: rgba(239, 68, 68, .28); }
.decision-stat.danger span { color: #fecaca; background: rgba(239, 68, 68, .12); }
.decision-stat.accent { border-color: rgba(229, 106, 74, .34); }
.decision-stat.accent span { color: var(--brand-soft); background: rgba(229, 106, 74, .14); }
.decision-stat.safe { border-color: rgba(34, 197, 94, .28); }
.decision-stat.safe span { color: #bbf7d0; background: rgba(34, 197, 94, .12); }
.object-grid {
  min-height: 0;
  overflow: visible;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(196px, max-content);
  align-content: start;
  gap: 12px;
}
.object-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas:
    "map head"
    "map outcome"
    "note note"
    "actions actions";
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1f1f1e;
  padding: 9px;
  min-height: 196px;
}
.object-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
  opacity: .78;
}
.object-card.action-remove::before { background: var(--danger); }
.object-card.action-extract::before { background: var(--brand); }
.object-card.action-keep::before { background: var(--green); }
.object-map {
  grid-area: map;
  position: relative;
  overflow: hidden;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(135deg, rgba(229, 106, 74, .11), rgba(34, 197, 94, .05)),
    #181818;
  background-size: 25% 100%, 100% 25%, auto, auto;
}
.object-map span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  min-width: 18px;
  min-height: 16px;
  border: 2px solid var(--brand-soft);
  border-radius: 5px;
  background: rgba(229, 106, 74, .18);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .15);
}
.object-head {
  grid-area: head;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.object-head div { min-width: 0; }
.object-head strong {
  display: block;
  min-width: 0;
  color: #f2e7df;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.object-card small { color: var(--muted); line-height: 1.35; }
.object-state {
  flex: 0 0 auto;
  max-width: 78px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  background: rgba(26, 26, 26, .72);
  color: var(--brand-soft);
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-remove .object-state { color: #fecaca; }
.action-keep .object-state { color: #bbf7d0; }
.object-outcome {
  grid-area: outcome;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 7px;
  background: rgba(26, 26, 26, .5);
  padding: 8px;
}
.object-outcome strong {
  color: #e7ded8;
  font-size: 12px;
  line-height: 1.2;
}
.object-note {
  grid-area: note;
  min-width: 0;
  min-height: 28px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 7px;
  background: rgba(17, 17, 17, .32);
  color: #cfc6bf;
  padding: 5px 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}
.object-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.object-actions button {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.object-actions button span {
  flex: 0 0 auto;
  font-weight: 900;
}
.object-actions button em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}
.object-actions button.active {
  background: rgba(229, 106, 74, .16);
  color: var(--brand-soft);
  border-color: rgba(229, 106, 74, .4);
}
.action-remove .object-actions button.active {
  background: rgba(239, 68, 68, .13);
  color: #fecaca;
  border-color: rgba(239, 68, 68, .42);
}
.action-keep .object-actions button.active {
  background: rgba(34, 197, 94, .12);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, .38);
}
.object-empty {
  grid-column: 1 / -1;
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed rgba(244, 181, 156, .25);
  border-radius: 8px;
  background: rgba(26, 26, 26, .42);
  color: var(--muted);
  text-align: center;
}
.object-empty span {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(229, 106, 74, .28);
  border-radius: 8px;
  color: var(--brand-soft);
  font-size: 20px;
}
.object-empty strong { color: #e7ded8; font-size: 13px; }
.object-empty small { color: var(--muted); font-size: 12px; }
.asset-panel {
  max-width: 100%;
}
.result-panel,
.asset-panel { align-self: start; }
.video-asset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 12px 0;
  align-items: end;
}
.count-pill {
  min-width: 34px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(229, 106, 74, .35);
  border-radius: 999px;
  background: rgba(26, 26, 26, .72);
  color: var(--brand-soft);
  font-size: 12px;
}
.asset-list {
  min-height: clamp(420px, calc(100vh - 360px), 760px);
  max-height: none;
  overflow: visible;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 12px;
}
.asset-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
}
.asset-summary-strip button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: #1f1f1e;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}
.asset-summary-strip button:hover,
.asset-summary-strip button.active {
  border-color: rgba(229, 106, 74, .5);
  background: rgba(229, 106, 74, .12);
}
.asset-summary-strip span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.asset-summary-strip strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}
.asset-status-line {
  border: 1px solid rgba(229, 106, 74, .18);
  border-radius: 8px;
  background: rgba(229, 106, 74, .08);
  color: #f2d4c9;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.35;
}
.asset-pagination {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: #191918;
  padding: 10px;
}
.asset-pagination-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.asset-pagination-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-pagination-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.asset-pagination-actions select {
  min-width: 118px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: #20201f;
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}
.asset-pagination-actions .icon-btn {
  width: 34px;
  height: 34px;
}
.asset-progress-panel {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(229, 106, 74, .22);
  border-radius: 8px;
  background: rgba(229, 106, 74, .07);
  padding: 10px;
}
.asset-progress-panel.done {
  border-color: rgba(64, 196, 121, .22);
  background: rgba(64, 196, 121, .06);
}
.asset-progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}
.asset-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #f4b08d);
  transition: width .22s ease;
}
.asset-progress-panel.done .asset-progress-track span {
  background: linear-gradient(90deg, var(--green), #a7f3d0);
}
.asset-progress-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.asset-progress-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-progress-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame-preview-panel {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: #191918;
  padding: 10px;
}
.asset-section-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.asset-section-title strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-section-title small {
  min-width: 30px;
  display: inline-flex;
  justify-content: center;
  border: 1px solid rgba(229, 106, 74, .25);
  border-radius: 999px;
  color: var(--brand-soft);
  font-size: 11px;
}
.frame-preview-strip {
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(132px, 164px);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.frame-preview-card {
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #20201f;
  padding: 7px;
}
.frame-preview-thumb {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 7px;
  background: #111;
}
.frame-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.frame-preview-thumb span {
  color: var(--brand-soft);
  font-size: 12px;
  font-weight: 900;
}
.frame-preview-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171717;
}
.asset-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}
.asset-table th,
.asset-table td {
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  padding: 8px 10px;
  color: #d8d5d1;
  font-size: 12px;
  text-align: left;
  vertical-align: middle;
}
.asset-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #20201f;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.asset-table th:nth-child(1),
.asset-table td:nth-child(1) { width: 78px; }
.asset-table th:nth-child(2),
.asset-table td:nth-child(2) { width: 88px; }
.asset-table th:nth-child(3),
.asset-table td:nth-child(3) { width: 210px; }
.asset-table th:nth-child(4),
.asset-table td:nth-child(4) { width: 260px; }
.asset-table th:nth-child(6),
.asset-table td:nth-child(6) { width: 72px; text-align: center; }
.asset-table strong,
.asset-table small,
.asset-table code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-table strong { color: var(--text); font-size: 12px; }
.asset-table small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.asset-table code {
  color: #c9c4bf;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.asset-row-thumb {
  overflow: hidden;
  width: 54px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 7px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%),
    #161616;
  background-size: 14px 14px;
  object-fit: contain;
}
.asset-thumb-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 0;
  color: inherit;
}
.asset-thumb-button:hover .asset-row-thumb,
.asset-thumb-button:hover .asset-thumb,
.asset-thumb-button:hover .frame-preview-thumb {
  border-color: rgba(229, 106, 74, .56);
  box-shadow: 0 0 0 1px rgba(229, 106, 74, .18);
}
.asset-thumb-button:focus-visible {
  outline: 2px solid rgba(229, 106, 74, .72);
  outline-offset: 3px;
}
.asset-export-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(229, 106, 74, .34);
  border-radius: 7px;
  background: rgba(229, 106, 74, .1);
  color: var(--brand-soft);
  font-size: 15px;
  font-weight: 900;
}
.asset-export-btn:hover {
  border-color: rgba(229, 106, 74, .64);
  background: rgba(229, 106, 74, .18);
  color: #fff7ed;
}
.asset-export-btn:focus-visible {
  outline: 2px solid rgba(229, 106, 74, .72);
  outline-offset: 2px;
}
.asset-row-thumb.empty {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.asset-status {
  display: inline-flex;
  min-width: 56px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(64, 196, 121, .13);
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 800;
}
.asset-status.review {
  background: rgba(245, 158, 11, .14);
  color: #facc15;
}
.asset-status.fail {
  background: rgba(239, 68, 68, .14);
  color: #fca5a5;
}
.asset-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.asset-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1f1f1e;
  padding: 8px;
}
.asset-thumb {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1.2;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 7px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.04) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.04) 75%),
    #171717;
  background-size: 18px 18px;
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.asset-thumb span {
  color: var(--brand-soft);
  font-size: 13px;
  font-weight: 900;
}
.asset-card strong,
.asset-card-footer strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-card-footer {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
}
.asset-card .asset-thumb-button {
  width: 100%;
  display: grid;
}
.prompt-panel textarea {
  height: calc(100% - 52px);
  border: 0;
  border-radius: 0;
  resize: none;
  line-height: 1.5;
}

.history-grid {
  padding: 14px;
  display: grid;
  gap: 12px;
}
.history-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.history-pagination {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: #191918;
  padding: 10px;
}
.history-pagination-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.history-pagination-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-pagination-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.history-pagination-actions select {
  min-width: 118px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: #20201f;
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}
.history-pagination-actions .icon-btn {
  width: 34px;
  height: 34px;
}
.history-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #1f1f1e;
}
.history-item img { width: 100%; height: 150px; object-fit: contain; background: #111; }
.history-item div { padding: 10px; font-size: 13px; color: #d6d3cf; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 14px 14px;
}
.settings-grid .panel-title { grid-column: 1 / -1; margin: 0 -14px; }
.settings-grid .span-2 { grid-column: span 2; }
.settings-essential,
.settings-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.settings-advanced {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1b1b1a;
}
.settings-advanced summary {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.settings-advanced summary::marker { color: var(--brand); }
.settings-advanced-grid { padding: 0 12px 12px; }

.log-title { gap: 12px; }
.log-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.log-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.log-tools select {
  width: 108px;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #171717;
  color: var(--text);
  padding: 0 8px;
  font-size: 12px;
}
.log-list {
  height: calc(100vh - 220px);
  overflow: auto;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #d6d3cf;
}
.log-line {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(51, 51, 51, .75);
  overflow-wrap: anywhere;
}
.log-line.error {
  border-left: 3px solid #e05a4f;
  background: rgba(224, 90, 79, .08);
}
.log-line.warn {
  border-left: 3px solid #d7a85a;
  background: rgba(215, 168, 90, .08);
}
.log-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.log-line strong { color: var(--brand-soft); }
.log-line span {
  min-width: 42px;
  color: #f0c7b9;
  font-weight: 800;
  text-transform: uppercase;
}
.log-line code {
  color: #9fbca9;
  background: rgba(143, 174, 154, .12);
  border: 1px solid rgba(143, 174, 154, .22);
  border-radius: 6px;
  padding: 2px 6px;
}
.log-line em {
  color: #f0ebe6;
  font-style: normal;
}
.log-line pre {
  margin: 8px 0 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(229, 106, 74, .18);
  border-radius: 8px;
  background: rgba(0, 0, 0, .24);
  color: #d6d3cf;
  padding: 9px;
}

.modal {
  border: 0;
  background: transparent;
  color: var(--text);
}
.modal::backdrop { background: rgba(0, 0, 0, .62); }
.modal-card {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .62);
}
.modal-card header,
.modal-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-card footer { border-top: 1px solid var(--border); border-bottom: 0; justify-content: flex-end; }
.update-lines {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 12px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}
.update-lines strong { color: var(--text); }
.modal-card pre {
  max-height: 280px;
  overflow: auto;
  margin: 0 14px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1a1a1a;
  padding: 12px;
  white-space: pre-wrap;
  color: #d6d3cf;
}
.asset-preview-card {
  width: min(920px, calc(100vw - 32px));
}
.asset-preview-frame {
  margin: 14px;
  min-height: 320px;
  max-height: min(68vh, 680px);
  display: grid;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.045) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.045) 75%),
    #151515;
  background-size: 20px 20px;
}
.asset-preview-frame img {
  max-width: 100%;
  max-height: min(64vh, 640px);
  object-fit: contain;
}
.asset-preview-card footer code {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .app-header { flex-direction: column; }
  .status-dock { justify-content: flex-start; }
  .workflow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-step:last-child { grid-column: 1 / -1; }
  #workbenchView,
  #reviewView,
  #assetsView,
  .preview-grid,
  .result-grid,
  .settings-grid { grid-template-columns: 1fr; }
  .review-action-bar { align-items: stretch; flex-direction: column; }
  .review-actions { justify-content: stretch; }
  .review-actions .cta-btn { flex: 1 1 180px; }
  .video-asset-row { grid-template-columns: 1fr; }
  .asset-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-pagination { align-items: stretch; flex-direction: column; }
  .asset-pagination-actions { justify-content: space-between; }
  .history-pagination { align-items: stretch; flex-direction: column; }
  .history-pagination-actions { justify-content: space-between; }
  .settings-essential,
  .settings-advanced-grid { grid-template-columns: 1fr; }
  .settings-grid .span-2 { grid-column: span 1; }
}
