:root {
  --sidebar-bg: #111114;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: #ffffff;
  --sidebar-text: #a8a8b2;
  --sidebar-text-active: #18181b;
  --sidebar-width: 252px;
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-hover: #fafafa;
  --border: #e6e6e9;
  --border-light: #ededf0;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --ink-3: #71717a;
  --ink-4: #a1a1aa;
  --accent: #e30016;
  --accent-2: #27272a;
  --accent-soft: #fff0f1;
  --accent-hover: #c90014;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fff7e6;
  --purple: #52525b;
  --purple-soft: #f4f4f5;
  --cyan: #71717a;
  --cyan-soft: #f4f4f5;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 8px 24px rgba(24, 24, 27, 0.08);
  --shadow-card: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-float: 0 20px 56px rgba(24, 24, 27, 0.18);
  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 14px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar {
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--sidebar-bg);
  color: #fff;
}

.sidebar-brand {
  height: 82px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  gap: 10px;
}

.sidebar-brand .logo {
  width: 34px;
  height: 38px;
  flex: 0 0 34px;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-brand .logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand .brand-text {
  min-width: 0;
  gap: 3px;
}

.sidebar-brand .brand-name {
  overflow: hidden;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.sidebar-brand .brand-eyebrow {
  color: #6f6f79;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.sidebar-nav {
  gap: 0;
  overflow-y: auto;
  padding: 15px 12px;
  scrollbar-color: #3f3f46 transparent;
  scrollbar-width: thin;
}

.nav-group {
  margin-bottom: 17px;
}

.nav-group-label {
  height: 24px;
  padding: 0 10px;
  color: #666670;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nav-item {
  height: 41px;
  gap: 12px;
  margin: 0;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active,
.nav-item.active:hover {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

.nav-item.active::after {
  position: absolute;
  right: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.sidebar-agents {
  padding: 14px 22px;
  border-top-color: rgba(255, 255, 255, 0.07);
}

.sidebar-agents-title {
  color: #666670;
  font-size: 10px;
}

.agent-status-item,
.agent-dot {
  color: #8d8d96;
}

.agent-dot.online::before {
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.sidebar-bottom {
  padding: 14px 18px;
  border-top-color: rgba(255, 255, 255, 0.07);
}

.sidebar-bottom .avatar {
  border-radius: 9px;
  background: #27272a;
}

.sidebar-bottom .info-name {
  color: #d4d4d8;
}

.sidebar-bottom .info-meta {
  color: #71717a;
}

.main {
  background: var(--bg);
}

.page {
  width: min(2200px, 100%);
  margin: 0 auto;
  padding: 30px;
}

#page-create {
  width: 100%;
  max-width: none;
}

.page-header {
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header h1 {
  color: var(--ink);
  font-size: clamp(26px, 2.3vw, 34px);
  font-weight: 720;
  letter-spacing: -0.035em;
}

.page-header p {
  color: var(--ink-3);
  font-size: 14px;
}

.hero-banner {
  gap: 24px;
  padding: 20px;
  border: 1px solid #f3d1d5;
  border-radius: 14px;
  background: linear-gradient(115deg, #fff8f8 0%, #fff 62%);
  box-shadow: none;
  color: var(--ink);
}

.hero-banner::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  content: "";
}

.hero-eyebrow {
  color: #a20b18;
  font-size: 11px;
  font-weight: 700;
}

.hero-title {
  color: var(--ink);
  font-size: 24px;
}

.hero-subtitle {
  color: #6b5960;
}

.hero-stat {
  min-width: 110px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  backdrop-filter: none;
}

.hero-stat-label {
  color: var(--ink-3);
}

.hero-stat-value {
  color: var(--ink);
  font-size: 24px;
}

.card,
.kpi-card,
.agent-card,
.wf-agent-detail,
.settings-agent-card,
.section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-card);
  backdrop-filter: none;
}

.card,
.settings-agent-card,
.section,
.wf-agent-detail {
  padding: 20px;
}

.kpi-card {
  padding: 17px;
}

.kpi-card:hover {
  transform: none;
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.06);
}

.kpi-icon,
.agent-avatar,
.recent-icon,
.project-badge {
  border-radius: 9px;
}

.kpi-value {
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
}

.recent-row {
  border-radius: 8px;
}

.btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.btn-primary {
  height: 40px;
  padding: 0 16px;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
  filter: none;
  transform: none;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
}

.btn-outline {
  border-color: var(--border);
  background: #fff;
  color: var(--ink-2);
}

.btn-outline:hover {
  border-color: #d4d4d8;
  background: #f4f4f5;
  box-shadow: none;
  color: var(--ink);
}

.btn-ghost:hover {
  background: #f4f4f5;
  color: var(--ink);
}

.form-input,
.form-select,
.form-textarea,
.model-input,
.apikey-input {
  border-color: var(--border);
  border-radius: 9px;
  background: #fff;
}

.form-input,
.form-select {
  height: 40px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.model-input:focus,
.apikey-input:focus {
  border-color: #d5a2a8;
  box-shadow: 0 0 0 3px rgba(227, 0, 22, 0.06);
}

.radio-option label,
.file-upload-area,
.platform-card {
  border-color: var(--border);
  border-radius: 10px;
  background: #fff;
}

.radio-option input:checked + label {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.modal-overlay {
  background: rgba(24, 24, 27, 0.48);
  backdrop-filter: blur(3px);
}

.modal {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-float);
  backdrop-filter: none;
}

.modal-close {
  border-radius: 8px;
  background: #f4f4f5;
}

.settings-tabs {
  gap: 6px;
}

.settings-tab {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
}

.settings-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.platform-tab,
.btn-copy {
  border-color: var(--border);
  border-radius: 7px;
  background: #fff;
}

.toast {
  border: 1px solid #3f3f46;
  border-radius: 10px;
  background: #18181b;
  box-shadow: var(--shadow-md);
}

/* Guided production flow */
.detail-flow-shell {
  margin: 18px 0 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.detail-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.detail-flow-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 600;
}

.detail-flow-step:not(:last-child)::after {
  position: absolute;
  top: 14px;
  right: 12px;
  left: 42px;
  height: 1px;
  background: var(--border);
  content: "";
}

.detail-flow-dot {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-4);
  font-size: 11px;
}

.detail-flow-step.is-complete,
.detail-flow-step.is-current {
  color: var(--ink);
}

.detail-flow-step.is-complete .detail-flow-dot {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #15803d;
}

.detail-flow-step.is-complete:not(:last-child)::after {
  background: #86efac;
}

.detail-flow-step.is-current .detail-flow-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.detail-next-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border-left: 3px solid var(--accent);
}

.detail-next-label {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}

.detail-next-panel h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 17px;
}

.detail-next-panel p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

.detail-secondary {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.detail-secondary > summary {
  padding: 15px 18px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  list-style-position: inside;
}

.detail-secondary > .section {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  box-shadow: none;
}

.create-flow-shell {
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.create-flow-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 20px 13px;
}

.create-flow-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.create-flow-heading strong {
  color: var(--ink);
  font-size: 16px;
}

.create-flow-heading p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

.create-flow-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.create-flow-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  border-right: 1px solid var(--border);
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 600;
}

.create-flow-step:last-child {
  border-right: 0;
}

.create-flow-step i {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  font-size: 10px;
  font-style: normal;
}

.create-flow-step.is-current {
  background: var(--accent-soft);
  color: var(--accent);
}

.create-flow-step.is-current i {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.create-flow-step.is-complete {
  color: #15803d;
}

.create-flow-step.is-complete i {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.create-flow-step.is-error {
  background: #fef2f2;
  color: #b91c1c;
}

.create-flow-step.is-error i {
  border-color: #fecaca;
  color: #b91c1c;
}

.final-review {
  border-color: #e4e4e7;
  background: linear-gradient(180deg, #fff 0%, #fdfdfd 100%);
}

.final-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.final-review-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.final-review-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}

.final-review-head em {
  padding: 5px 9px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--ink-3);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.final-review-state {
  padding: 15px 16px;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #fafafa;
}

.final-review-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.final-review-state p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

.final-review-state.is-approved {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.final-review-state.is-approved strong {
  color: #166534;
}

.final-review-state.is-revision {
  border-color: #fde68a;
  background: #fffbeb;
}

.final-review-state.is-revision strong {
  color: #92400e;
}

.final-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.review-history {
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.review-history > summary {
  padding: 14px 0 2px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.review-history > summary span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  place-items: center;
  border-radius: 999px;
  background: #f4f4f5;
  font-size: 10px;
}

.review-history-item {
  display: grid;
  grid-template-columns: 54px minmax(130px, auto) 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.review-history-item > span {
  color: var(--accent);
  font-weight: 700;
}

.review-history-item strong {
  color: var(--ink-2);
}

.review-history-item p,
.review-history-item time {
  margin: 0;
  color: var(--ink-3);
}

.review-history-item time {
  font-size: 10px;
  white-space: nowrap;
}

.review-history-empty {
  padding: 16px 0 4px;
  color: var(--ink-4);
  font-size: 12px;
}

.review-modal {
  width: min(620px, calc(100vw - 32px));
}

.review-modal .modal-header > div p {
  margin: 4px 0 0;
  color: var(--ink-3);
  font-size: 12px;
}

.review-modal-version {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

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

.revision-scope-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.revision-scope-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 10%, transparent);
}

.revision-scope-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.revision-scope-option strong,
.revision-scope-option small {
  display: block;
}

.revision-scope-option strong {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 13px;
}

.revision-scope-option small,
.form-help {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.5;
}

.form-help {
  margin-top: 6px;
}

.graphic-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.graphic-image-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.graphic-image-item img {
  transition: transform .2s ease;
}

.graphic-image-item:hover img {
  transform: scale(1.015);
}

.graphic-region-edit-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 7px;
  background: rgba(20, 20, 22, .86);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease;
}

.video-result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#videoShotEditModal {
  align-items: center;
  padding: 16px;
}

.video-shot-edit-modal {
  display: flex;
  flex-direction: column;
  width: min(1040px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.video-shot-edit-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 20px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.video-shot-preview,
.video-shot-form {
  min-width: 0;
}

.video-shot-preview video {
  display: block;
  width: 100%;
  max-height: 390px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: #111;
}

.video-shot-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.video-shot-step-title > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
}

.video-shot-step-title strong,
.video-shot-step-title small {
  display: block;
}

.video-shot-step-title strong {
  color: var(--ink);
  font-size: 13px;
}

.video-shot-step-title small {
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 10px;
}

.video-shot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.video-shot-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.video-shot-card:hover,
.video-shot-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.video-shot-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border-radius: 7px;
  background: #f4f4f5;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 750;
}

.video-shot-card.active .video-shot-number {
  background: var(--accent);
  color: #fff;
}

.video-shot-copy {
  min-width: 0;
}

.video-shot-copy strong,
.video-shot-copy small {
  display: block;
}

.video-shot-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-shot-copy small {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-4);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.video-shot-reference-field {
  margin-top: 14px;
}

.video-shot-mode-field {
  margin-top: 14px;
}

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

.video-shot-mode-card {
  position: relative;
  cursor: pointer;
}

.video-shot-mode-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-shot-mode-card > span {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}

.video-shot-mode-card strong,
.video-shot-mode-card small {
  display: block;
}

.video-shot-mode-card strong {
  color: var(--ink);
  font-size: 11px;
}

.video-shot-mode-card small {
  color: var(--ink-4);
  font-size: 10px;
  line-height: 1.45;
}

.video-shot-mode-card input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.video-shot-mode-card input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.video-shot-safety-note {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #bce8dc;
  border-radius: 9px;
  background: #f0fbf7;
}

.video-shot-safety-note strong {
  color: #176b55;
  font-size: 11px;
}

.video-shot-safety-note span {
  color: #3d7668;
  font-size: 10px;
  line-height: 1.55;
}

.video-version-history {
  margin-top: 14px;
}

.graphic-image-item:hover .graphic-region-edit-btn,
.graphic-region-edit-btn:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.region-edit-modal {
  display: flex;
  flex-direction: column;
  width: min(1080px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.region-edit-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

#regionEditModal {
  align-items: center;
  padding: 16px;
}

.region-edit-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .72fr);
  gap: 16px;
}

.region-edit-pane {
  min-width: 0;
}

.region-edit-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 12px;
}

.region-edit-pane-head span {
  color: var(--ink-3);
  font-size: 11px;
}

.region-edit-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 9px;
}

