:root {
  --ink: #111a18;
  --muted: #65736f;
  --line: #dbe4df;
  --paper: #eef3f1;
  --panel: #ffffff;
  --green: #16a06d;
  --green-dark: #063f31;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --cyan: #0ea5b7;
  --cyan-soft: #e8f8fb;
  --gold: #d7a23a;
  --gold-soft: #fff5d9;
  --coral: #dc5d45;
  --coral-soft: #fff0ec;
  --navy: #071714;
  --navy-2: #0f2924;
  --shadow: 0 18px 46px rgba(9, 31, 26, 0.12);
  --shadow-soft: 0 10px 28px rgba(9, 31, 26, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% -10%, rgba(22, 160, 109, 0.18), transparent 34vw),
    radial-gradient(circle at 86% 4%, rgba(14, 165, 183, 0.14), transparent 30vw),
    linear-gradient(180deg, #eaf2ef 0, var(--paper) 420px, #f8faf7 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(8, 44, 36, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 44, 36, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent 520px);
}

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

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.settings-toggle {
  margin-left: auto;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}

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

.brand-bar strong,
.brand-bar span {
  display: block;
}

.brand-bar strong {
  font-size: 20px;
}

.brand-bar span {
  color: var(--muted);
  margin-top: 4px;
}

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

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

.brand-site {
  margin-left: auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(25, 115, 77, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--green-dark);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.brand-info-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(25, 115, 77, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdf8 0%, #f0f6ed 100%);
  padding: 12px;
}

.brand-info-card strong {
  color: var(--green-dark);
  font-size: 15px;
}

.brand-info-card span,
.brand-info-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.brand-info-card a {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.brand-service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brand-service-tags span {
  border: 1px solid rgba(25, 115, 77, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 850;
}

.auth-brand-card {
  margin-top: 8px;
}

.admin-only {
  display: none !important;
}

body.auth-admin .admin-only {
  display: inline-flex !important;
}

body.auth-anonymous main > :not(.brand-bar):not(.auth-panel),
body.auth-pending main > :not(.brand-bar):not(.review-panel),
body.auth-service-pending main > :not(.brand-bar):not(.review-panel) {
  display: none !important;
}

body.auth-active .auth-panel,
body.auth-active .review-panel,
body.auth-service-pending .auth-panel {
  display: none !important;
}

.account-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 8px 6px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.account-chip button {
  border: 0;
  border-radius: 999px;
  background: #eef3ed;
  color: var(--green-dark);
  padding: 7px 10px;
  font-weight: 850;
  cursor: pointer;
}

.auth-panel,
.review-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.58fr);
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 20px;
}

.review-panel {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
  max-width: none;
}

.review-brand-card {
  align-self: stretch;
}

.workspace-brand-card {
  grid-column: 1 / -1;
  grid-template-columns: minmax(160px, 0.5fr) minmax(0, 1fr) auto;
  align-items: center;
}

.workspace-brand-card p {
  margin: 0;
}

.auth-copy p,
.review-panel p {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
}

.auth-copy h1,
.review-panel h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-copy span,
.review-panel span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcf8;
}

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

.auth-tabs button,
.auth-form > button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  font-weight: 900;
  cursor: pointer;
}

.auth-tabs button.active,
.auth-form > button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.auth-form > button:disabled {
  cursor: progress;
  opacity: 0.68;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.auth-form span {
  display: block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-form span.auth-status-error {
  border-color: #efb0aa;
  background: #fff4f2;
  color: #c6281d;
  font-weight: 850;
}

.auth-form span.auth-status-success {
  border-color: #bad7c6;
  background: #f0f7f2;
  color: var(--green);
  font-weight: 850;
}

.auth-form span.auth-status-loading {
  border-color: var(--line);
  background: #f4f7f1;
  color: var(--muted);
  font-weight: 850;
}

.auth-form input[aria-invalid="true"] {
  border-color: #c6281d;
  box-shadow: 0 0 0 3px rgba(198, 40, 29, 0.12);
}

.workspace-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.68fr);
  gap: 12px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 12px;
}

.workspace-copy {
  display: grid;
  gap: 8px;
  align-content: center;
}

.workspace-copy p {
  margin: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.workspace-copy h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.workspace-copy span {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.55;
}

.workspace-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: stretch;
}

.workspace-metrics article {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 78px;
  border: 1px solid rgba(218, 226, 216, 0.92);
  border-radius: 8px;
  background: #f7faf4;
  padding: 14px;
}

.workspace-metrics strong {
  color: var(--green-dark);
  font-size: 20px;
  line-height: 1.2;
}

.workspace-metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.workflow-steps {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 244, 0.94);
  backdrop-filter: blur(10px);
  padding: 10px;
  margin-bottom: 14px;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(218, 226, 216, 0.95);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.step-chip.active {
  border-color: var(--green);
  background: #e7f1e7;
  color: var(--green-dark);
}

.step-chip.done {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.hero {
  margin-bottom: 14px;
}

.hero p,
.result-header p {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.task-panel,
.result-panel,
.settings-panel,
.reference-panel,
.script-panel,
.prompt-panel,
.compliance-panel,
.video-panel,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.settings-panel {
  padding: 18px;
  margin: -26px 0 28px;
}

.api-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px 14px;
  margin: -12px 0 24px;
}

.api-overview strong {
  color: var(--green-dark);
  margin-right: 4px;
}

.api-overview span {
  border: 1px solid rgba(218, 226, 216, 0.86);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 850;
}

.settings-header,
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.settings-header span,
.settings-actions span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.settings-header button,
.settings-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.settings-actions button {
  border-color: var(--green);
  background: #e7f1e7;
  color: var(--green-dark);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 12px;
  margin: 16px 0 14px;
}

.settings-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.settings-grid input,
.settings-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

.task-panel {
  padding: 18px;
}

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

.business-controls label {
  display: grid;
  grid-template-rows: auto 46px;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.business-controls select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  font-weight: 850;
}

.product-input {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  padding: 16px;
  resize: vertical;
  outline: none;
  font-weight: 650;
  line-height: 1.5;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 84, 0.12);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.action-row button,
.result-header button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.result-header > div {
  min-width: 0;
}

#confirmBtn {
  flex: 0 0 auto;
  min-width: 132px;
}

.result-header button:disabled {
  background: #c5cec7;
  cursor: not-allowed;
}

.result-header button.confirmed {
  background: var(--gold);
  color: var(--ink);
}

.action-row span {
  color: var(--muted);
  font-size: 14px;
}

.result-panel {
  margin-top: 14px;
  padding: 18px;
}

.result-header,
.reference-header,
.script-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  min-width: 0;
}

