:root {
  --ink: #11152f;
  --muted: #677089;
  --line: #dde2ee;
  --panel: #ffffff;
  --page: #f4f6fb;
  --blue: #3036d9;
  --navy: #090a2b;
  --pink: #ff2f72;
  --teal: #00aa8f;
  --yellow: #f3c744;
  --orange: #ff8266;
  --green: #208d68;
  --shadow: 0 16px 40px rgba(9, 10, 43, 0.08);
}

[hidden] {
  display: none !important;
}

/* AI image studio stays canvas-first without changing the rest of the platform. */
@media (max-width: 1180px) {
  .image-settings-panel {
    grid-template-columns: 1fr;
  }

  .image-poster-primary {
    width: min(320px, 48%);
  }

  .image-variant-stack {
    width: 112px;
  }
}

@media (max-width: 940px) {
  body.image-studio-active {
    overflow: auto;
  }

  .image-studio-toolbar {
    height: auto;
    min-height: 66px;
    align-items: flex-start;
    flex-direction: column;
    padding-block: 12px;
  }

  .image-studio-tools {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .image-studio-shell {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .image-artboard-area {
    min-height: 760px;
    border-top: 1px solid #e0e4ee;
    border-radius: 12px;
  }

  .image-settings-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid #e0e4ee;
    border-radius: 12px;
  }

  .image-settings-title,
  .image-reference-upload,
  .image-advanced-settings,
  .image-brand-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  body.image-studio-active .app-shell {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  body.image-studio-active .sidebar {
    position: sticky;
    height: 100vh;
    gap: 14px;
    padding: 15px 9px;
  }

  body.image-studio-active .brand,
  body.image-studio-active .sidebar-footer {
    justify-content: center;
  }

  body.image-studio-active .brand > div,
  body.image-studio-active .sidebar-footer > div,
  body.image-studio-active .nav-item span:last-child {
    display: none;
  }

  body.image-studio-active .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  body.image-studio-active .nav-list {
    grid-template-columns: 1fr;
  }

  body.image-studio-active .nav-item {
    justify-content: center;
    padding: 0;
  }

  body.image-studio-active .sidebar-footer {
    padding: 10px 5px;
  }

  .image-toolbar-button span,
  .image-studio-tools label > span {
    display: none;
  }

  .image-studio-tools {
    gap: 7px;
  }

  .image-studio-tools select {
    max-width: 142px;
  }

  .image-artboard-stage {
    min-height: 570px;
    align-items: flex-start;
    gap: 10px;
    padding: 24px 12px 104px;
  }

  .image-poster-primary {
    width: min(310px, 72%);
  }

  .image-variant-stack {
    width: 76px;
    gap: 8px;
  }

  .image-prompt-dock {
    height: auto;
    min-height: 82px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .image-prompt-dock textarea {
    grid-column: 2 / -1;
  }

  .image-polish-button {
    grid-column: 2;
  }

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

  .image-settings-title,
  .image-reference-upload,
  .image-advanced-settings,
  .image-brand-note {
    grid-column: auto;
  }

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

@media (max-width: 560px) {
  .image-studio-title h1 {
    font-size: 18px;
  }

  .image-studio-shell {
    padding-inline: 8px;
  }

  .image-poster-copy h2 {
    font-size: 18px;
  }

  .image-poster-brand,
  .image-poster-copy,
  .image-poster-meta,
  .image-poster footer {
    left: 16px;
    right: 14px;
  }

  .image-poster-brand {
    top: 15px;
  }

  .image-poster-meta {
    bottom: 42px;
    font-size: 7px;
  }

  .image-poster footer {
    bottom: 16px;
  }

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

  .image-history-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-history-meta > span {
    margin-right: 0;
  }
}

/* 3 + 2 flow: direction 3 is the entry screen, direction 2 is the editor. */
.image-editor-screen {
  height: 100%;
}

body.image-studio-active.image-studio-home {
  overflow: auto;
  background:
    radial-gradient(circle at 58% 0%, rgba(255, 255, 255, 0.96), rgba(245, 247, 253, 0.92) 54%, #eef1f8 100%);
}

body.image-studio-active.image-studio-home .workspace,
body.image-studio-active.image-studio-home .image-studio-view.active {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.image-start-screen {
  min-height: 100vh;
  padding: 24px 26px 42px;
  color: #11152d;
  background:
    radial-gradient(circle at 58% 0%, rgba(255, 255, 255, 0.98), rgba(247, 248, 253, 0.94) 52%, #f0f2f8 100%);
}

.image-start-header {
  max-width: 1280px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 18px;
}

.image-start-header > div:first-child > span {
  color: #777e94;
  font-size: 11px;
}

.image-start-header h1 {
  margin: 3px 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.image-start-header p {
  margin: 0;
  color: #80869b;
  font-size: 12px;
}

.image-start-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-start-outline,
.image-start-primary,
.image-start-side-card button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid #dfe3ef;
  border-radius: 8px;
  color: #161a38;
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.image-start-primary {
  color: #ffffff;
  border-color: #3d3be8;
  background: linear-gradient(135deg, #4f45ff, #3131d8);
  box-shadow: 0 7px 16px rgba(62, 58, 225, 0.2);
}

.image-start-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(62, 58, 225, 0.28);
}

.image-start-layout {
  max-width: 1280px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  gap: 18px;
  margin: 0 auto;
}

.image-start-main {
  min-width: 0;
}

.image-start-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 18px;
  padding: 17px 28px;
  list-style: none;
  border: 1px solid #dfe3ef;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 32px rgba(44, 49, 94, 0.07);
}

.image-start-steps li {
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #72788d;
}

.image-start-steps li:not(:last-child)::after {
  content: "";
  height: 1px;
  position: absolute;
  top: 16px;
  right: 13px;
  left: calc(100% - 18px);
  background: #dfe2ec;
}

.image-start-steps li > span {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #dce0eb;
  border-radius: 50%;
  background: #ffffff;
  font-size: 12px;
}

.image-start-steps strong,
.image-start-steps small {
  display: block;
}

.image-start-steps strong {
  font-size: 12px;
}

.image-start-steps small {
  margin-top: 3px;
  color: #999fb0;
  font-size: 9px;
  white-space: nowrap;
}

.image-start-steps li.active {
  color: #3d3be8;
}

.image-start-steps li.active > span {
  color: #ffffff;
  border-color: #3d3be8;
  background: linear-gradient(145deg, #4b43f3, #302ed2);
}

.image-start-quick-panel {
  display: grid;
  gap: 13px;
  margin-bottom: 18px;
  padding: 15px 16px 16px;
  border: 1px solid #dfe3ef;
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(247, 247, 255, 0.98), rgba(255, 255, 255, 0.98) 58%),
    #ffffff;
  box-shadow: 0 10px 28px rgba(44, 49, 94, 0.06);
}

.image-start-quick-panel > header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-start-quick-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #ffffff;
  border-radius: 8px;
  background: linear-gradient(145deg, #5a50f4, #3431d2);
  box-shadow: 0 7px 16px rgba(62, 58, 225, 0.2);
  font-size: 13px;
}

.image-start-quick-panel header > div:not(.image-start-selection-status) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.image-start-quick-panel header strong {
  font-size: 12px;
}

.image-start-quick-panel header small {
  color: #8a90a4;
  font-size: 9px;
}

.image-start-selection-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.image-start-selection-status > span,
.image-start-quick-panel header em {
  padding: 4px 8px;
  color: #504be4;
  border-radius: 999px;
  background: #ececff;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.image-start-selection-status > span {
  color: #687086;
  background: #f0f2f7;
}

.image-start-quick-fields {
  display: grid;
  grid-template-columns: 1.25fr 1.25fr 1fr auto;
  align-items: end;
  gap: 10px;
}

.image-start-quick-fields label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #5f667d;
  font-size: 9px;
  font-weight: 650;
}

.image-start-quick-fields input,
.image-start-quick-fields select {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 9px;
  color: #252a45;
  border: 1px solid #dce0eb;
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  font-size: 10px;
}

.image-start-quick-fields input:focus,
.image-start-quick-fields select:focus {
  border-color: #6562f2;
  box-shadow: 0 0 0 3px rgba(78, 75, 242, 0.09);
}

.image-start-quick-fields > button {
  height: 34px;
  min-height: 34px;
  white-space: nowrap;
}

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

.image-start-card {
  --template-accent: #667cff;
  --template-accent-rgb: 102, 124, 255;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #dfe3ef;
  border-radius: 11px;
  background: #ffffff;
  box-shadow: 0 6px 22px rgba(34, 38, 81, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.image-start-card[data-image-start-category="内容封面"] {
  --template-accent: #40c9bd;
  --template-accent-rgb: 64, 201, 189;
}

.image-start-card[data-image-start-category="社交配图"] {
  --template-accent: #df6dad;
  --template-accent-rgb: 223, 109, 173;
}

.image-start-card[data-image-start-category="会员增长"] {
  --template-accent: #f3a35b;
  --template-accent-rgb: 243, 163, 91;
}

.image-start-card[data-image-start-category="舞台视觉"] {
  --template-accent: #9b78ff;
  --template-accent-rgb: 155, 120, 255;
}

.image-start-card[data-image-start-category="品牌传播"] {
  --template-accent: #55a6ff;
  --template-accent-rgb: 85, 166, 255;
}

.image-start-card::before {
  content: "";
  height: 3px;
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  background: linear-gradient(90deg, var(--template-accent), rgba(var(--template-accent-rgb), 0.12));
}

.image-start-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(34, 38, 81, 0.09);
}

.image-start-card.selected {
  border-color: #4e4bf2;
  box-shadow: 0 0 0 1px #4e4bf2, 0 14px 28px rgba(65, 61, 225, 0.1);
}

.image-start-card-choice {
  width: 100%;
  min-width: 0;
  display: block;
  position: relative;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.image-start-card-choice:focus-visible {
  outline: 2px solid var(--template-accent);
  outline-offset: -3px;
}

.image-start-visual {
  height: 176px;
  position: relative;
  display: block;
  overflow: hidden;
  color: #ffffff;
  background: #0a0d37;
}

.image-start-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-start-visual i {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 8, 39, 0.84), rgba(9, 10, 50, 0.18)),
    linear-gradient(0deg, rgba(31, 22, 94, 0.34), transparent 62%);
}

.image-start-visual-wide i {
  background: linear-gradient(90deg, rgba(4, 8, 25, 0.3), rgba(3, 7, 27, 0.68));
}

.image-start-visual-light i {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0 48%, rgba(5, 8, 35, 0.1));
}

.image-start-visual > b,
.image-start-visual > small {
  position: absolute;
  left: 16px;
  z-index: 1;
}

.image-start-visual > b {
  bottom: 47px;
  max-width: 82%;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.image-start-visual > small {
  bottom: 25px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 8px;
}

.image-start-visual-light > b,
.image-start-visual-light > small {
  color: #101947;
}

.image-start-format {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.image-start-format b,
.image-start-format em {
  padding: 4px 7px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(8, 13, 30, 0.7);
  backdrop-filter: blur(10px);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.image-start-format b {
  color: #ffffff;
  background: rgba(var(--template-accent-rgb), 0.82);
}

.image-start-card.selected .image-start-visual::after {
  content: "当前模板";
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 2;
  padding: 5px 8px;
  color: #3130b8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 14px rgba(9, 12, 48, 0.12);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.image-start-copy {
  display: grid;
  gap: 6px;
  padding: 13px 14px 14px;
  background: #ffffff;
}

.image-start-copy > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-start-copy strong {
  font-size: 13px;
}

.image-start-copy > span > em {
  color: var(--template-accent);
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
}

.image-start-copy > small {
  min-height: 26px;
  color: #858b9d;
  font-size: 10px;
  line-height: 1.35;
}

.image-start-copy > b {
  color: #6f7589;
  font-size: 9px;
  font-weight: 550;
}

.image-start-card-footer {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px 7px 12px;
  border-top: 1px solid #eceef5;
  background: #fbfcff;
}

.image-start-card-footer > span,
.image-start-card-footer > button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.image-start-card-footer > span {
  color: #7b8195;
  font-size: 9px;
}

.image-start-card-footer svg {
  width: 12px;
  height: 12px;
}

.image-start-card-footer > button {
  min-height: 28px;
  padding: 0 9px;
  color: #4441d8;
  border: 1px solid rgba(var(--template-accent-rgb), 0.32);
  border-radius: 7px;
  background: rgba(var(--template-accent-rgb), 0.08);
  font-size: 9px;
  font-weight: 750;
}

.image-start-card-footer > button:hover,
.image-start-card-footer > button:focus-visible {
  color: #ffffff;
  border-color: var(--template-accent);
  outline: none;
  background: var(--template-accent);
}

.image-start-quick-form {
  display: none;
  gap: 8px;
  padding: 11px;
  border-top: 1px solid #eceef5;
  background: #f9faff;
}

.image-start-card.selected .image-start-quick-form { display: none; }

.image-start-quick-form > strong {
  color: #504be4;
  font-size: 9px;
}

.image-start-quick-form label {
  display: grid;
  gap: 5px;
  color: #5f667d;
  font-size: 9px;
  font-weight: 650;
}

.image-start-quick-form input,
.image-start-quick-form select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  color: #252a45;
  border: 1px solid #dce0eb;
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  font-size: 10px;
}

.image-start-quick-form input:focus,
.image-start-quick-form select:focus {
  border-color: #6562f2;
  box-shadow: 0 0 0 3px rgba(78, 75, 242, 0.09);
}

.image-start-use {
  width: 100%;
}

.image-start-rail {
  display: grid;
  align-content: start;
  gap: 14px;
}

.image-start-side-card {
  padding: 16px;
  border: 1px solid #dfe3ef;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(44, 49, 94, 0.07);
}

.image-start-side-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 13px;
}

.image-start-side-title > strong {
  font-size: 13px;
}

.image-start-side-title > b {
  font-size: 19px;
}

.image-start-side-title > b small {
  font-size: 13px;
  font-weight: 500;
}

.image-start-side-card button {
  min-height: auto;
  padding: 0;
  color: #3d3be8;
  border: 0;
  background: transparent;
  font-size: 9px;
}

.image-start-quota-track {
  height: 4px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e8f2;
}

.image-start-quota-track i {
  width: 90%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #4d45f1, #5b55ed);
}

.image-start-quota > p {
  margin: 8px 0 14px;
  color: #9196a8;
  font-size: 8px;
}

.image-start-quota > button {
  width: 100%;
  height: 32px;
  border: 1px solid #dfe3ef;
  border-radius: 7px;
}

.image-start-recent-list {
  display: grid;
}

.image-start-recent-list article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid #eceef4;
}

.image-start-recent-list article:last-child {
  border-bottom: 0;
}

.image-start-recent-list img {
  width: 42px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
  background: #16184f;
}

.image-start-recent-list strong,
.image-start-recent-list small,
.image-start-recent-list em {
  display: block;
}

.image-start-recent-list strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-start-recent-list small,
.image-start-recent-list time {
  color: #9297a8;
  font-size: 7px;
}

.image-start-recent-list em {
  margin-top: 2px;
  color: #16a87f;
  font-size: 7px;
  font-style: normal;
}

.image-start-recent-list em.running {
  color: #4b47e5;
}

.image-start-rules > article {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  color: #3d3be8;
  border-bottom: 1px solid #eceef4;
}

.image-start-rules > article > span {
  width: 19px;
  flex: 0 0 auto;
  text-align: center;
}

.image-start-rules article strong,
.image-start-rules article small {
  display: block;
}

.image-start-rules article strong {
  color: #33384f;
  font-size: 9px;
}

.image-start-rules article small {
  margin-top: 3px;
  color: #989dad;
  font-size: 7px;
}

.image-start-swatches {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.image-start-swatches b {
  width: 13px;
  height: 13px;
  display: block;
  border-radius: 50%;
  background: #3738d8;
}

.image-start-swatches b:nth-child(2) { background: #101957; }
.image-start-swatches b:nth-child(3) { background: #18a989; }
.image-start-swatches b:nth-child(4) { background: #f55278; }
.image-start-swatches b:nth-child(5) { background: #f5c844; }
.image-start-swatches b:nth-child(6) { background: #343646; }

.image-start-rules > p {
  margin: 12px 0 0;
  color: #9a9faf;
  font-size: 7px;
  line-height: 1.45;
  text-align: center;
}

.image-poster-primary.is-blank {
  background:
    radial-gradient(circle at 50% 38%, rgba(109, 94, 252, 0.22), transparent 30%),
    radial-gradient(circle at 78% 18%, rgba(55, 195, 221, 0.09), transparent 25%),
    linear-gradient(145deg, #151d2d, #0a101b 72%);
  border: 1px solid rgba(129, 118, 255, 0.42);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.image-poster-primary.is-blank > :not(.image-poster-overlay) {
  opacity: 0;
}

.image-poster-primary.is-blank .image-poster-overlay {
  background: none;
}

.image-poster-primary.is-blank::before {
  content: "";
  width: 124px;
  height: 124px;
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(133, 119, 255, 0.32);
  border-radius: 50%;
  box-shadow:
    0 0 46px rgba(92, 75, 255, 0.22),
    inset 0 0 38px rgba(44, 190, 205, 0.07);
  transform: translate(-50%, -62%);
}

.image-poster-primary.is-blank::after {
  content: "✦  待创作画板\A拖动定位 · 滚轮缩放";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 112px;
  color: #aeb8cf;
  border: 1px dashed rgba(144, 157, 188, 0.26);
  font-size: 16px;
  line-height: 2;
  text-align: center;
  white-space: pre-line;
}

.image-artwork-cluster.is-blank-project .image-variant-stack {
  display: none;
}

@media (max-width: 1180px) {
  .image-start-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 780px) {
  .image-start-screen {
    padding: 20px 18px 34px;
  }

  .image-start-header {
    align-items: center;
  }

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

  .image-start-rules {
    grid-column: 1 / -1;
  }

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

  .image-start-quick-fields > button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .image-start-screen {
    padding: 16px 12px 30px;
  }

  .image-start-header {
    display: block;
  }

  .image-start-header h1 {
    font-size: 22px;
  }

  .image-start-actions {
    margin-top: 14px;
  }

  .image-start-actions > button {
    flex: 1;
    padding-inline: 10px;
  }

  .image-start-steps {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 15px;
  }

  .image-start-steps li::after {
    display: none;
  }

  .image-start-grid,
  .image-start-rail {
    grid-template-columns: 1fr;
  }

  .image-start-quick-fields {
    grid-template-columns: 1fr;
  }

  .image-start-quick-fields > button {
    grid-column: auto;
  }

  .image-start-rail {
    display: none;
  }

  .image-start-visual {
    height: 190px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body:not(.authenticated) .app-shell {
  display: none;
}

body.authenticated .login-screen {
  display: none;
}

.password-change-screen {
  display: none;
}

body.password-change-required .app-shell {
  display: none;
}

body.password-change-required .password-change-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.password-change-panel {
  width: min(480px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--pink);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.password-change-panel h1 {
  margin: 0 0 10px;
  font-size: 24px;
}

.password-change-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(140deg, rgba(48, 54, 217, 0.08), rgba(0, 170, 143, 0.1)),
    var(--page);
}

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

.login-brand {
  color: var(--ink);
  margin-bottom: 22px;
}

.login-brand span {
  color: var(--muted);
}

.login-card h1 {
  margin-bottom: 10px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline-color: var(--blue);
}

.login-form small {
  color: var(--muted);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  color: #ffffff;
  background: var(--navy);
}

.brand,
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.sidebar-footer strong {
  display: block;
  font-size: 15px;
}

.brand span,
.sidebar-footer span {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  margin-top: 3px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--navy) 0 30%, transparent 31%),
    conic-gradient(var(--pink), var(--yellow), var(--teal), var(--blue), var(--pink));
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 7px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(0, 170, 143, 0.18);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.25;
}

.top-actions,
.panel-heading,
.heading-actions,
.tag-row,
.workflow-row {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.heading-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.icon-button,
.text-button,
.scope-list button,
.review-list button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 8px 18px rgba(48, 54, 217, 0.18);
}

.primary-button:hover {
  background: #242ac3;
}

.primary-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-button {
  width: 40px;
  color: var(--ink);
  background: var(--panel);
}

.text-button {
  padding: 0 12px;
  color: var(--blue);
  background: #ffffff;
}

.text-button.success {
  color: var(--green);
  border-color: #bfe8d7;
  background: #effaf5;
}

.text-button.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.danger-button {
  color: #b22952;
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.wide {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 120px;
  display: grid;
  align-content: space-between;
  padding: 18px;
  border-top: 4px solid var(--blue);
}

.metric-card:nth-child(2) {
  border-top-color: var(--pink);
}

.metric-card:nth-child(3) {
  border-top-color: var(--teal);
}

.metric-card:nth-child(4) {
  border-top-color: var(--yellow);
}

.metric-card span,
.metric-card small,
.workflow-step small,
.doc-meta,
.source,
.review-list span,
.role-row small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 34px;
  line-height: 1;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 116px;
  border-left: 4px solid var(--teal);
}

.dashboard-command h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.split-layout,
.two-column,
.ask-layout,
.generator-layout {
  display: grid;
  gap: 18px;
}

.split-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.42fr);
  gap: 18px;
  align-items: start;
}

.dashboard-main,
.dashboard-side,
.dashboard-bottom {
  display: grid;
  gap: 18px;
}

.dashboard-bottom {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

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

.review-admin-layout {
  grid-template-columns: minmax(0, 1fr);
}

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

.generator-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

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

.quick-card {
  min-height: 88px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.quick-card strong {
  display: block;
  margin-bottom: 8px;
}

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

.todo-list,
.activity-strip {
  display: grid;
  gap: 10px;
}

.todo-list article,
.activity-strip article {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.todo-list article span,
.activity-strip article span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.todo-list article.warning span {
  background: var(--yellow);
  color: var(--ink);
}

.todo-list article.success span {
  background: var(--teal);
}

.todo-list strong,
.activity-strip strong {
  display: block;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.todo-list small,
.activity-strip small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.health-grid article {
  min-height: 78px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.health-grid span {
  color: var(--muted);
  font-size: 12px;
}

.health-grid strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.visual-panel {
  min-height: 350px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0 55%, #eef1ff 55% 100%);
}

.document-preview {
  height: 280px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.document-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

.preview-copy p {
  color: var(--muted);
  line-height: 1.8;
}

.tag-row {
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row span,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: var(--blue);
  background: #eef0ff;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.pill.success {
  color: var(--green);
  background: #eaf8f2;
}

.pill.warning {
  color: #9a5d00;
  background: #fff5d8;
}

#currentUserBadge {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.workflow-row {
  gap: 10px;
}

.workflow-step {
  min-width: 0;
  flex: 1;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.workflow-step span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  color: #ffffff;
  background: #a6aec4;
  border-radius: 50%;
  font-size: 12px;
}

.workflow-step.done span {
  background: var(--teal);
}

.workflow-step.active {
  border-color: rgba(48, 54, 217, 0.45);
  background: #f5f6ff;
}

.workflow-step.active span {
  background: var(--blue);
}

.workflow-step strong,
.workflow-step small {
  display: block;
}

.search-box {
  width: min(340px, 100%);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.search-box input,
.ask-form input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.doc-list,
.queue-list,
.template-list,
.review-list,
.scope-list,
.role-table {
  display: grid;
  gap: 10px;
}

.library-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}

.library-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.library-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.library-pagination[hidden] {
  display: none;
}

.library-pagination-nav,
.library-page-numbers,
.library-page-jump {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-page-number {
  min-width: 38px;
  padding: 0 10px;
}

.library-page-number.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.library-page-ellipsis,
.library-page-status,
.library-page-jump label,
.library-page-jump > span {
  color: var(--muted);
  white-space: nowrap;
}

.library-page-jump input {
  width: 64px;
  min-height: 38px;
  text-align: center;
}

.library-page-jump > #libraryPageJumpBtn {
  flex-shrink: 0;
  white-space: nowrap;
}

.library-page-jump small {
  flex-basis: 100%;
  min-height: 16px;
  color: #b22952;
}

.library-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.doc-card,
.template-card,
.role-row,
.review-list article,
.empty-state {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.doc-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.doc-card.archived {
  opacity: 0.82;
  background: #fffdf6;
}

.doc-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.doc-thumb {
  width: 76px;
  height: 96px;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.doc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.doc-card h3,
.template-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.doc-tags {
  margin: 8px 0;
}

.doc-tags span {
  min-height: 22px;
  font-size: 11px;
}

.doc-meta,
.source,
.template-card p,
.review-list span,
.role-row small,
.queue-list div,
.source-note p {
  font-size: 13px;
  line-height: 1.55;
}

.doc-fingerprint {
  margin-top: 4px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.doc-version-history {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.doc-version-history summary {
  width: fit-content;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.doc-version-history > div {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.doc-version-history article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcff;
  color: var(--muted);
  font-size: 11px;
}

.upload-zone {
  position: relative;
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  border: 1px dashed #aab2c8;
  border-radius: 8px;
  background: #fbfcff;
  cursor: pointer;
}

.upload-zone.dragging {
  border-color: var(--blue);
  background: #f1f5ff;
  box-shadow: inset 0 0 0 1px rgba(48, 54, 217, 0.18);
}

.upload-zone span,
.upload-zone strong {
  display: block;
}

.upload-zone span {
  color: var(--muted);
  margin-top: 6px;
}

.upload-zone input {
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

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

.form-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline-color: var(--blue);
}

.upload-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.upload-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.queue-list {
  margin-top: 14px;
}

.library-help {
  margin-top: 12px;
  padding: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  font-size: 13px;
  line-height: 1.7;
}

.url-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.url-import label {
  display: grid;
  gap: 6px;
}

.url-import span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.url-import input {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline-color: var(--blue);
}

.queue-list div {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--green);
  background: #ecfaf4;
}

.queue-list .error {
  color: #a12a2a;
  background: #fff0f0;
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chat-window {
  height: 520px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faff;
}

.message {
  max-width: 82%;
  padding: 13px 14px;
  border-radius: 8px;
  line-height: 1.7;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message-body {
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.message.assistant {
  justify-self: start;
}

.source {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.source-citations {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.source-citation {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fbfcff;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

.source-citation:hover {
  border-color: var(--blue);
}

.source-citation span {
  flex: 0 0 auto;
  color: var(--blue);
  font-weight: 700;
}

.message-meta {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 10px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green);
  background: #eaf8f2;
  font-size: 12px;
}

.message-warning {
  margin-top: 10px;
  padding: 9px 10px;
  color: #8a5200;
  border: 1px solid #eed79c;
  border-radius: 8px;
  background: #fff9e8;
  font-size: 12px;
  line-height: 1.55;
}

.quality-alert {
  color: #9a5d00 !important;
  font-weight: 700;
}

.answer-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.answer-feedback > div {
  display: flex;
  gap: 6px;
}

.answer-feedback.submitted {
  justify-content: flex-start;
  color: var(--green);
  font-weight: 700;
}

.feedback-note {
  font-weight: 700;
}

.feedback-note.helpful {
  color: var(--green) !important;
}

.feedback-note.needs-improvement {
  color: var(--pink) !important;
}

.ask-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.ask-form input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.ask-form input {
  height: 44px;
  padding: 0 14px;
}

.source-panel {
  align-self: start;
}

.scope-list button {
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
  background: #ffffff;
}

.scope-list button:hover {
  border-color: var(--blue);
}

.source-note {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #f4fbf8;
  border: 1px solid #d5eee5;
}

.search-preview {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.search-preview-heading,
.search-match-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-preview-heading strong {
  font-size: 14px;
}

.search-preview-list {
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
  padding-right: 2px;
}

.search-diagnostics {
  padding: 10px 12px;
  border: 1px solid #dce6ff;
  border-radius: 8px;
  background: #f7f9ff;
}

.search-diagnostics strong,
.search-diagnostics small {
  display: block;
}

.search-diagnostics strong {
  color: var(--blue);
  font-size: 12px;
}

.search-diagnostics small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.search-diagnostics .diagnostic-warning {
  color: #a15c12;
  font-weight: 700;
}

.search-match,
.search-empty {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.search-match strong,
.search-empty strong {
  display: block;
  min-width: 0;
  font-size: 13px;
}

.search-match small,
.search-empty small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.search-match p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.source-preview-button {
  margin-top: 9px;
}

.match-score {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--green);
  background: #eaf8f2;
  font-size: 12px;
  font-weight: 800;
}

.match-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.match-terms span {
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #394260;
  background: #eef2ff;
  font-size: 11px;
  font-weight: 700;
}

.template-card {
  text-align: left;
}

.template-card.active {
  border-color: rgba(48, 54, 217, 0.5);
  background: #f4f6ff;
}

.generation-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.generation-controls label {
  display: grid;
  gap: 6px;
}

.generation-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.generation-controls select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline-color: var(--blue);
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  outline-color: var(--blue);
}

pre {
  min-height: 360px;
  margin: 14px 0 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.75;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
}

.generated-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.generation-history {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.subsection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.subsection-title strong {
  color: var(--ink);
}

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

.generation-history article div {
  display: grid;
  gap: 4px;
}

.generation-history article span {
  color: var(--muted);
  font-size: 12px;
}

body.image-studio-active {
  overflow: hidden;
  background: #f7f8fd;
}

body.image-studio-active .app-shell {
  grid-template-columns: 225px minmax(0, 1fr);
}

body.image-studio-active .sidebar {
  padding: 22px 15px 16px;
}

body.image-studio-active .workspace {
  padding: 0;
  background: #f7f8fd;
}

body.image-studio-active .topbar {
  display: none;
}

.image-studio-view.active {
  min-height: 100vh;
  display: block;
}

.image-studio-toolbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px;
  border-bottom: 1px solid #e2e5ef;
  background: rgba(255, 255, 255, 0.94);
}

.image-studio-title,
.image-studio-tools,
.image-studio-tools label,
.image-brand-toggle,
.image-artboard-tools,
.image-history-meta {
  display: flex;
  align-items: center;
}

.image-studio-title {
  gap: 12px;
}

.image-studio-title div {
  display: grid;
  gap: 1px;
}

.image-studio-title span,
.image-studio-tools label > span {
  color: #777d91;
  font-size: 10px;
}

.image-studio-title h1 {
  font-size: 22px;
}

.image-studio-tools {
  gap: 10px;
}

.image-studio-tools label {
  gap: 7px;
}

.image-studio-tools select {
  height: 36px;
  padding: 0 28px 0 10px;
  color: #30344b;
  border: 1px solid #dde1ec;
  border-radius: 7px;
  background: #ffffff;
  font-size: 11px;
}

.image-toolbar-icon,
.image-toolbar-button,
.image-artboard-tools button {
  height: 36px;
  border: 1px solid #dde1ec;
  border-radius: 7px;
  color: #30344b;
  background: #ffffff;
}

.image-toolbar-icon {
  width: 36px;
  font-size: 18px;
}

.image-toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 700;
}

.image-toolbar-button.primary {
  color: #ffffff;
  border-color: #5148e5;
  background: linear-gradient(135deg, #5148e5, #4037d6);
  box-shadow: 0 8px 18px rgba(64, 55, 214, 0.2);
}

.image-brand-toggle {
  gap: 7px !important;
  cursor: pointer;
}

.image-brand-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.image-brand-toggle i {
  width: 36px;
  height: 20px;
  position: relative;
  display: block;
  border-radius: 999px;
  background: #c6cad8;
  transition: background 0.2s ease;
}

.image-brand-toggle i::after {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(17, 21, 47, 0.25);
  transition: transform 0.2s ease;
}

.image-brand-toggle input:checked + i {
  background: linear-gradient(90deg, #6158ed, #3b42d4);
}

.image-brand-toggle input:checked + i::after {
  transform: translateX(16px);
}

.image-studio-shell {
  min-height: calc(100vh - 66px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
  padding: 0 16px 16px;
}

.image-artboard-area {
  min-width: 0;
  min-height: calc(100vh - 82px);
  position: relative;
  overflow: hidden;
  border: 1px solid #e0e4ee;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background:
    radial-gradient(circle at 50% 50%, rgba(89, 82, 225, 0.035), transparent 42%),
    #fafbfe;
}

.image-artboard-heading {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  color: #30344b;
  font-size: 12px;
}

.image-artboard-tools {
  gap: 7px;
}

.image-artboard-tools button {
  height: 26px;
  padding: 0 8px;
  color: #7d8397;
  font-size: 10px;
}

.image-artboard-stage {
  height: calc(100% - 142px);
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 14px 28px 96px;
}

.image-poster {
  position: relative;
  overflow: hidden;
  color: #ffffff;
  border-radius: 7px;
  background: #11143d;
  box-shadow: 0 24px 54px rgba(14, 17, 58, 0.2);
}

.image-poster-primary {
  width: min(364px, 47%);
  aspect-ratio: 3 / 4;
  flex: 0 0 auto;
  transform: scale(var(--image-zoom, 1));
  transform-origin: center;
  transition: transform 0.2s ease;
}

.image-poster > img,
.image-poster-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.image-poster-primary.is-artwork-only .image-poster-overlay,
.image-poster-primary.is-artwork-only .image-poster-brand,
.image-poster-primary.is-artwork-only .image-poster-copy,
.image-poster-primary.is-artwork-only .image-poster-meta,
.image-poster-primary.is-artwork-only footer {
  display: none;
}

.image-poster > img {
  object-fit: cover;
}

.image-poster-overlay {
  background:
    linear-gradient(180deg, rgba(10, 11, 48, 0.02) 20%, rgba(9, 10, 43, 0.76) 100%),
    linear-gradient(115deg, rgba(40, 35, 144, 0.25), rgba(184, 18, 112, 0.12));
}

.image-poster-brand,
.image-poster-copy,
.image-poster-meta,
.image-poster footer {
  position: absolute;
  z-index: 1;
}

.image-poster-brand {
  top: 24px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8px;
  line-height: 1.05;
}

.image-poster-brand .brand-mark {
  width: 27px;
  height: 27px;
  flex-basis: 27px;
}

.image-poster-brand em {
  padding-left: 7px;
  border-left: 1px solid rgba(255,255,255,.45);
  font-style: normal;
}

.image-poster-copy {
  top: 34%;
  left: 29px;
  right: 22px;
}

.image-poster-copy > span {
  color: rgba(255,255,255,.58);
  font-size: 7px;
  letter-spacing: .08em;
}

.image-poster-copy h2 {
  margin: 18px 0 12px;
  color: #ffffff;
  font-size: clamp(22px, 2.3vw, 32px);
  line-height: 1.18;
}

.image-poster-copy p {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  letter-spacing: .16em;
}

.image-poster-meta {
  left: 29px;
  right: 25px;
  bottom: 55px;
  display: flex;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.17);
  color: rgba(255,255,255,.8);
  font-size: 9px;
}

.image-poster footer {
  left: 29px;
  right: 25px;
  bottom: 22px;
  color: rgba(255,255,255,.42);
  font-size: 6px;
  text-align: right;
}

.image-variant-stack {
  width: 135px;
  display: grid;
  gap: 14px;
  transform: scale(var(--image-zoom, 1));
  transform-origin: center;
  transition: transform 0.2s ease;
}

.image-variant-stack[hidden] {
  display: none;
}

.image-variant-stack > strong {
  color: #747b97;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-align: center;
}

.image-variant-stack button {
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #11143d;
  box-shadow: 0 10px 24px rgba(14, 17, 58, 0.13);
}

.image-variant-stack button.active {
  border-color: #6258eb;
  box-shadow: 0 0 0 2px rgba(98, 88, 235, 0.16), 0 12px 26px rgba(14, 17, 58, 0.16);
}

.image-variant-stack img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: .78;
}

.image-variant-stack span {
  position: absolute;
  right: 9px;
  bottom: 9px;
  color: #ffffff;
  font-size: 9px;
  text-shadow: 0 1px 5px #080926;
}

.image-result-grid {
  display: none;
}

.image-progress {
  position: absolute;
  inset: 56px 0 86px;
  z-index: 5;
  display: grid;
  place-content: center;
  padding: 24px;
  color: #eef2ff;
  background:
    radial-gradient(circle at 42% 42%, rgba(96, 91, 229, .16), transparent 29%),
    radial-gradient(circle at 62% 58%, rgba(53, 210, 190, .08), transparent 31%),
    rgba(5, 10, 19, .72);
  backdrop-filter: blur(10px) saturate(.84);
}

.image-progress[hidden] {
  display: none;
}

.image-progress-card {
  width: min(440px, calc(100vw - 64px));
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px 18px;
  padding: 24px;
  border: 1px solid rgba(132, 151, 196, .24);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(22, 31, 52, .94), rgba(10, 17, 30, .96)),
    rgba(10, 17, 30, .94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .045);
  text-align: left;
}

.image-progress-orbit {
  width: 64px;
  height: 64px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(101, 114, 255, .26), rgba(101, 114, 255, .04) 52%, transparent 54%);
  box-shadow: 0 0 36px rgba(93, 92, 244, .18);
}

.image-progress-orbit::before,
.image-progress-orbit::after,
.image-progress-orbit span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.image-progress-orbit::before {
  inset: 3px;
  border: 1px solid rgba(113, 133, 255, .26);
  border-top-color: #7e7bff;
  border-right-color: #c169e8;
  animation: image-orbit-spin 2.5s linear infinite;
}

.image-progress-orbit::after {
  inset: 11px;
  border: 2px solid rgba(68, 214, 192, .12);
  border-right-color: #42d8bd;
  border-bottom-color: #5f80ef;
  animation: image-orbit-spin 1.75s linear infinite reverse;
}

.image-progress-orbit span {
  width: 13px;
  height: 13px;
  background: linear-gradient(135deg, #7085ff, #b365e4 55%, #46d5bc);
  box-shadow: 0 0 22px rgba(125, 109, 255, .72);
  animation: image-orbit-pulse 1.8s ease-in-out infinite;
}

.image-progress-orbit i,
.image-progress-orbit b {
  display: none;
}

.image-progress-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.image-progress-copy > span {
  color: #53d6c0;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: .15em;
}

.image-progress-copy strong {
  color: #f4f6ff;
  font-size: 17px;
  line-height: 1.35;
}

.image-progress-copy small {
  color: #919db6;
  font-size: 11px;
  line-height: 1.55;
}

.image-progress-track {
  height: 4px;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(117, 135, 173, .14);
}

.image-progress-track > span {
  --image-generation-stage: 1;
  width: calc(var(--image-generation-stage) * 25%);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #526ff1 0%, #8b68ef 52%, #46d4bb 100%);
  box-shadow: 0 0 16px rgba(104, 104, 246, .36);
  transition: width .55s cubic-bezier(.22, .8, .2, 1);
}

.image-progress-steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.image-progress-steps span {
  color: #59667e;
  font-size: 9px;
  text-align: center;
  transition: color .25s ease;
}

.image-progress-steps span.current {
  color: #d9ddff;
}

.image-progress-steps span.complete {
  color: #55cdb9;
}

.image-progress-card > p {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 2px 0 0;
  color: #7f8aa2;
  font-size: 10px;
}

.image-progress-card > p i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #48cfb7;
  box-shadow: 0 0 10px rgba(72, 207, 183, .7);
  animation: image-orbit-pulse 1.8s ease-in-out infinite;
}

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

@keyframes image-orbit-pulse {
  0%, 100% { opacity: .55; transform: scale(.84); }
  50% { opacity: 1; transform: scale(1); }
}

.image-prompt-dock {
  height: 72px;
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 7;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px 10px 15px;
  border: 1px solid #dfe3ee;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(14, 17, 58, .08);
}

.image-prompt-icon {
  color: #5148e5;
  font-size: 24px;
}

.image-prompt-dock textarea {
  width: 100%;
  height: 48px;
  min-height: 0;
  padding: 6px 4px;
  color: #4e546b;
  border: 0;
  outline: 0;
  resize: none;
  font-size: 11px;
  line-height: 1.55;
}

.image-prompt-dock .primary-button {
  height: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  white-space: nowrap;
}

.image-prompt-dock .primary-button.is-busy > i {
  animation: image-orbit-spin 1.5s linear infinite;
}

.image-settings-panel {
  align-self: start;
  display: grid;
  gap: 16px;
  margin-top: 0;
  padding: 18px;
  border: 1px solid #e0e4ee;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(14, 17, 58, .04);
}

.image-settings-title {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.image-settings-title > div {
  display: grid;
  gap: 3px;
}

.image-settings-title small {
  color: #888da1;
  font-size: 9px;
  font-weight: 500;
}

.image-settings-panel > label,
.image-advanced-settings label,
.image-reference-settings label {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.image-settings-panel label > span,
.image-advanced-settings label > span,
.image-reference-settings label > span {
  color: #6f758c;
  font-size: 10px;
}

.image-settings-panel select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  color: #3f445b;
  border: 1px solid #dfe3ec;
  border-radius: 7px;
  background: #ffffff;
  font-size: 11px;
}

.image-tone-picker {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px;
  border: 1px solid #dfe3ec;
  border-radius: 7px;
}

.image-tone-picker button {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
}

.image-tone-picker button.gradient {
  width: 50px;
  flex-basis: 50px;
  border-radius: 6px;
  background: linear-gradient(90deg, #142d87, #8a36d4);
}

.image-tone-picker button.active { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #5148e5; }
.image-tone-picker .navy { background: #1c328a; }
.image-tone-picker .violet { background: #6442e3; }
.image-tone-picker .green { background: #24a58f; }
.image-tone-picker .coral { background: #ff6545; }
.image-tone-picker .blue { background: #3471da; }
.image-reference-upload {
  min-height: 118px;
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
  color: #747b91;
  border: 1px dashed #cbd0dd;
  border-radius: 8px;
  background: #fcfcfe;
  text-align: center;
}

.image-reference-upload b {
  font-size: 25px;
  font-weight: 400;
}

.image-reference-upload strong {
  color: #6f758c;
  font-size: 10px;
}

.image-reference-upload small {
  font-size: 9px;
}

.image-reference-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-advanced-settings,
.image-reference-settings {
  border-top: 1px solid #eef0f5;
  border-bottom: 1px solid #eef0f5;
}

.image-advanced-settings summary,
.image-reference-settings summary {
  padding: 10px 0;
  color: #5f657b;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.image-advanced-settings summary span,
.image-reference-settings summary span {
  float: right;
  color: #8a90a4;
  font-size: 8px;
  font-weight: 500;
}

.image-advanced-settings[open],
.image-reference-settings[open] {
  padding-bottom: 12px;
}

.image-advanced-settings[open] {
  display: grid;
  gap: 12px;
}

.image-setting-help {
  color: #888da1;
  font-size: 8px;
  line-height: 1.5;
}

.image-provider-note {
  display: block;
  margin-top: 7px;
  color: #747b91;
  font-size: 9px;
}

.image-brand-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  color: #5148e5;
  border-radius: 7px;
  background: #f1f0ff;
}

.image-brand-note strong,
.image-brand-note small {
  display: block;
}

.image-brand-note strong { font-size: 10px; }
.image-brand-note small { margin-top: 3px; color: #888da1; font-size: 8px; }

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

.image-template-card {
  min-width: 0;
  height: 152px;
  position: relative;
  overflow: hidden;
  padding: 0;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  background: var(--navy);
  text-align: left;
  box-shadow: 0 10px 24px rgba(9, 10, 43, 0.1);
}

.image-template-card img,
.image-template-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.image-template-card img {
  object-fit: cover;
  transition: transform 0.25s ease;
}

.image-template-shade {
  background: linear-gradient(180deg, rgba(8, 9, 39, 0.04), rgba(8, 9, 39, 0.9));
}

.image-template-card strong,
.image-template-card small {
  position: absolute;
  z-index: 1;
  left: 13px;
  right: 13px;
}

.image-template-card strong {
  bottom: 33px;
  font-size: 14px;
}

.image-template-card small {
  bottom: 14px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-template-card:hover img {
  transform: scale(1.035);
}

.image-template-card.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px var(--blue), 0 14px 28px rgba(48, 54, 217, 0.2);
}

.image-template-dialog,
.image-history-dialog {
  width: min(960px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 40px));
  padding: 0;
  overflow: auto;
  color: var(--ink);
  border: 0;
  border-radius: 13px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(9, 10, 43, .24);
}

.image-template-dialog::backdrop,
.image-history-dialog::backdrop {
  background: rgba(9, 10, 43, .42);
  backdrop-filter: blur(3px);
}

.image-template-dialog > header,
.image-history-dialog > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 15px;
  border-bottom: 1px solid #eceef4;
  background: #ffffff;
}

.image-template-dialog header span,
.image-history-dialog header span {
  color: var(--muted);
  font-size: 10px;
}

.image-template-dialog header h2,
.image-history-dialog header h2 {
  margin-top: 3px;
  font-size: 20px;
}

.image-template-dialog header button,
.image-history-dialog header button {
  width: 34px;
  height: 34px;
  color: #6f758c;
  border: 1px solid #e0e3ec;
  border-radius: 7px;
  background: #ffffff;
  font-size: 19px;
}

.image-template-dialog .image-template-grid {
  padding: 20px 22px 24px;
}

.image-history-meta {
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 0;
  color: var(--muted);
  font-size: 11px;
}

.image-history-meta > span {
  margin-right: auto;
}

.image-history-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 22px 24px;
}

.image-history-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  cursor: pointer;
}

.image-history-item img {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: cover;
  background: var(--navy);
}

.image-history-copy {
  display: grid;
  gap: 5px;
  padding: 11px;
}

.image-history-copy strong {
  font-size: 12px;
}

.image-history-copy span,
.image-history-copy small,
.image-history-empty {
  color: var(--muted);
  font-size: 10px;
}

.image-history-copy .image-history-resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--primary);
  font-weight: 700;
}

.image-history-item:hover,
.image-history-item:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.18);
}

.image-history-empty {
  grid-column: 1 / -1;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.image-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  width: max-content;
  min-width: 280px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 14px 10px;
  overflow: hidden;
  color: #f5f7ff;
  border: 1px solid rgba(126, 145, 196, 0.34);
  border-radius: 12px;
  background: rgba(15, 24, 42, 0.96);
  box-shadow: 0 18px 46px rgba(2, 7, 20, 0.38);
  backdrop-filter: blur(18px);
  font-size: 12px;
}

.image-toast.success { border-color: rgba(67, 220, 179, 0.55); }
.image-toast.warning { border-color: rgba(255, 166, 88, 0.58); }
.image-toast-message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-toast-action {
  min-height: 30px;
  padding: 5px 12px;
  color: #ffffff;
  border: 1px solid rgba(139, 128, 255, 0.78);
  border-radius: 8px;
  background: linear-gradient(135deg, #5468f5, #8d63ef);
  box-shadow: 0 6px 18px rgba(85, 86, 232, 0.24);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.image-toast-action:hover,
.image-toast-action:focus-visible {
  border-color: #c5c0ff;
  outline: none;
  filter: brightness(1.08);
}
.image-toast-progress {
  grid-column: 1 / -1;
  height: 2px;
  margin: 0 -14px -10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #44d7bd, #6678ff 58%, #b063ef);
  transform-origin: left center;
  animation: image-toast-countdown var(--toast-duration, 8000ms) linear forwards;
}
@keyframes image-toast-countdown {
  to { transform: scaleX(0); opacity: 0.42; }
}
@media (prefers-reduced-motion: reduce) {
  .image-toast-progress { animation: none; }
}
.image-toast[hidden] { display: none; }

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

.acceptance-panel > * {
  min-width: 0;
}

.acceptance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.acceptance-summary strong {
  color: var(--ink);
}

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

.acceptance-quality-grid article {
  min-height: 88px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.acceptance-quality-grid span,
.acceptance-quality-grid small,
.acceptance-gaps small,
.acceptance-gaps article > span {
  color: var(--muted);
  font-size: 12px;
}

.acceptance-quality-grid strong {
  font-size: 22px;
}

.acceptance-history-block {
  display: grid;
  gap: 8px;
}

.acceptance-history {
  display: grid;
  gap: 6px;
  max-height: 330px;
  overflow: auto;
}

.acceptance-history-empty {
  padding: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.acceptance-history-item {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) 64px minmax(300px, 1.4fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.acceptance-history-item:hover,
.acceptance-history-item.selected {
  border-color: rgba(48, 54, 217, 0.45);
  background: #f5f6ff;
}

.acceptance-history-item.regression {
  border-left: 4px solid var(--pink);
}

.acceptance-history-date,
.acceptance-history-metrics {
  color: var(--muted);
  font-size: 12px;
}

.acceptance-history-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(62px, 1fr));
  gap: 6px;
}

.acceptance-history-metrics span {
  white-space: nowrap;
}

.acceptance-gaps {
  display: grid;
  gap: 0;
}

.acceptance-gaps article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
  gap: 12px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}

.acceptance-gaps article div {
  display: grid;
  gap: 3px;
}

.acceptance-gaps article > span {
  text-align: right;
}

.acceptance-no-gaps {
  padding: 10px 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.acceptance-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.acceptance-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #ffffff;
}

.acceptance-item > * {
  min-width: 0;
}

.acceptance-item.review {
  border-left-color: var(--yellow);
}

.acceptance-item.fail {
  border-left-color: var(--pink);
}

.acceptance-item p {
  margin: 8px 0;
  line-height: 1.75;
  min-width: 0;
  overflow-wrap: anywhere;
}

.acceptance-item span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.acceptance-badges {
  display: flex;
  align-content: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.role-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
}

.role-row.active {
  border-color: rgba(48, 54, 217, 0.45);
  background: #f3f5ff;
}

.user-management {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(120px, 0.8fr) minmax(160px, 1fr);
  gap: 8px;
  align-items: start;
}

.user-form input,
.user-form select,
.modal textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.user-form input,
.user-form select {
  min-height: 38px;
  padding: 0 10px;
}

.user-password-field {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.user-password-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.user-form [aria-invalid="true"] {
  border-color: #d54949;
  box-shadow: 0 0 0 3px rgba(213, 73, 73, 0.12);
}

.user-form-status {
  min-height: 20px;
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.user-form-status:empty {
  display: none;
}

.user-form-status.is-error {
  color: #d54949;
}

.user-form-status.is-success {
  color: var(--green);
}

.inline-check {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inline-check input {
  width: auto;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.user-list article.disabled {
  opacity: 0.62;
}

.user-list small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.review-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
}

.review-list span {
  grid-column: 1 / 2;
}

.review-record.pending {
  border-left: 4px solid var(--yellow);
}

.review-record.approved {
  border-left: 4px solid var(--green);
}

.review-record.published {
  border-left: 4px solid var(--teal);
  background: #f1fffb;
}

.review-record.revision {
  border-left: 4px solid var(--pink);
}

.review-record.archived {
  border-left: 4px solid var(--muted);
  background: #f7f8fb;
}

.review-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -2px 0 12px;
  border-bottom: 1px solid var(--line);
}

.review-filter-tabs button {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  color: var(--muted);
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
}

.review-filter-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
}

.review-maintenance-message {
  min-height: 20px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.review-governance {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0 0 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.review-governance-item {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.review-governance-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.review-governance-item span,
.review-task-toolbar label > span {
  color: var(--muted);
  font-size: 12px;
}

.review-governance-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.review-workload {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.review-workload-heading,
.review-workload-labels,
.review-workload-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) repeat(5, minmax(66px, 1fr));
  align-items: center;
  gap: 10px;
}

.review-workload-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.review-workload-heading span,
.review-workload-labels,
.review-workload-row small,
.review-workload-empty {
  color: var(--muted);
  font-size: 12px;
}

.review-workload-labels {
  padding: 0 8px 5px;
}

.review-workload-list {
  border-top: 1px solid var(--line);
}

.review-workload-row {
  min-height: 42px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.review-workload-row > span:first-child {
  display: grid;
  min-width: 0;
}

.review-workload-row .due-soon,
.review-task-meta.due-soon {
  color: #a15c00;
  font-weight: 700;
}

.review-workload-row .overdue {
  color: var(--pink);
  font-weight: 700;
}

.review-workload-empty {
  padding: 12px 8px;
}

.review-panel {
  container-type: inline-size;
}

@container (max-width: 680px) {
  .review-governance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 0;
  }

  .review-governance-item:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .review-workload-labels {
    display: none;
  }

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

  .review-workload-row > span:first-child {
    grid-column: 1 / -1;
  }

  .review-workload-row > span:not(:first-child)::before {
    content: attr(data-label) " ";
    color: var(--muted);
    font-weight: 400;
  }
}

.review-task-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 0;
}

.review-task-toolbar label {
  min-width: 156px;
  display: grid;
  gap: 5px;
}

.review-task-toolbar select {
  min-height: 36px;
  max-width: 230px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.review-task-toolbar .review-select-all {
  min-width: 128px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
}

.review-task-toolbar > strong {
  min-width: 72px;
  align-self: center;
  color: var(--blue);
  font-size: 13px;
}

.review-row-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.review-row-select span {
  grid-column: auto;
}

.review-task-meta.overdue {
  color: var(--pink);
  font-weight: 700;
}

.review-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.review-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.review-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.review-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.review-actions button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--blue);
  background: #ffffff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 24, 38, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.brand-asset-workflow-form {
  display: grid;
  gap: 14px;
}

.brand-asset-workflow-form label {
  display: grid;
  gap: 7px;
}

.brand-asset-workflow-form label > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-hint,
.brand-asset-batch-tools,
.brand-asset-batch-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.brand-asset-batch-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-asset-batch-tools[hidden] {
  display: none;
}

.brand-asset-batch-tools span {
  overflow-wrap: anywhere;
}

.brand-asset-batch-status {
  margin: 0;
  min-height: 1.2em;
}

.brand-asset-batch-status.error {
  color: var(--orange);
}

.brand-asset-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.brand-share-status {
  width: 100%;
  color: var(--muted);
  font-size: 0.84rem;
}

.brand-asset-review-note {
  margin-top: 12px;
  padding: 12px;
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  background: color-mix(in srgb, var(--orange) 8%, var(--panel));
}

.brand-asset-review-note p {
  margin: 6px 0 0;
  color: var(--muted);
}

.generation-image-recommendations {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.generation-image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.generation-image-card .generation-image-preview,
.generation-image-card .brand-asset-preview-missing {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef0ec;
}

.generation-image-card > div {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.generation-image-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 780px) {
  .generation-image-grid {
    grid-template-columns: 1fr;
  }
}

.modal {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.modal textarea {
  min-height: 320px;
  resize: vertical;
  padding: 12px;
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.source-modal {
  width: min(840px, 100%);
}

.source-diagnostics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.source-diagnostics span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #eef1ff;
  font-size: 11px;
  font-weight: 700;
}

.source-diagnostics small {
  width: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.source-context-body {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.source-context-section {
  padding: 14px 2px;
}

.source-context-section + .source-context-section {
  border-top: 1px solid var(--line);
}

.source-context-section > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-context-section span,
.source-context-empty {
  color: var(--muted);
  font-size: 12px;
}

.source-context-section p {
  margin: 10px 0 0;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.8;
}

.source-context-empty {
  padding: 28px 4px;
  text-align: center;
}

.source-context-empty.error {
  color: var(--pink);
}

.intake-panel {
  margin-bottom: 18px;
}

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

.intake-summary article {
  min-height: 92px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.intake-summary span,
.intake-summary small,
.format-check small,
.pending-intake-list small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.intake-summary strong {
  font-size: 24px;
}

.intake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
  margin-top: 16px;
  align-items: start;
}

.format-acceptance,
.pending-intake-list {
  display: grid;
  gap: 10px;
}

.format-check {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #ffffff;
}

.format-check.review,
.format-check.untested {
  border-left-color: var(--yellow);
}

.format-check.fail {
  border-left-color: var(--pink);
}

.format-check div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.format-check span {
  font-size: 13px;
  font-weight: 700;
}

.format-check b {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green);
  background: #eaf8f2;
  font-size: 12px;
}

.format-check.review b,
.format-check.untested b {
  color: #8a6500;
  background: #fff5d8;
}

.format-check.fail b {
  color: var(--pink);
  background: rgba(255, 47, 114, 0.1);
}

.pending-intake-list article {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.pending-intake-list strong,
.pending-intake-list small {
  display: block;
  overflow-wrap: anywhere;
}

.pending-intake-list strong {
  margin-bottom: 4px;
  font-size: 14px;
}

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

.insight-card,
.ops-item,
.insight-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.insight-card {
  min-height: 110px;
  display: grid;
  align-content: space-between;
  padding: 14px;
}

.insight-card span,
.ops-item span,
.insight-list small {
  color: var(--muted);
  font-size: 13px;
}

.insight-card strong {
  font-size: 28px;
  line-height: 1;
}

.insight-card small,
.ops-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.insight-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
}

.insight-list {
  display: grid;
  gap: 10px;
}

.audit-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.audit-toolbar {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.audit-toolbar select,
.audit-toolbar input {
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 0 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  outline-color: var(--blue);
}

.insight-list article,
.audit-list article {
  min-height: 72px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.insight-list article > span,
.audit-list article > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
}

.activity-list article > span,
.audit-list article > span {
  width: auto;
  min-width: 44px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--teal);
}

.insight-list strong,
.insight-list small,
.audit-list strong,
.audit-list small {
  display: block;
}

.insight-list strong,
.audit-list strong {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.audit-list small {
  color: var(--muted);
  line-height: 1.45;
}

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

.ops-item {
  min-height: 98px;
  display: grid;
  align-content: space-between;
  padding: 12px;
}

.ops-item strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.ops-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.45fr);
  gap: 12px;
  min-height: 70px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.ops-summary div {
  display: grid;
  gap: 6px;
}

.ops-summary strong {
  font-size: 18px;
}

.ops-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.ops-check {
  min-height: 142px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #ffffff;
}

.ops-check.warn {
  border-left-color: var(--yellow);
}

.ops-check.fail {
  border-left-color: var(--pink);
}

.ops-check div {
  display: grid;
  align-content: space-between;
  gap: 8px;
  min-width: 0;
}

.ops-check span,
.ops-check small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ops-check strong {
  overflow-wrap: anywhere;
  font-size: 20px;
}

.ops-check b {
  align-self: start;
  padding: 5px 8px;
  color: var(--green);
  background: rgba(32, 141, 104, 0.1);
  border-radius: 999px;
  font-size: 12px;
}

.ops-check.warn b {
  color: #8a6500;
  background: rgba(243, 199, 68, 0.18);
}

.ops-check.fail b {
  color: var(--pink);
  background: rgba(255, 47, 114, 0.1);
}

.ops-roadmap {
  margin-bottom: 16px;
}

.ops-next {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ops-next article {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.ops-next article span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

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

.runbook-item {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(170px, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.runbook-copy {
  display: grid;
  gap: 6px;
}

.runbook-copy span {
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
}

.runbook-copy strong {
  font-size: 16px;
  line-height: 1.35;
}

.runbook-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.command-snippet {
  min-height: 170px;
  margin: 0;
  padding: 12px;
  color: #eef2ff;
  background: #11152f;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
}

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

.roadmap article {
  min-height: 156px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcff;
}

.roadmap span {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--pink);
  font-weight: 700;
}

.roadmap p {
  color: var(--muted);
  line-height: 1.7;
}

.architecture {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.architecture div {
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: #ffffff;
  background: var(--blue);
  border-radius: 8px;
}

.architecture div:nth-child(2n) {
  background: var(--pink);
}

.architecture div:nth-child(3n) {
  background: var(--teal);
}

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

.brand-asset-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  border-left: 4px solid var(--teal);
}

.brand-asset-command h2 {
  margin: 0;
}

.brand-asset-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 6px;
}

.brand-asset-total strong {
  margin: 0 2px;
}

.brand-asset-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.brand-asset-status-tabs .active {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.brand-asset-album-panel {
  min-width: 0;
  max-width: 100%;
  margin-bottom: 18px;
  overflow: hidden;
}

.brand-asset-album-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.brand-asset-album-heading h3 {
  margin: 2px 0 0;
}

.brand-asset-album-heading small,
#brandAssetAlbumCurrent {
  color: var(--muted);
}

.brand-asset-album-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-asset-album-load-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.brand-asset-album-load-feedback .form-error {
  margin: 0;
}

.brand-asset-album-search input {
  width: min(220px, 100%);
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.brand-asset-albums {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 156px;
  gap: 12px;
  max-width: 100%;
  padding: 2px 2px 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

#brandAssetAlbumList {
  display: contents;
}

.brand-asset-management-album {
  width: 156px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-asset-management-album > .brand-asset-album {
  flex: 1;
}

.brand-asset-album-description {
  margin-inline: 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-asset-management-menu {
  position: relative;
}

.brand-asset-management-menu summary {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  list-style: none;
  font-size: 22px;
  line-height: 1;
}

.brand-asset-management-menu summary::-webkit-details-marker {
  display: none;
}

.brand-asset-management-menu > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.brand-asset-management-menu button {
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-size: 12px;
}

.destructive,
.brand-asset-management-menu button.destructive {
  color: #ffffff;
  border-color: var(--pink);
  background: var(--pink);
}

.brand-asset-album {
  width: 156px;
  min-width: 0;
  display: grid;
  grid-template-rows: 92px auto auto;
  gap: 7px;
  padding: 0 0 10px;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  text-align: left;
}

.brand-asset-album:focus-visible {
  outline: 3px solid rgba(48, 54, 217, 0.32);
  outline-offset: 2px;
}

.brand-asset-album.active {
  border-color: var(--blue);
  background: #f6f7ff;
  box-shadow: 0 0 0 2px rgba(48, 54, 217, 0.16);
}

.brand-asset-album-cover {
  width: 100%;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: #eef0f6;
}

.brand-asset-album-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-asset-album strong,
.brand-asset-album small {
  margin-inline: 10px;
  overflow-wrap: anywhere;
}

.brand-asset-album strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.brand-asset-album small {
  color: var(--muted);
  line-height: 1.4;
}

#brandAssetAlbumCurrent {
  margin: 4px 2px 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.brand-asset-command-actions,
.brand-asset-ai-toolbar,
.brand-asset-review-toolbar,
.brand-asset-management-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-asset-ai-toolbar,
.brand-asset-review-toolbar,
.brand-asset-management-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin: -8px 0 18px;
  padding: 12px 16px;
}

.brand-asset-management-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
}

.brand-asset-management-toolbar {
  flex-wrap: wrap;
}

.brand-asset-management-toolbar :focus-visible,
.brand-asset-album-heading-actions :focus-visible,
.brand-asset-management-menu summary:focus-visible,
.brand-asset-dialog :focus-visible,
.brand-asset-upload-album-field :focus-visible {
  outline: 3px solid rgba(48, 54, 217, 0.32);
  outline-offset: 2px;
}

.brand-asset-upload-album-field {
  display: grid;
  gap: 8px;
}

.brand-asset-upload-album-field > label,
.brand-asset-upload-album-field input {
  width: 100%;
}

.brand-asset-upload-album-field > button {
  justify-self: start;
  min-height: 40px;
}

.brand-asset-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-asset-dialog::backdrop {
  background: rgba(9, 10, 43, 0.58);
}

.brand-asset-dialog form {
  display: grid;
  gap: 12px;
}

.brand-asset-dialog h2,
.brand-asset-dialog p {
  margin: 0;
}

.brand-asset-dialog input,
.brand-asset-dialog select,
.brand-asset-dialog textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.brand-asset-ai-toolbar label,
.brand-asset-review-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.brand-asset-ai-toolbar span,
.brand-asset-review-toolbar span {
  margin-right: auto;
  color: var(--muted);
}

.brand-asset-toolbar-error {
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .brand-asset-album-heading {
    align-items: stretch;
    flex-direction: column;
  }

  #brand-assets {
    max-width: 100%;
    overflow-x: hidden;
  }

  .brand-asset-album-heading-actions,
  .brand-asset-album-search,
  .brand-asset-album-search input,
  .brand-asset-management-toolbar {
    width: 100%;
  }

  .brand-asset-management-toolbar span {
    width: 100%;
    margin-left: 0;
  }

  .brand-asset-management-toolbar button {
    flex: 1 1 min(180px, 100%);
  }

  #brandAssetAlbumClear {
    align-self: flex-start;
  }

  .brand-asset-review-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-asset-review-toolbar span {
    margin-right: 0;
  }

  #brandAssetBatchApproveOpen {
    width: 100%;
  }
}

.brand-asset-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, minmax(110px, auto));
  gap: 10px;
  margin-bottom: 18px;
}

.brand-asset-filters label,
.brand-asset-filters input,
.brand-asset-filters select {
  width: 100%;
  min-width: 0;
}

.brand-asset-filters input,
.brand-asset-filters select {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.brand-asset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

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

.brand-asset-grid > .empty-state {
  grid-column: 1 / -1;
}

.brand-asset-card-shell {
  position: relative;
  min-width: 0;
}

.brand-asset-card-shell .brand-asset-card {
  width: 100%;
  height: 100%;
}

.brand-asset-selector {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brand-asset-management-selector {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 7px 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.brand-asset-management-selector input {
  width: 18px;
  height: 18px;
}

.brand-asset-card {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 0 0 12px;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: left;
}

.brand-asset-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(48, 54, 217, 0.2);
}

.brand-asset-card img,
.brand-asset-preview-missing:not(.brand-asset-detail-preview) {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.brand-asset-card img {
  display: block;
  object-fit: cover;
  background: #eef0f6;
}

.brand-asset-preview-missing {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eef0f6;
}

.brand-asset-card strong,
.brand-asset-card small {
  margin-inline: 12px;
  overflow-wrap: anywhere;
}

.brand-asset-card small {
  color: var(--muted);
  line-height: 1.5;
}

.asset-status {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 4px 7px;
  color: var(--ink);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 700;
}

.asset-status.approved {
  color: var(--green);
}

.asset-ai-state {
  position: absolute;
  top: 42px;
  right: 9px;
  padding: 4px 7px;
  color: #2f36d9;
  border-radius: 999px;
  background: rgba(239, 240, 255, 0.94);
  font-size: 11px;
  font-weight: 700;
}

.asset-ai-state.failed,
.asset-ai-state.needs_review {
  color: #a54b00;
  background: rgba(255, 243, 226, 0.96);
}

.asset-status.rejected,
.brand-asset-load-error {
  color: #b22952;
}

.brand-asset-detail {
  position: sticky;
  top: 18px;
  overflow-wrap: anywhere;
}

.brand-asset-detail-preview {
  width: 100%;
  max-height: 340px;
  min-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  background: #eef0f6;
}

.brand-asset-detail h3 {
  margin: 16px 0 8px;
}

.brand-asset-detail p {
  color: var(--muted);
  line-height: 1.65;
}

.brand-asset-detail dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  margin: 16px 0;
}

.brand-asset-detail dt {
  color: var(--muted);
}

.brand-asset-detail dd {
  margin: 0;
}

.brand-asset-ai-review {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(48, 54, 217, 0.2);
  border-radius: 10px;
  background: #f6f7ff;
}

.brand-asset-ai-review > strong {
  color: #3036d9;
}

.brand-asset-ai-review > small {
  display: block;
  color: var(--muted);
  line-height: 1.55;
}

.brand-asset-ai-review dl {
  margin-bottom: 0;
}

.brand-asset-rights-attestation {
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: start;
}

.brand-asset-rights-attestation input {
  margin-top: 3px;
}

.brand-asset-pagination,
.brand-asset-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.brand-asset-pagination:empty {
  display: none;
}

body.compact .workspace {
  padding: 16px;
}

body.compact .panel {
  padding: 14px;
}

body.compact .chat-window {
  height: 430px;
}

@media (max-width: 1180px) {
  .metrics-grid,
  .insight-metrics,
  .intake-summary,
  .ops-grid,
  .ops-check-grid,
  .runbook-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout,
  .dashboard-layout,
  .dashboard-bottom,
  .two-column,
  .ask-layout,
  .generator-layout,
  .intake-layout,
  .insight-layout {
    grid-template-columns: 1fr;
  }

  .source-panel {
    order: -1;
  }

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

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

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

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

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

  .image-settings-panel .panel-heading,
  .image-settings-panel .image-brand-lock,
  .image-settings-panel .image-credential-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item span:last-child {
    display: none;
  }

  .topbar,
  .dashboard-command,
  .workflow-row {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-command {
    grid-template-columns: 1fr;
  }

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

  .brand-asset-detail {
    position: static;
  }

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

  .brand-asset-command {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .command-actions,
  .panel-heading,
  .library-toolbar {
    align-items: stretch;
  }

  .panel-heading {
    flex-direction: column;
  }

  .intake-panel .panel-heading {
    flex-direction: column;
  }

  .intake-panel .panel-heading .pill {
    align-self: flex-start;
  }

  .answer-feedback {
    flex-direction: column;
  }

  .library-toolbar span {
    margin-left: 0;
  }

  .library-pagination,
  .library-pagination-nav,
  .library-page-jump {
    width: 100%;
  }

  .library-pagination-nav,
  .library-page-jump {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .library-page-numbers {
    display: none;
  }

  .library-page-status {
    order: 0;
  }

  .library-page-jump input {
    flex: 1;
    min-width: 0;
  }

  .library-page-jump small {
    width: 100%;
    min-width: 0;
  }

  .metrics-grid,
  .quick-grid,
  .health-grid,
  .form-grid,
  .generation-controls,
  .insight-metrics,
  .intake-summary,
  .ops-grid,
  .ops-summary,
  .ops-check-grid,
  .runbook-grid,
  .roadmap {
    grid-template-columns: 1fr;
  }

  .image-studio-hero,
  .image-prompt-dock {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .image-template-grid,
  .image-settings-panel,
  .image-history-grid {
    grid-template-columns: 1fr;
  }

  .image-template-card {
    height: 178px;
  }

  .image-canvas-panel {
    min-height: 0;
  }

  .image-canvas {
    min-height: 420px;
    padding: 12px;
  }

  .image-prompt-actions,
  .image-prompt-actions button {
    width: 100%;
  }

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

  .review-governance-item,
  .review-governance-item:first-child {
    padding: 0 10px;
    border-left: 1px solid var(--line);
  }

  .review-task-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .review-workload-labels {
    display: none;
  }

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

  .review-workload-row > span:first-child {
    grid-column: 1 / -1;
  }

  .review-workload-row > span:not(:first-child)::before {
    content: attr(data-label) " ";
    color: var(--muted);
    font-weight: 400;
  }

  .review-task-toolbar label,
  .review-task-toolbar select,
  .review-task-toolbar button {
    width: 100%;
    max-width: none;
  }

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

  .document-preview {
    height: 260px;
  }

  .doc-card {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  .doc-actions {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .doc-card .pill {
    justify-self: start;
  }

  .doc-version-history article {
    align-items: flex-start;
    flex-direction: column;
  }

  .message {
    max-width: 100%;
  }

  .ask-form,
  .acceptance-item,
  .acceptance-summary,
  .acceptance-quality-grid,
  .acceptance-gaps article,
  .generation-history article,
  .review-list article,
  .user-form,
  .user-list article,
  .audit-toolbar,
  .format-check,
  .pending-intake-list article {
    grid-template-columns: 1fr;
  }

  .acceptance-summary,
  .acceptance-badges,
  .answer-feedback,
  .review-actions,
  .user-actions,
  .modal-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .acceptance-summary {
    display: grid;
  }

  .acceptance-summary span,
  .acceptance-history-date {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .acceptance-history,
  .acceptance-history-item,
  .acceptance-list,
  .acceptance-item {
    width: 100%;
    min-width: 0;
  }

  .acceptance-gaps article > span {
    text-align: left;
  }

  .acceptance-history-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .acceptance-history-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .acceptance-history-item > .pill {
    justify-self: end;
  }

  .modal-backdrop {
    padding: 12px;
  }
}

@media (max-width: 1180px) {
  .image-settings-panel { grid-template-columns: 1fr; }
}

@media (max-width: 940px) {
  body.image-studio-active { overflow: auto; }
  .image-studio-toolbar {
    height: auto;
    min-height: 66px;
    align-items: flex-start;
    flex-direction: column;
    padding-block: 12px;
  }
  .image-studio-tools {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
  }
  .image-studio-shell { grid-template-columns: 1fr; }
  .image-artboard-area {
    min-height: 760px;
    border-top: 1px solid #e0e4ee;
    border-radius: 12px;
  }
  .image-settings-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid #e0e4ee;
    border-radius: 12px;
  }
  .image-settings-title,
  .image-reference-upload,
  .image-advanced-settings,
  .image-brand-note { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
  body.image-studio-active .app-shell { grid-template-columns: 70px minmax(0, 1fr); }
  body.image-studio-active .sidebar {
    position: sticky;
    height: 100vh;
    gap: 14px;
    padding: 15px 9px;
  }
  body.image-studio-active .brand,
  body.image-studio-active .sidebar-footer { justify-content: center; }
  body.image-studio-active .brand > div,
  body.image-studio-active .sidebar-footer > div,
  body.image-studio-active .nav-item span:last-child { display: none; }
  body.image-studio-active .nav-item { justify-content: center; padding: 0; }
  body.image-studio-active .nav-list { grid-template-columns: 1fr; }
  .image-artboard-stage {
    min-height: 570px;
    align-items: flex-start;
    gap: 10px;
    padding: 24px 12px 104px;
  }
  .image-poster-primary { width: min(310px, 72%); }
  .image-variant-stack { width: 76px; gap: 8px; }
  .image-prompt-dock {
    height: auto;
    min-height: 82px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .image-prompt-dock textarea { grid-column: 2 / -1; }
  .image-polish-button { grid-column: 2; }
  .image-settings-panel { grid-template-columns: 1fr; }
  .image-settings-title,
  .image-reference-upload,
  .image-advanced-settings,
  .image-brand-note { grid-column: auto; }
  .image-template-grid,
  .image-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .image-studio-toolbar {
    min-height: 58px;
    align-items: center;
    flex-direction: row;
    padding: 7px 8px;
  }

  .image-studio-title {
    min-width: 0;
  }

  .image-studio-title > div > span {
    display: none;
  }

  .image-studio-tools {
    width: auto;
    margin-left: auto;
    overflow: visible;
  }

  .image-studio-tools > label,
  #imageUndoBtn {
    display: none;
  }

  .image-toolbar-button {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .image-artboard-area {
    min-height: 680px;
  }

  .image-artboard-stage {
    min-height: 560px;
    align-items: flex-start;
    gap: 8px;
    padding: 90px 10px 112px;
  }

  .image-poster-primary {
    width: calc(100% - 78px);
    max-width: 218px;
  }

  .image-variant-stack {
    width: 70px;
    gap: 8px;
  }

  .image-prompt-dock {
    height: auto;
    min-height: 118px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 9px;
  }

  .image-prompt-dock textarea {
    grid-column: 2;
  }

  .image-polish-button {
    grid-column: 1 / 2;
    padding-inline: 8px;
  }

  .image-prompt-dock .primary-button {
    grid-column: 2;
    min-width: 0;
    padding-inline: 10px;
  }

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

/* Infinite canvas: the artwork lives on one continuous surface and settings float above it. */
body.image-studio-active .workspace,
.image-studio-view.active {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.image-studio-toolbar {
  position: relative;
  z-index: 40;
}

.image-settings-toggle {
  display: none;
}

.image-studio-shell {
  height: calc(100vh - 66px);
  min-height: 0;
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  background: #f8f9fd;
}

.image-artboard-area {
  min-width: 0;
  min-height: 0;
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background-color: #f8f9fd;
  background-image:
    radial-gradient(circle, rgba(82, 87, 122, 0.18) 1px, transparent 1.15px),
    radial-gradient(circle at 50% 45%, rgba(81, 72, 229, 0.055), transparent 34%);
  background-position:
    calc(var(--canvas-pan-x, 0px) + 1px) calc(var(--canvas-pan-y, 0px) + 1px),
    center;
  background-size: 24px 24px, 100% 100%;
  cursor: grab;
  touch-action: none;
}

.image-artboard-area.is-panning {
  cursor: grabbing;
  user-select: none;
}

.image-artboard-heading {
  width: auto;
  height: 34px;
  position: absolute;
  top: 16px;
  right: 334px;
  left: 18px;
  z-index: 18;
  padding: 0;
  pointer-events: none;
}

.image-artboard-heading > * {
  pointer-events: auto;
}

.image-artboard-heading > strong {
  min-width: 0;
  max-width: clamp(180px, 42vw, 520px);
  padding: 7px 11px;
  border: 1px solid rgba(219, 224, 238, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 7px 20px rgba(14, 17, 58, 0.06);
  backdrop-filter: blur(12px);
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.image-artboard-heading > strong:hover,
.image-artboard-heading > strong:focus-visible {
  border-color: rgba(105, 116, 245, 0.72);
  box-shadow: 0 0 0 3px rgba(105, 116, 245, 0.12), 0 10px 26px rgba(14, 17, 58, 0.1);
  outline: none;
}

.image-artboard-heading > strong[aria-busy="true"] {
  opacity: .72;
  cursor: wait;
}

.image-project-title-input {
  width: clamp(180px, 32vw, 420px);
  min-width: 180px;
  height: 24px;
  padding: 0 4px;
  color: inherit;
  border: 0;
  border-bottom: 1px solid #6d75f5;
  border-radius: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  line-height: 24px;
}

.image-artboard-tools {
  padding: 4px;
  border: 1px solid rgba(219, 224, 238, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 7px 20px rgba(14, 17, 58, 0.06);
  backdrop-filter: blur(12px);
}

.image-canvas-hint {
  position: absolute;
  right: 344px;
  bottom: 100px;
  z-index: 17;
  padding: 7px 10px;
  color: #777d91;
  border: 1px solid rgba(219, 224, 238, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 7px 20px rgba(14, 17, 58, 0.05);
  font-size: 9px;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.image-artboard-stage {
  width: auto;
  height: auto;
  min-height: 0;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 70px 334px 128px 34px;
  transform: translate3d(var(--canvas-pan-x, 0px), var(--canvas-pan-y, 0px), 0);
  cursor: grab;
  pointer-events: auto;
  will-change: transform;
}

.image-artwork-cluster {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 34px;
  transform: scale(var(--canvas-zoom, 0.75));
  transform-origin: center;
  transition: transform 0.16s ease;
  pointer-events: auto;
  will-change: transform;
}

.image-artwork-cluster img {
  user-select: none;
  -webkit-user-drag: none;
}

.image-poster-primary {
  cursor: grab;
}

.image-artboard-area.is-panning .image-poster-primary {
  cursor: grabbing;
}

.image-artboard-area.is-panning .image-artwork-cluster {
  transition: none;
}

.image-artboard-area.is-panning .image-artboard-stage,
.image-artboard-area.is-panning .image-artwork-cluster {
  cursor: grabbing;
}

.image-poster-primary {
  width: 485px;
  max-width: none;
  transform: none;
}

.image-variant-stack {
  width: 180px;
  gap: 18px;
  transform: none;
}

.image-progress {
  inset: 0;
  z-index: 19;
  padding-right: 316px;
  pointer-events: auto;
}

.image-settings-panel {
  width: 300px;
  max-height: calc(100% - 32px);
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: auto;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid rgba(217, 222, 235, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px rgba(14, 17, 58, 0.13);
  overscroll-behavior: contain;
  backdrop-filter: blur(18px);
}

.image-settings-title {
  position: sticky;
  top: -18px;
  z-index: 2;
  align-items: center;
  margin: -18px -18px 0;
  padding: 18px 18px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.98) 76%, rgba(255,255,255,0));
}

.image-settings-title button {
  width: 28px;
  height: 28px;
  display: none;
  color: #777d91;
  border: 1px solid #e0e4ee;
  border-radius: 7px;
  background: #ffffff;
  font-size: 18px;
}

.image-prompt-dock {
  right: 334px;
  bottom: 18px;
  left: 18px;
  z-index: 26;
}

@media (max-width: 1180px) {
  .image-artboard-heading { right: 310px; }
  .image-canvas-hint { right: 320px; }
  .image-artboard-stage { padding-right: 310px; }
  .image-settings-panel { width: 280px; }
  .image-prompt-dock { right: 310px; }
}

@media (max-width: 940px) {
  body.image-studio-active { overflow: hidden; }

  .image-studio-toolbar {
    height: 66px;
    min-height: 66px;
    align-items: center;
    flex-direction: row;
    padding-block: 0;
  }

  .image-studio-tools {
    width: auto;
    margin-left: auto;
    gap: 6px;
    overflow: visible;
  }

  .image-studio-title {
    flex: 0 0 auto;
  }

  .image-studio-title > div > span,
  .image-studio-tools label > span,
  .image-toolbar-button > span {
    display: none;
  }

  .image-studio-title h1 {
    font-size: 20px;
    white-space: nowrap;
  }

  .image-studio-tools > label:nth-child(2),
  .image-brand-toggle > span {
    display: none;
  }

  #imageUndoBtn {
    display: none;
  }

  .image-toolbar-button {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .image-studio-tools select {
    max-width: 155px;
  }

  .image-settings-toggle {
    display: inline-flex;
  }

  .image-settings-toggle > span {
    display: inline;
  }

  .image-studio-shell {
    height: calc(100vh - 66px);
  }

  .image-artboard-area {
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .image-artboard-heading {
    right: 18px;
  }

  .image-canvas-hint {
    right: 18px;
  }

  .image-artboard-stage {
    min-height: 0;
    align-items: initial;
    gap: 0;
    padding: 64px 24px 128px;
  }

  .image-settings-panel {
    width: min(300px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    top: 12px;
    right: 12px;
    grid-template-columns: 1fr;
    border: 1px solid rgba(217, 222, 235, 0.96);
    border-radius: 12px;
    transform: translateX(calc(100% + 30px));
    opacity: 0;
    visibility: hidden;
    transition: transform 0.22s ease, opacity 0.18s ease, visibility 0.18s ease;
  }

  .image-settings-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  .image-settings-title button {
    display: inline-grid;
    place-items: center;
  }

  .image-settings-title,
  .image-reference-upload,
  .image-advanced-settings,
  .image-brand-note {
    grid-column: auto;
  }

  .image-prompt-dock {
    right: 18px;
  }

  .image-progress {
    padding-right: 0;
  }
}

@media (max-width: 560px) {
  .image-studio-toolbar {
    height: 58px;
    min-height: 58px;
  }

  .image-studio-shell {
    height: calc(100vh - 58px);
  }

  .image-studio-tools > label,
  #imageUndoBtn {
    display: none;
  }

  .image-canvas-hint {
    display: none;
  }

  .image-artboard-area {
    min-height: 0;
  }

  .image-artboard-stage {
    min-height: 0;
    padding: 58px 10px 138px;
  }

  .image-poster-primary {
    width: 485px;
    max-width: none;
  }

  .image-variant-stack {
    width: 180px;
  }

  .image-prompt-dock {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .image-progress {
    padding: 14px;
  }

  .image-progress-card {
    width: min(360px, calc(100vw - 36px));
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px 14px;
    padding: 18px;
    border-radius: 15px;
  }

  .image-progress-orbit {
    width: 52px;
    height: 52px;
  }

  .image-progress-copy strong {
    font-size: 15px;
  }

  .image-progress-steps {
    gap: 4px;
  }
}

/* Keep the template home scrollable after the editor-only infinite-canvas rules. */
body.image-studio-active.image-studio-home {
  overflow: auto;
}

body.image-studio-active.image-studio-home .workspace,
body.image-studio-active.image-studio-home .image-studio-view.active {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}