.region-tool-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.region-tool-btn:hover,
.region-tool-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.region-tool-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.region-brush-size {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 11px;
}

.region-brush-size input {
  width: 88px;
  accent-color: var(--accent);
}

.region-canvas-wrap,
.region-preview-empty,
.region-compare {
  width: 100%;
  min-height: 330px;
  max-height: 58vh;
  margin-bottom: 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: #171719;
}

.region-canvas-wrap {
  display: grid;
  place-items: center;
  overflow: hidden;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.035) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.region-canvas-wrap > img,
.region-canvas-wrap > canvas {
  grid-area: 1 / 1;
  display: block;
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
}

.region-canvas-wrap > canvas {
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

.region-canvas-wrap > canvas[data-tool="brush"] {
  cursor: cell;
}

.region-canvas-wrap > canvas[data-tool="eraser"] {
  cursor: not-allowed;
}

.region-preview-pane {
  display: flex;
  flex-direction: column;
}

.region-preview-empty {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fafafa;
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
}

.region-compare {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.region-compare[hidden],
.region-compare-control[hidden] {
  display: none;
}

.region-compare > img {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
}

.region-compare-after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  clip-path: inset(0 50% 0 0);
}

.region-compare-after img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.region-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  transform: translateX(-1px);
  pointer-events: none;
}