.result-header > div,
.reference-header > div,
.script-header > div {
  min-width: 0;
}

.result-header h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.script-panel {
  margin-top: 14px;
  padding: 18px;
}

.prompt-panel,
.compliance-panel,
.video-panel {
  margin-top: 14px;
  padding: 18px;
}

.history-panel {
  margin-top: 14px;
  padding: 18px;
}

.reference-panel {
  margin-top: 14px;
  padding: 18px;
}

.reference-header p {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 850;
}

.reference-header h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.reference-header span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.reference-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  text-align: right;
  flex-wrap: wrap;
  min-width: 0;
}

.reference-actions button {
  min-height: 40px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #fff7df;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.reference-actions button:disabled {
  border-color: var(--line);
  background: #f1f1ed;
  color: var(--muted);
  cursor: not-allowed;
}

.reference-actions button.confirmed {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.image-settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
  margin-bottom: 16px;
}

.asset-workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
  min-width: 0;
}

.asset-card {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: grid;
  gap: 14px;
  grid-template-rows: auto;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.asset-card > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.asset-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
  min-height: 0;
  min-width: 0;
}

.asset-card-head > div:first-child {
  min-width: 0;
}

.asset-card-head strong,
.asset-card-head span {
  display: block;
}

.asset-card-head strong {
  color: var(--green-dark);
  font-size: 18px;
}

.asset-card-head span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.asset-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-self: end;
}

.asset-actions button {
  max-width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.asset-actions button:first-child {
  border-color: var(--coral);
  background: #fff0ec;
}

.asset-actions button.confirmed {
  border-color: var(--green);
  background: #e7f1e7;
  color: var(--green-dark);
}

.asset-actions button:disabled {
  border-color: var(--line);
  background: #f1f1ed;
  color: var(--muted);
  cursor: not-allowed;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 118px;
  align-items: start;
}

.persona-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.persona-grid select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 24px 10px 10px;
  outline: none;
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.asset-cost-control {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(160px, 0.8fr) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  min-height: 68px;
  border: 1px solid rgba(218, 226, 216, 0.9);
  border-radius: 8px;
  background: #f7faf4;
  padding: 10px 12px;
  box-sizing: border-box;
}

.asset-cost-control label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-weight: 850;
}

.asset-cost-control select,
.asset-cost-static {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
}

.asset-cost-static {
  display: flex;
  align-items: center;
}

.asset-cost-control > span {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.product-view-manual-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.product-view-manual-options[hidden] {
  display: none;
}

.product-view-manual-options label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid rgba(9, 63, 49, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.product-view-manual-options input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

@media (max-width: 760px) {
  .asset-cost-control {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.generated-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #bbc7be;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.generated-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--generated-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
}

.generated-preview.has-image::before {
  opacity: 1;
}

.generated-preview.choice-preview {
  display: block;
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  align-self: start;
}

.generated-preview > span {
  position: relative;
  z-index: 1;
  padding: 16px;
}

.choice-grid {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  grid-auto-rows: 1fr;
}

#modelPreview .choice-grid,
#productPreview .choice-grid {
  align-items: stretch;
}

#modelPreview .choice-tile,
#productPreview .choice-tile {
  height: 100%;
}

.asset-progress {
  border: 1px solid rgba(218, 226, 216, 0.86);
  border-radius: 8px;
  background: #f2f6ef;
  padding: 10px 12px;
  margin-bottom: 12px;
  min-height: 58px;
  box-sizing: border-box;
}

.asset-progress-spacer {
  visibility: hidden;
  pointer-events: none;
}

.asset-progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.asset-progress-topline strong {
  color: var(--green-dark);
  font-size: 13px;
}

.asset-progress-topline span {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
}

.asset-progress-track {
  height: 10px;
  border: 1px solid rgba(18, 85, 58, 0.14);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.asset-progress-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-dark), var(--gold));
  transition: width 0.35s ease;
}

.choice-tile {
  position: relative;
  display: grid;
  grid-template-rows: auto 30px 48px;
  gap: 8px;
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  align-content: stretch;
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.asset-card .choice-tile {
  min-height: 0;
}

.asset-card .choice-tile {
  height: 100%;
}

.asset-card .choice-preview {
  width: 100%;
  overflow: hidden;
}

.choice-tile:disabled {
  cursor: not-allowed;
}

.choice-tile.readonly {
  cursor: default;
}

.choice-tile:not(.readonly):not(.placeholder):hover {
  border-color: #2f7f62;
  box-shadow: 0 12px 24px rgba(19, 74, 55, 0.12);
  transform: translateY(-2px);
}

.choice-tile-wrap {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.choice-tile-wrap .choice-tile {
  width: 100%;
  min-height: 100%;
}

.choice-download-btn {
  min-height: 34px;
  border: 1px solid rgba(13, 84, 55, 0.28);
  border-radius: 8px;
  background: #f6fbf7;
  color: var(--green-dark);
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.choice-download-btn:hover {
  background: #e8f3ea;
}

.choice-tile.placeholder {
  border-style: dashed;
  background: #fff;
  color: var(--muted);
}

.choice-tile.selected {
  border-color: #1677ff;
  background: #eef6ff;
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.14), 0 16px 28px rgba(22, 119, 255, 0.16);
  transform: translateY(-2px);
}

.choice-selected-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #1677ff;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.choice-image {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: auto;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  box-sizing: border-box;
  border-radius: 6px;
  background: #fff;
  background-image: var(--choice-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  padding: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.choice-tile.selected .choice-image {
  box-shadow: inset 0 0 0 3px rgba(22, 119, 255, 0.7);
}

.choice-image.empty {
  display: grid;
  place-items: center;
  border: 1px dashed #bbc7be;
  background: #fbfcf8;
}

.choice-image.empty::before {
  content: "";
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px dashed #bbc7be;
}

.choice-tile b {
  color: var(--green-dark);
  font-size: 14px;
  line-height: 1.2;
  align-self: end;
  display: grid;
  place-items: center;
  min-width: 0;
}

.choice-tile.selected b {
  color: #0b5cad;
}

.choice-tile small {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.25;
  align-self: start;
  display: -webkit-box;
  min-width: 0;
  min-height: 40px;
  max-width: 100%;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
}

.choice-tile.failure-tile small {
  min-height: 0;
  -webkit-line-clamp: 1;
}

.choice-tile.failure-tile {
  border-color: rgba(234, 93, 74, 0.5);
  background: #fff9f6;
}

.choice-tile.failure-tile b,
.choice-tile.failure-tile small {
  color: var(--coral);
}

.asset-error-note {
  margin: 10px 0 0;
  color: var(--coral);
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.choice-tile.selected small {
  color: #0b5cad;
  font-weight: 900;
}

.image-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  align-items: stretch;
  grid-auto-rows: auto;
}

.asset-card .image-upload-grid {
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  justify-content: start;
  align-items: start;
  align-self: start;
  margin: 0;
  overflow: visible;
  padding-bottom: 0;
}

.asset-card .image-slot {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
  min-height: 104px;
  height: 104px;
  max-height: 104px;
  aspect-ratio: 1 / 1;
  padding: 6px;
}

.asset-card details,
.asset-card summary,
.asset-card textarea,
.asset-card .asset-cost-control,
.asset-card .choice-grid,
.asset-card .generated-preview,
.asset-card .image-upload-grid,
.asset-card .asset-progress {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  clear: both;
}

.asset-card summary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-slot {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 104px;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 1px dashed #bbc7be;
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  padding: 10px;
}

.image-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--preview-image);
  background-position: center;
  background-size: cover;
  opacity: 0;
}

.image-slot.has-image::before {
  opacity: 1;
}

.image-slot.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 33, 29, 0.02), rgba(23, 33, 29, 0.28));
}

.image-slot input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-slot span,
.image-slot small {
  position: relative;
  z-index: 1;
}

.image-slot span {
  max-width: 100%;
  color: var(--ink);
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

.image-slot small {
  color: var(--muted);
  font-weight: 750;
}

.image-slot.has-image span,
.image-slot.has-image small {
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.image-slot.has-image span {
  display: none;
}

.image-slot.has-image small {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: calc(100% - 16px);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 92, 65, 0.88);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  text-shadow: none;
  transform: translateX(-50%);
}

.script-header p {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 850;
}

.script-header h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.script-header button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
}

.script-header button:disabled {
  background: #d6cfca;
  cursor: not-allowed;
}

.script-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.script-controls.direction-controls {
  grid-template-columns: minmax(150px, 0.7fr) repeat(3, minmax(0, 1fr));
}

.script-controls.direction-controls:has(.advanced-control) {
  grid-template-columns: minmax(180px, 0.8fr) repeat(3, minmax(0, 1fr));
}

.advanced-control {
  display: none !important;
}

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

.script-controls label {
  display: grid;
  grid-template-rows: auto 56px minmax(34px, auto);
  gap: 8px;
  align-content: start;
  color: var(--muted);
  font-weight: 800;
}

.script-controls input,
.script-controls select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  height: 56px;
  padding: 12px;
  outline: none;
  font: inherit;
  font-weight: 850;
}

.script-controls input:focus,
.script-controls select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 78, 0.12);
}

.script-controls small {
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.storyboard-settings-panel,
.video-task-log {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
  margin-bottom: 14px;
}

.storyboard-settings-head,
.video-task-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.storyboard-settings-head strong,
.video-task-log-head strong {
  display: block;
  color: var(--green-dark);
  font-size: 16px;
}

.storyboard-settings-head span,
#storyboardSettingsStatus {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.storyboard-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.storyboard-settings-grid label {
  display: grid;
  grid-template-rows: 22px 46px minmax(34px, auto);
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.storyboard-settings-grid .storyboard-setting-wide {
  grid-column: span 3;
  grid-template-rows: 22px auto;
}

.storyboard-settings-grid input,
.storyboard-settings-grid select,
.storyboard-settings-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  font: inherit;
  font-weight: 800;
  resize: vertical;
}

.storyboard-settings-grid input {
  height: 46px;
}

.storyboard-settings-grid select {
  height: 46px;
  appearance: auto;
}

.storyboard-settings-grid textarea {
  min-height: 82px;
  line-height: 1.5;
}

.storyboard-settings-grid input:focus,
.storyboard-settings-grid select:focus,
.storyboard-settings-grid textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 78, 0.12);
}

.script-status {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.script-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.script-grid.direction-focused {
  grid-template-columns: minmax(0, min(980px, 100%));
  justify-content: center;
  align-items: start;
}

.script-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffefa 0%, #fbfcf8 100%);
  padding: 14px;
  min-height: 300px;
  height: 100%;
  box-shadow: 0 8px 22px rgba(23, 33, 29, 0.06);
  min-width: 0;
}

.script-card.empty {
  grid-column: 1 / -1;
  min-height: 0;
  padding: 18px 20px;
  gap: 10px;
}

.script-grid:has(.script-card.empty) {
  display: block;
}

.script-card.selected,
.prompt-card.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.script-grid.direction-focused .script-card.selected {
  height: auto;
}

.direction-drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
}

.direction-drawer summary {
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 900;
}

.direction-drawer-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.direction-mini-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(218, 226, 216, 0.88);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.direction-mini-card strong {
  color: var(--green-dark);
}

.direction-mini-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.direction-mini-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.direction-mini-card.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.direction-mini-card.active .direction-select-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.direction-select-btn,
.prompt-select-btn,
.prompt-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 850;
  cursor: pointer;
}

.script-card.selected .direction-select-btn,
.prompt-card.selected .prompt-select-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.scene-image-box {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  height: auto;
  aspect-ratio: 9 / 16;
  border: 1px dashed rgba(93, 126, 110, 0.42);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  overflow: hidden;
  box-sizing: border-box;
}

.script-grid.direction-focused .scene-image-box:not(.has-image) {
  aspect-ratio: auto;
  min-height: 220px;
}

.scene-image-box.has-image {
  border-style: solid;
  background: #f8faf7;
}

.scene-image-box.failed {
  border-color: rgba(234, 93, 74, 0.55);
  background: #fff9f6;
  color: var(--coral);
}

.scene-image-box img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
  height: 100%;
  max-height: none;
}

.scene-generate-btn {
  margin-top: 0;
  min-height: 42px;
  border: 1px solid rgba(13, 84, 55, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--green-dark);
  font-weight: 850;
  cursor: pointer;
}

.scene-generate-btn:disabled {
  background: #f1f1ed;
  color: var(--muted);
  cursor: not-allowed;
}

.scene-error {
  margin: 0;
  color: var(--coral);
  font-weight: 800;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.prompt-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.prompt-actions button:last-child {
  border-color: transparent;
  background: var(--coral);
  color: #fff;
}

.compliance-panel .prompt-actions button:last-child {
  background: var(--green-dark);
}

#generateComplianceBtn:not(:disabled) {
  border-color: transparent;
  background: var(--coral);
  color: #fff;
}

.prompt-actions button:disabled {
  border-color: var(--line);
  background: #f1f1ed;
  color: var(--muted);
  cursor: not-allowed;
}

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

.prompt-card {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
  box-shadow: none;
}