.region-compare-divider::after {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(20,20,22,.72);
  color: #fff;
  content: '↔';
  transform: translate(-50%, -50%);
}

.region-compare-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 11px;
}

.region-compare-control input {
  width: 100%;
  accent-color: var(--accent);
}

.region-edit-instructions {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.region-edit-note {
  margin-top: 7px;
  color: #92400e;
  font-size: 11px;
  line-height: 1.55;
}

.region-edit-cost {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #f4d58c;
  border-radius: 9px;
  background: #fffaf0;
}

.region-edit-cost > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.region-edit-cost span,
.region-edit-cost p {
  color: #8a5a12;
  font-size: 11px;
}

.region-edit-cost strong {
  color: #9a3e00;
  font-size: 15px;
}

.region-edit-cost p {
  margin: 5px 0 0;
  line-height: 1.5;
}

.region-version-history {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

.region-version-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.region-version-history summary span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--ink-3);
  font-size: 10px;
  text-align: center;
}

.region-version-list {
  max-height: 190px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.region-version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.region-version-item:last-child {
  border-bottom: 0;
}

.region-version-item strong,
.region-version-item span {
  display: block;
}

.region-version-item strong {
  color: var(--ink);
  font-size: 11px;
}

.region-version-item span,
.region-version-empty {
  margin-top: 3px;
  color: var(--ink-4);
  font-size: 10px;
}

.region-version-empty {
  padding: 14px;
}

.region-edit-footer {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.region-edit-footer > span {
  color: var(--ink-3);
  font-size: 11px;
}

.region-edit-footer > div {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.shot-acceptance {
  border-color: rgba(226, 0, 26, 0.24);
  background: linear-gradient(180deg, rgba(226, 0, 26, 0.025), #fff 140px);
}

.shot-acceptance.is-accepted {
  border-color: rgba(20, 160, 96, 0.25);
  background: linear-gradient(180deg, rgba(20, 160, 96, 0.035), #fff 140px);
}

.shot-acceptance-head,
.shot-compare-grid article header,
.shot-acceptance-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.shot-acceptance-head span,
.shot-acceptance-note span,
.shot-acceptance-metrics span {
  color: var(--ink-4);
  font-size: 10px;
}

.shot-acceptance-head h3 {
  margin: 4px 0 2px;
  font-size: 17px;
}

.shot-acceptance-head p,
.shot-acceptance-note p {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
}

.shot-acceptance-head em {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}

.shot-acceptance.is-accepted .shot-acceptance-head em {
  background: #e9f8f0;
  color: #128152;
}

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

.shot-compare-grid article {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f1014;
}

.shot-compare-grid article header {
  padding: 9px 12px;
  background: #fff;
  font-size: 11px;
}

.shot-compare-grid article header span {
  color: var(--ink-4);
}

.shot-compare-grid video {
  display: block;
  width: 100%;
  height: min(36vh, 360px);
  background: #0f1014;
  object-fit: contain;
}

.shot-acceptance-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.shot-acceptance-metrics > div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.shot-acceptance-metrics strong,
.shot-acceptance-metrics span {
  display: block;
}

.shot-acceptance-metrics strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 11px;
}

.shot-acceptance-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
}

.shot-acceptance-note p {
  margin-top: 4px;
  color: var(--ink);
}

.shot-acceptance-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

::-webkit-scrollbar-thumb {
  background: #c7c7cc;
  background-clip: content-box;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 76px;
  }

  .sidebar-brand {
    padding: 16px 18px;
  }

  .nav-group-label {
    height: 14px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    text-align: center;
  }

  .nav-group-label::after {
    color: #4f4f57;
    font-size: 10px;
    content: "···";
  }

  .nav-item {
    justify-content: center;
    gap: 0;
    padding: 0;
    font-size: 0;
  }

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

  .nav-item.active::after {
    right: 7px;
  }

  .page {
    padding: 22px 20px;
  }
}

@media (max-width: 760px) {
  .graphic-region-edit-btn {
    opacity: 1;
    transform: none;
  }

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

  .video-shot-edit-body {
    grid-template-columns: 1fr;
  }

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

  .video-shot-mode-grid {
    grid-template-columns: 1fr;
  }

  .shot-compare-grid,
  .shot-acceptance-metrics {
    grid-template-columns: 1fr;
  }

  .shot-acceptance-head,
  .shot-acceptance-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .region-edit-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .region-edit-footer > div {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  :root {
    --sidebar-width: 64px;
  }

  .sidebar-brand {
    padding-inline: 15px;
  }

  .sidebar-brand .logo {
    width: 34px;
    height: 36px;
  }

  .page {
    padding: 18px 14px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .card,
  .settings-agent-card,
  .section,
  .wf-agent-detail {
    padding: 16px;
  }

  .detail-flow,
  .create-flow-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-flow-step {
    padding: 7px 0;
  }

  .detail-flow-step::after {
    display: none;
  }

  .detail-next-panel,
  .create-flow-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-next-panel .btn {
    justify-content: center;
    width: 100%;
  }

  .create-flow-step:nth-child(2) {
    border-right: 0;
  }

  .create-flow-step:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .review-history-item {
    grid-template-columns: 48px 1fr;
  }

  .review-history-item p,
  .review-history-item time {
    grid-column: 2;
  }

  .revision-scope-grid {
    grid-template-columns: 1fr;
  }

  .final-review-actions {
    flex-direction: column-reverse;
  }

  .final-review-actions .btn {
    justify-content: center;
    width: 100%;
  }
}