.prompt-card.empty {
  grid-column: 1 / -1;
  min-height: 120px;
}

.prompt-shot-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.prompt-shot {
  position: relative;
  border: 1px solid rgba(218, 226, 216, 0.78);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
}

.prompt-shot-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: start;
}

.prompt-shot b {
  color: var(--green-dark);
  min-width: 0;
  line-height: 1.35;
}

.prompt-shot-delete {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(234, 93, 74, 0.42);
  border-radius: 50%;
  background: #fff6f3;
  color: var(--coral);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
}

.prompt-shot-delete:hover {
  border-color: var(--coral);
  background: var(--coral);
  color: #fff;
}

.prompt-shot p {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.prompt-subfield {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  border-top: 1px solid rgba(218, 226, 216, 0.72);
  padding-top: 8px;
}

.prompt-subfield.no-border {
  border-top: 0;
  margin-top: 4px;
  padding-top: 0;
}

.prompt-subfield b {
  color: var(--ink);
  font-size: 12px;
}

.prompt-subfield p {
  margin: 0;
  color: var(--muted);
}

.prompt-edit {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid rgba(218, 226, 216, 0.95);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  color: var(--muted);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.prompt-edit.compact {
  min-height: 54px;
}

.prompt-edit.full {
  min-height: 130px;
}

.prompt-edit:focus {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(23, 122, 83, 0.11);
  color: var(--ink);
}

.asset-prompt-editor {
  min-width: 0;
  border: 1px solid rgba(218, 226, 216, 0.9);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 10px 12px;
}

.asset-prompt-editor summary {
  cursor: pointer;
  color: var(--green-dark);
  font-weight: 850;
}

.asset-prompt-editor .prompt-edit {
  margin-top: 10px;
}

.asset-prompt-editor small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.prompt-panel .script-controls,
.compliance-panel .script-controls,
.video-panel .script-controls {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
}

.prompt-panel .script-status,
.compliance-panel .script-status,
.video-panel .script-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f6ef;
  padding: 12px 14px;
}

.script-card-head {
  display: grid;
  gap: 7px;
  padding: 2px 2px 12px;
  border-bottom: 1px solid var(--line);
  min-height: 0;
  min-width: 0;
}

.script-card-head small {
  width: fit-content;
  border: 1px solid #f1c46d;
  border-radius: 999px;
  background: #fff7df;
  color: var(--coral);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.script-card strong,
.script-card b {
  color: var(--green-dark);
}

.script-card strong {
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.script-card span,
.script-card p,
.script-card li {
  color: var(--muted);
  line-height: 1.55;
}

.script-card p {
  margin: 0;
}

.direction-field {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(218, 226, 216, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  padding: 10px;
  min-height: 118px;
  height: 118px;
  min-width: 0;
  overflow: hidden;
}

.direction-field.compact {
  background: #f2f6ef;
  min-height: 90px;
  height: 90px;
}

.direction-field b {
  font-size: 13px;
}

.storyboard-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(13, 84, 55, 0.18);
  border-radius: 8px;
  background: #f5f8f2;
  padding: 10px;
  min-height: 0;
  height: auto;
  align-content: start;
  min-width: 0;
  overflow: visible;
}

.storyboard-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid rgba(218, 226, 216, 0.88);
  padding-bottom: 8px;
}

.storyboard-panel-head b {
  color: var(--green-dark);
  white-space: normal;
  overflow-wrap: anywhere;
}

.storyboard-panel-head span,
.storyboard-meta span,
.storyboard-shot small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.storyboard-meta {
  display: grid;
  gap: 5px;
}

.storyboard-shots {
  display: grid;
  gap: 7px;
}

.storyboard-shot {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(218, 226, 216, 0.9);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px;
  min-height: 0;
}

.storyboard-shot strong {
  font-size: 13px;
}

.storyboard-shot p {
  font-size: 12px;
  margin: 0;
}

.direction-details {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(218, 226, 216, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  margin-top: auto;
}

.direction-details summary {
  cursor: pointer;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
}

.direction-details:not([open]) {
  gap: 0;
}

.direction-details[open] summary {
  margin-bottom: 2px;
}

.prompt-field {
  background: #17211d;
  border-color: #17211d;
}

.prompt-field b,
.prompt-field p {
  color: #fff7df;
}

.prompt-field p {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.compliance-grid {
  display: grid;
  gap: 12px;
}

.compliance-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

.compliance-card.empty {
  min-height: 118px;
}

.compliance-card strong {
  color: var(--green-dark);
  font-size: 18px;
}

.compliance-card p,
.compliance-card li {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.compliance-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  border: 1px solid #f1c46d;
  border-radius: 999px;
  background: #fff7df;
  color: var(--coral);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.risk-badge.low {
  border-color: #b8d7bf;
  background: #eff8f0;
  color: var(--green-dark);
}

.risk-badge.high {
  border-color: #f0b1a2;
  background: #fff1ed;
  color: #bf3e28;
}

.risk-list,
.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.risk-list li,
.check-list li {
  border: 1px solid rgba(218, 226, 216, 0.78);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.risk-list b,
.check-list b {
  color: var(--ink);
}

.risk-list li.modify-needed {
  border-color: #f0b1a2;
  background: #fff9f6;
}

.risk-list li.risk-confirmed {
  border-color: rgba(31, 122, 84, 0.5);
  background: #f5faf4;
}

.risk-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.risk-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf5;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 850;
}

.risk-pill.must {
  border-color: #f0b1a2;
  background: #fff1ed;
  color: #bf3e28;
}

.risk-confirmed .risk-pill {
  border-color: rgba(31, 122, 84, 0.4);
  background: #e7f1e7;
  color: var(--green-dark);
}

.risk-edit {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.risk-edit label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.risk-edit select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 850;
}

.risk-edit textarea {
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  font: inherit;
  line-height: 1.5;
}

.risk-edit textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: var(--blue);
}

.risk-confirm-btn {
  justify-self: start;
  min-height: 38px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: #e7f1e7;
  color: var(--green-dark);
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.risk-confirmed .risk-confirm-btn {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.compliance-actions-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f6ef;
  padding: 12px;
}

.video-settings-panel {
  margin: 0 0 18px;
  box-shadow: none;
}

.shot-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.shot-pick {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 10px;
  cursor: pointer;
}

.shot-pick.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.shot-pick input {
  width: 18px;
  height: 18px;
}

.shot-pick strong {
  color: var(--green-dark);
  font-size: 14px;
}

.shot-pick span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.video-task-log {
  background: #fffefa;
}

.video-task-log-head button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 850;
  cursor: pointer;
}

.video-task-log-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.task-log-entry {
  border: 1px solid rgba(218, 226, 216, 0.88);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.task-log-entry > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-log-entry time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-log-entry strong {
  color: var(--green-dark);
  font-size: 13px;
}

.task-log-entry p,
.task-log-entry small {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-log-entry.error {
  border-color: rgba(234, 93, 74, 0.45);
  background: #fff8f5;
}

.task-log-entry.error strong {
  color: #bf3e28;
}

.task-log-entry.warn {
  border-color: rgba(241, 196, 109, 0.75);
  background: #fff9e8;
}

.video-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
}

.history-card.empty {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
}

.history-card strong {
  display: block;
  color: var(--green-dark);
  font-size: 17px;
}

.history-card p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-card a,
.history-card button {
  min-height: 38px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: #e7f1e7;
  color: var(--green-dark);
  padding: 0 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.video-card.empty,
.script-card.empty,
.prompt-card.empty,
.compliance-card.empty,
.history-card.empty {
  background: linear-gradient(180deg, #fbfdf8 0%, #f4f8f2 100%);
}

.video-card.full-video-card {
  grid-column: 1 / -1;
}

.full-video-card .clip-candidates {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.video-card.empty {
  grid-column: 1 / -1;
  min-height: 118px;
}

.video-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.video-card-head strong {
  color: var(--green-dark);
}

.story-video-brief {
  display: grid;
  gap: 8px;
}

.story-video-brief div,
.video-reference-summary {
  border: 1px solid rgba(218, 226, 216, 0.78);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.story-video-brief b,
.video-reference-summary b {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.story-video-brief p,
.video-reference-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.storyboard-mini-shot-list {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(218, 226, 216, 0.78);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.storyboard-mini-shot-list span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.storyboard-mini-shot-list b {
  display: inline-block;
  margin-right: 6px;
  color: var(--green-dark);
}

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


.candidate-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.candidate-state-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.candidate-state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
}

.clip-candidate.status-draft .candidate-state-pill {
  border-color: rgba(230, 181, 71, 0.62);
  background: #fff8e6;
  color: #93650f;
}

.clip-candidate.status-submitting .candidate-state-pill,
.clip-candidate.status-submitted .candidate-state-pill {
  border-color: rgba(31, 95, 211, 0.32);
  background: var(--blue-soft);
  color: var(--blue);
}

.clip-candidate.status-completed .candidate-state-pill {
  border-color: rgba(25, 115, 77, 0.35);
  background: #e7f1e7;
  color: var(--green-dark);
}

.clip-candidate.status-not-submitted {
  border-color: rgba(207, 90, 66, 0.5);
  background: #fff8f5;
}

.clip-candidate.status-not-submitted .candidate-state-pill,
.clip-candidate.status-failed .candidate-state-pill {
  border-color: rgba(207, 90, 66, 0.5);
  background: #fff1ed;
  color: #b8452e;
}

.clip-candidate {
  display: grid;
  gap: 8px;
  border: 1px dashed #b8c8b7;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.clip-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 12px;
  border: 1px solid rgba(218, 226, 216, 0.78);
  border-radius: 8px;
  background: #f2f6ef;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.clip-preview.has-video {
  cursor: zoom-in;
}

.clip-preview strong,
.clip-preview span {
  display: block;
  max-width: 100%;
}

.clip-preview span {
  font-size: 14px;
  line-height: 1.35;
}

.clip-preview video {
  width: 100%;
  height: 100%;
  min-height: 120px;
  object-fit: cover;
  border-radius: 6px;
}

.mini-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.mini-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.25s ease;
}

.clip-candidate p,
.video-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.candidate-submit-btn,
.candidate-retry-btn,
.candidate-download-btn {
  justify-self: start;
  min-height: 34px;
  border: 1px solid #e85b43;
  border-radius: 8px;
  background: #fff8f4;
  color: #bf3e28;
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.candidate-submit-btn {
  border-color: rgba(13, 84, 55, 0.36);
  background: #eff8f0;
  color: var(--green-dark);
}

.candidate-download-btn {
  border-color: rgba(13, 84, 55, 0.36);
  background: #f2f8f1;
  color: var(--green-dark);
}

.candidate-retry-btn:hover {
  background: #fff1ea;
}

.candidate-download-btn:hover {
  background: #e7f1e7;
}

.candidate-submit-btn:hover {
  background: #e7f1e7;
}

.video-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(11, 27, 23, 0.72);
}

.video-preview-modal.open {
  display: flex;
}

.video-preview-panel {
  position: relative;
  width: min(920px, 92vw);
  max-height: 88vh;
  border-radius: 8px;
  background: #0b1b17;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.video-preview-panel video {
  display: block;
  width: 100%;
  max-height: 88vh;
  background: #000;
}

.video-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.script-card ol,
.script-card ul {
  margin: 0;
  padding-left: 18px;
}

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

.result-grid article {
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 16px;
}

#resultTitle[contenteditable="true"],
.result-grid li[contenteditable="true"] {
  border-radius: 6px;
  outline: none;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

#resultTitle[contenteditable="true"]:focus,
.result-grid li[contenteditable="true"]:focus {
  background: #eef6ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.14);
}

.result-grid li[contenteditable="true"] {
  padding: 2px 4px;
}

.result-grid strong,
.source-box strong {
  display: block;
  margin-bottom: 10px;
  color: var(--green-dark);
}

ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.source-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f6ef;
  padding: 14px 16px;
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-topline strong {
  margin-bottom: 0;
}

.progress-topline span {
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 900;
}

.analysis-progress-track {
  height: 14px;
  border: 1px solid rgba(18, 85, 58, 0.18);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  margin: 12px 0 10px;
}

.analysis-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-dark), var(--gold));
  transition: width 0.35s ease;
}

.source-box span {
  display: block;
  color: var(--muted);
  line-height: 1.5;
}

#analysisProgressText {
  display: inline;
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 900;
}

/* Modern product shell overrides */
.app-shell {
  width: min(1180px, calc(100% - 32px));
  padding: 18px 0 42px;
}

.brand-bar {
  position: sticky;
  top: 12px;
  z-index: 30;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(7, 23, 20, 0.96), rgba(15, 41, 36, 0.94));
  box-shadow: 0 18px 50px rgba(7, 23, 20, 0.18);
  color: #eefbf5;
  padding: 12px;
  backdrop-filter: blur(16px);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-color: rgba(255, 255, 255, 0.18);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 160, 109, 0.18);
}

.brand-bar strong {
  font-size: 18px;
  color: #fff;
}

.brand-bar span {
  color: rgba(234, 251, 245, 0.72);
  font-size: 12px;
}

.brand-site,
.account-chip {
  border-color: rgba(22, 160, 109, 0.36);
  background: rgba(255, 255, 255, 0.08);
  color: #c9f7e7;
}

.account-chip button {
  background: rgba(22, 160, 109, 0.16);
  color: #e7fff5;
}

.auth-panel,
.review-panel,
.workspace-panel,
.task-panel,
.result-panel,
.reference-panel,
.script-panel,
.prompt-panel,
.compliance-panel,
.video-panel,
.history-panel {
  border-color: rgba(9, 63, 49, 0.1);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.auth-panel,
.review-panel {
  overflow: hidden;
  min-height: 520px;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(7, 23, 20, 0.96), rgba(10, 54, 45, 0.9) 48%, #ffffff 48.2%);
}

.auth-copy,
.review-copy {
  padding: 32px;
}

.auth-copy p,
.review-panel p,
.workspace-copy p,
.hero p,
.result-header p,
.reference-header p,
.script-header p {
  letter-spacing: 0;
  text-transform: none;
}

.auth-copy p,
.review-copy p {
  color: #8be7c4;
}

.auth-copy h1,
.review-panel h2 {
  max-width: 720px;
  color: #fff;
  font-size: clamp(34px, 4.6vw, 58px);
}

.auth-copy span,
.review-copy span {
  max-width: 620px;
  color: rgba(239, 255, 248, 0.74);
}

.auth-form {
  align-self: center;
  margin: 24px 24px 24px 0;
  border-color: rgba(9, 63, 49, 0.12);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 56px rgba(7, 23, 20, 0.15);
}

.auth-tabs {
  padding: 4px;
  border: 1px solid rgba(9, 63, 49, 0.08);
  border-radius: 8px;
  background: #eef4f1;
}

.auth-tabs button {
  border-color: transparent;
  background: transparent;
}

.auth-tabs button.active,
.auth-form > button,
.action-row button,
.result-header button,
.script-header button,
.prompt-actions button:last-child {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  box-shadow: 0 12px 24px rgba(6, 63, 49, 0.18);
}

.auth-form input,
.business-controls select,
.script-controls input,
.script-controls select,
.storyboard-settings-grid input,
.storyboard-settings-grid select,
.storyboard-settings-grid textarea,
textarea {
  border-color: rgba(9, 63, 49, 0.14);
  background: #fbfdfc;
}

.brand-info-card {
  border-color: rgba(22, 160, 109, 0.18);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(232, 248, 251, 0.84));
  box-shadow: inset 3px 0 0 rgba(22, 160, 109, 0.72);
}

.auth-brand-card,
.review-brand-card {
  max-width: 620px;
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 3px 0 0 rgba(215, 162, 58, 0.9);
}

.auth-brand-card strong,
.auth-brand-card a,
.review-brand-card strong,
.review-brand-card a {
  color: #ffffff;
}

.auth-brand-card span,
.auth-brand-card p,
.review-brand-card span,
.review-brand-card p {
  color: rgba(239, 255, 248, 0.74);
}

.auth-brand-card .brand-service-tags span,
.review-brand-card .brand-service-tags span {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #e8fff7;
}

.workspace-panel {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.56fr);
  gap: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(7, 23, 20, 0.98), rgba(8, 54, 44, 0.94) 43%, rgba(255, 255, 255, 0.96) 43.2%);
}

.workspace-copy {
  min-height: 178px;
  padding: 10px 12px;
}

.workspace-copy p {
  color: #8be7c4;
}

.workspace-copy h1 {
  max-width: 680px;
  color: #fff;
  font-size: clamp(32px, 3.8vw, 50px);
}

.workspace-copy span {
  color: rgba(239, 255, 248, 0.76);
}

.workspace-metrics {
  gap: 8px;
}

.workspace-metrics article {
  border-color: rgba(9, 63, 49, 0.1);
  background: linear-gradient(180deg, #ffffff, #f4faf7);
}

.workspace-metrics strong {
  color: var(--green-dark);
  font-size: 18px;
}

.workspace-brand-card {
  grid-column: 1 / -1;
  border-color: rgba(14, 165, 183, 0.2);
  background: linear-gradient(90deg, #f7fbfa, #eef9fb);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.workflow-steps {
  top: 86px;
  display: flex;
  overflow-x: auto;
  border-color: rgba(9, 63, 49, 0.1);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  scrollbar-width: thin;
}

.step-chip {
  flex: 1 0 136px;
  border-color: rgba(9, 63, 49, 0.1);
  background: #f8fbfa;
}

.step-chip.active {
  border-color: rgba(22, 160, 109, 0.36);
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
}

.step-chip.done {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--blue-soft);
}

.api-overview {
  margin: 0 0 14px;
  border-color: rgba(14, 165, 183, 0.18);
  background: rgba(232, 248, 251, 0.72);
}

.api-overview span {
  border-color: rgba(14, 165, 183, 0.16);
}

.hero {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}

.hero h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.task-panel {
  display: grid;
  gap: 14px;
}

.product-input textarea {
  min-height: 128px;
}

.business-controls {
  margin-top: 0;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.action-row {
  margin-top: 0;
  border-top: 1px solid rgba(9, 63, 49, 0.08);
  padding-top: 14px;
}

.result-grid article,
.asset-card,
.script-card,
.prompt-card,
.compliance-card,
.video-card,
.history-card,
.storyboard-settings-panel,
.video-task-log {
  border-color: rgba(9, 63, 49, 0.1);
  background: linear-gradient(180deg, #ffffff, #f8fbfa);
}

.result-grid article {
  min-height: 150px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.asset-card {
  box-shadow: none;
}

.asset-card-head strong,
.result-grid strong,
.source-box strong,
.storyboard-settings-head strong,
.script-card strong,
.script-card b,
.history-card strong,
.video-card-head strong {
  color: var(--green-dark);
}

.reference-panel {
  border-top: 3px solid var(--gold);
}

.script-panel {
  border-top: 3px solid var(--coral);
}

.video-panel {
  border-top: 3px solid var(--cyan);
}

.history-panel {
  border-top: 3px solid var(--green);
}

.reference-header p {
  color: #a36f12;
}

.script-header p {
  color: var(--coral);
}

.reference-actions button {
  border-color: rgba(215, 162, 58, 0.42);
  background: var(--gold-soft);
}

.script-header button,
.prompt-actions button:last-child {
  background: linear-gradient(135deg, #9b3527, var(--coral));
}

.prompt-panel .script-controls,
.compliance-panel .script-controls,
.video-panel .script-controls,
.prompt-panel .script-status,
.compliance-panel .script-status,
.video-panel .script-status,
.source-box,
.asset-cost-control {
  border-color: rgba(9, 63, 49, 0.1);
  background: #f5faf8;
}

.choice-tile,
.image-slot,
.clip-candidate,
.story-video-brief div,
.video-reference-summary,
.storyboard-mini-shot-list {
  border-color: rgba(9, 63, 49, 0.12);
  background: #ffffff;
}

.choice-tile:not(.readonly):not(.placeholder):hover,
.user-action-hover {
  box-shadow: 0 16px 30px rgba(9, 63, 49, 0.14);
}

.analysis-progress-track span,
.asset-progress-bar,
.mini-progress span {
  background: linear-gradient(90deg, var(--green-dark), var(--cyan), var(--gold));
}

button,
a,
.choice-tile,
.image-slot,
.step-chip {
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

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

@media (max-width: 1800px) {
  .asset-card .image-upload-grid {
    grid-template-columns: repeat(4, minmax(82px, 1fr));
  }

  .asset-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 1280px) {
  .asset-card .image-upload-grid {
    grid-template-columns: repeat(4, minmax(76px, 1fr));
  }

  .asset-card .image-slot {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    min-height: 78px;
    height: 96px;
    max-height: 96px;
  }
}

@media (max-width: 900px) {
  .brand-bar {
    top: 8px;
  }

  .auth-panel,
  .review-panel,
  .workspace-panel {
    background: linear-gradient(180deg, rgba(7, 23, 20, 0.96), rgba(10, 54, 45, 0.92) 46%, rgba(255, 255, 255, 0.96) 46.2%);
  }

  .auth-form {
    margin: 0 20px 20px;
  }

  .review-brand-card {
    margin: 0 20px 20px;
  }

  .workspace-copy {
    min-height: 148px;
  }

  .workflow-steps {
    top: 78px;
  }

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

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

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

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

  .workflow-steps,
  .business-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-upload-grid,
  .asset-card .image-upload-grid {
    grid-template-columns: repeat(4, minmax(68px, 1fr));
  }

  .asset-card .image-slot {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
    min-height: 82px;
    height: 82px;
    max-height: 82px;
  }

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

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

  #modelPreview .choice-grid,
  #productPreview .choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .asset-workbench {
    grid-template-columns: 1fr;
  }

  .asset-card {
    grid-template-rows: auto;
  }

  .asset-card-head,
  .persona-grid {
    min-height: 0;
  }

  .asset-card-head {
    grid-template-columns: 1fr;
  }

  .asset-actions {
    justify-self: stretch;
  }

  .asset-actions button {
    width: 100%;
  }

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

  .script-controls.direction-controls,
  .script-controls.preset-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .video-grid,
  .clip-candidates {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 18px;
  }

  .brand-bar {
    position: relative;
    top: 0;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand-title {
    flex: 1 1 calc(100% - 58px);
  }

  .brand-title strong {
    font-size: 18px;
  }

  .brand-title span {
    white-space: normal;
    line-height: 1.35;
  }

  .brand-site {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .account-chip {
    order: 4;
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .auth-panel,
  .review-panel,
  .workspace-panel {
    min-height: 0;
    background: rgba(255, 255, 255, 0.94);
  }

  .auth-copy,
  .review-copy {
    padding: 20px;
    background: linear-gradient(135deg, rgba(7, 23, 20, 0.96), rgba(10, 54, 45, 0.92));
  }

  .auth-form {
    margin: 0;
    box-shadow: none;
  }

  .auth-brand-card,
  .review-brand-card {
    margin-top: 16px;
  }

  .review-brand-card {
    margin: 0;
  }

  .workspace-panel {
    padding: 0;
  }

  .workspace-copy {
    min-height: 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(7, 23, 20, 0.96), rgba(10, 54, 45, 0.92));
  }

  .workspace-metrics,
  .workspace-brand-card {
    margin: 0 14px;
  }

  .workspace-brand-card {
    margin-bottom: 14px;
  }

  .workflow-steps {
    position: static;
    display: grid;
    overflow: visible;
  }

  .action-row,
  .result-header,
  .reference-header,
  .script-header,
  .settings-header,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .prompt-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .reference-actions {
    align-items: stretch;
    flex-direction: column;
    text-align: left;
  }

  .result-grid,
  .persona-grid,
  .script-controls,
  .storyboard-settings-grid,
  .settings-grid,
  .workspace-metrics,
  .business-controls,
  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .workspace-panel {
    padding: 18px;
  }

  .auth-panel,
  .review-panel {
    padding: 20px;
  }

  .history-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .asset-card .image-slot {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 72px;
    max-height: none;
  }

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

  #modelPreview .choice-grid,
  #productPreview .choice-grid {
    grid-template-columns: 1fr;
  }

  .asset-card-head,
  .asset-actions {
    align-items: stretch;
  }

  .script-controls.direction-controls,
  .script-controls.preset-controls {
    grid-template-columns: 1fr;
  }

  .task-panel,
  .result-panel,
  .reference-panel,
  .script-panel,
  .prompt-panel,
  .compliance-panel,
  .video-panel,
  .history-panel {
    padding: 14px;
  }

  .hero h1,
  .workspace-copy h1,
  .auth-copy h1,
  .review-panel h2 {
    font-size: 28px;
  }

  .workflow-steps {
    gap: 6px;
    padding: 8px;
  }

  .step-chip {
    min-height: 34px;
    font-size: 12px;
  }
}

/* G pass final responsive polish */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.auth-panel,
.review-panel,
.workspace-panel {
  background: linear-gradient(135deg, rgba(7, 23, 20, 0.97), rgba(10, 54, 45, 0.93));
}

.workspace-copy h1,
.auth-copy h1,
.review-copy h2 {
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .auth-panel,
  .review-panel,
  .workspace-panel {
    background: rgba(255, 255, 255, 0.94);
  }
}

/* Commercial web UI polish */
:root {
  --ink: #111817;
  --muted: #64706d;
  --line: #d8e2dc;
  --paper: #f4f7f6;
  --panel: #ffffff;
  --green: #18a06f;
  --green-dark: #073b30;
  --blue: #2f6df6;
  --blue-soft: #edf4ff;
  --cyan: #16b7c8;
  --cyan-soft: #e8f8fb;
  --gold: #d6a037;
  --gold-soft: #fff7df;
  --coral: #d85a45;
  --coral-soft: #fff2ee;
  --shadow: 0 18px 42px rgba(12, 36, 32, 0.11);
  --shadow-soft: 0 10px 28px rgba(12, 36, 32, 0.075);
}

body {
  background:
    linear-gradient(180deg, rgba(9, 30, 27, 0.045) 0, rgba(244, 247, 246, 0) 340px),
    linear-gradient(120deg, #eef5f3 0%, #f8faf7 52%, #eef7fa 100%);
}

body::before {
  background-image:
    linear-gradient(rgba(7, 59, 48, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 109, 246, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.82), transparent 620px);
}

.app-shell {
  width: min(1400px, calc(100% - 32px));
}

.brand-bar {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(8, 22, 20, 0.98), rgba(8, 50, 42, 0.95) 58%, rgba(9, 69, 76, 0.94));
  box-shadow: 0 18px 42px rgba(5, 24, 21, 0.22);
}

.brand-site,
.account-chip {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.auth-panel,
.review-panel {
  min-height: min(620px, calc(100vh - 126px));
  background:
    linear-gradient(135deg, rgba(8, 22, 20, 0.98), rgba(9, 59, 48, 0.94) 46%, rgba(255, 255, 255, 0.98) 46.2%);
}

.auth-copy,
.review-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 100%;
}

.auth-copy h1,
.review-panel h2 {
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.04;
}

.auth-copy span,
.review-copy span {
  line-height: 1.62;
}

.auth-form {
  width: min(100%, 520px);
  justify-self: end;
}

.brand-info-card,
.workspace-brand-card,
.brand-footer {
  border-color: rgba(22, 183, 200, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 248, 251, 0.86));
  box-shadow: inset 3px 0 0 rgba(22, 183, 200, 0.82), var(--shadow-soft);
}

.auth-brand-card,
.review-brand-card {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.085);
  box-shadow: inset 3px 0 0 rgba(22, 183, 200, 0.9);
}

.auth-brand-card strong,
.auth-brand-card a,
.review-brand-card strong,
.review-brand-card a {
  color: #f3fff8;
}

.auth-brand-card span,
.auth-brand-card p,
.review-brand-card span,
.review-brand-card p {
  color: rgba(238, 251, 245, 0.76);
}

.auth-brand-card .brand-service-tags span,
.review-brand-card .brand-service-tags span {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #effff8;
}

.workspace-panel {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.7fr);
  gap: 16px;
  background:
    linear-gradient(135deg, rgba(8, 22, 20, 0.98), rgba(9, 58, 48, 0.94) 42%, rgba(255, 255, 255, 0.98) 42.2%);
}

.workspace-copy {
  min-height: 156px;
}

.workspace-metrics {
  align-self: center;
}

.workspace-metrics article {
  min-height: 70px;
  background: linear-gradient(180deg, #ffffff, #f3fbf8);
}

.workspace-brand-card {
  display: grid;
  grid-template-columns: minmax(120px, 0.25fr) minmax(0, 1fr) auto;
  gap: 10px;
  box-shadow: inset 3px 0 0 rgba(214, 160, 55, 0.88);
}

.workflow-steps,
.api-overview,
.task-panel,
.result-panel,
.reference-panel,
.script-panel,
.prompt-panel,
.compliance-panel,
.video-panel,
.history-panel {
  box-shadow: var(--shadow-soft);
}

.workflow-steps {
  top: 88px;
  padding: 8px;
}

.step-chip {
  min-height: 38px;
  flex-basis: 132px;
}

.hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.hero::after {
  content: "Maijia UGC Studio";
  justify-self: end;
  border: 1px solid rgba(22, 183, 200, 0.2);
  border-radius: 999px;
  background: rgba(232, 248, 251, 0.72);
  color: #0f6b75;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
}

.asset-workbench {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.asset-actions button {
  transform: none;
}

.image-upload-grid,
.asset-card .image-upload-grid {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.asset-card .image-slot {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.choice-image.empty,
.image-slot,
.scene-image-box:not(.has-image),
.clip-preview {
  background:
    linear-gradient(135deg, rgba(7, 59, 48, 0.035), rgba(22, 183, 200, 0.045)),
    linear-gradient(90deg, rgba(7, 59, 48, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(7, 59, 48, 0.055) 1px, transparent 1px),
    #fbfdfb;
  background-size: auto, 24px 24px, 24px 24px, auto;
}

.script-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.script-card {
  min-height: 0;
  height: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.script-grid.direction-focused {
  grid-template-columns: minmax(0, min(920px, 100%));
}

.scene-image-box:not(.has-image) {
  aspect-ratio: auto;
  min-height: 196px;
}

.script-grid.direction-focused .scene-image-box:not(.has-image) {
  min-height: 240px;
}

.scene-image-box span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(7, 59, 48, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 0 12px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
}

.storyboard-panel {
  background: linear-gradient(180deg, #f8fbfa, #eef8f8);
}

.storyboard-shot {
  grid-template-columns: minmax(90px, 0.28fr) minmax(0, 1fr);
  align-items: start;
}

.storyboard-shot small {
  grid-column: 1 / -1;
}

.video-grid,
.full-video-card .clip-candidates {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.brand-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  border: 1px solid rgba(22, 183, 200, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
}

.brand-footer strong,
.brand-footer span {
  display: block;
}

.brand-footer strong {
  color: var(--green-dark);
}

.brand-footer span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.brand-footer a {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 24px, 1400px);
  }

  .auth-panel,
  .review-panel,
  .workspace-panel {
    background: linear-gradient(180deg, rgba(8, 22, 20, 0.98), rgba(9, 58, 48, 0.94) 42%, rgba(255, 255, 255, 0.98) 42.2%);
  }

  .auth-form {
    justify-self: stretch;
    width: auto;
  }

  .workspace-panel,
  .asset-workbench,
  .workspace-brand-card,
  .brand-footer {
    grid-template-columns: 1fr;
  }

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

  .hero::after {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 16px, 1400px);
    padding-top: 10px;
  }

  .brand-bar {
    padding: 10px;
  }

  .auth-panel,
  .review-panel,
  .workspace-panel {
    padding: 0;
    background: #fff;
  }

  .auth-copy,
  .review-copy,
  .workspace-copy {
    padding: 16px;
  }

  .auth-brand-card,
  .review-brand-card {
    background: rgba(255, 255, 255, 0.1);
  }

  .auth-form,
  .workspace-metrics,
  .workspace-brand-card {
    margin: 0;
  }

  .task-panel,
  .result-panel,
  .reference-panel,
  .script-panel,
  .prompt-panel,
  .compliance-panel,
  .video-panel,
  .history-panel {
    padding: 12px;
  }

  .workflow-steps {
    gap: 6px;
    padding: 6px;
  }

  .scene-image-box:not(.has-image),
  .script-grid.direction-focused .scene-image-box:not(.has-image) {
    min-height: 156px;
  }

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

  .brand-footer {
    padding: 12px;
  }
}
