:root {
  --brand-navy: #003044;
  --brand-teal: #0aa39c;
  --brand-mint: #e4f5f4;
  --brand-mint-soft: #f0faf9;
  --ink: #171717;
  --muted: #636363;
  --line: #e0e0e0;
  --surface: #ffffff;
  --warn: #ca8a04;
  --danger: #b42318;
  --danger-soft: #fff1f0;
}

* { box-sizing: border-box; }
.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;
}
body {
  margin: 0;
  font-family: Poppins, "Segoe UI", Arial, sans-serif;
  background: var(--surface);
  color: var(--brand-navy);
}

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

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand-navy);
  color: var(--brand-teal);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
nav { display: flex; gap: 18px; color: var(--muted); font-size: 14px; align-items: center; }
.nav-primary {
  border: 1px solid var(--brand-teal);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--brand-teal);
  color: #fff;
  font-weight: 800;
}
.nav-primary:hover {
  border-color: var(--brand-navy);
  background: var(--brand-navy);
  color: #fff;
}
.nav-user { color: var(--muted); font-size: 12px; align-self: center; }
.logout-form { margin: 0; }
.logout-form button {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-navy);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

main { padding: 32px; width: 100%; max-width: none; margin: 0; }

.loading-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  border: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 48, 68, .42);
  backdrop-filter: blur(3px);
  padding: 20px;
}
.loading-overlay:not([open]) { display: none; }
.loading-overlay::backdrop {
  background: transparent;
}
body.is-loading {
  overflow: hidden;
}
.loading-panel {
  width: min(520px, 100%);
  min-height: 240px;
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
  background: #fff;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 22px 60px rgba(0, 48, 68, .24);
}
.loading-panel strong { font-size: 22px; }
.loading-panel > span { color: var(--muted); font-size: 14px; max-width: 360px; }
.loader-ring {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 5px solid var(--brand-mint);
  border-top-color: var(--brand-teal);
  display: grid;
  place-items: center;
  animation: spin .8s linear infinite;
}
.loader-ring i {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 4px;
  border: 3px solid var(--brand-navy);
  border-top: 8px solid var(--brand-navy);
  background: #fff;
}
.loader-stage-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.loader-stage-list span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand-navy);
  font-size: 11px;
  font-weight: 800;
  background: #f7fbfb;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loader-ring { animation: none; }
}

.processing-stage {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
  padding: 40px 16px;
}
.processing-panel {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 42px;
  box-shadow: 0 18px 52px rgba(0, 48, 68, .12);
}
.processing-panel h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
}
.processing-panel p:not(.eyebrow) {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
}
.processing-meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eeee;
  border: 1px solid var(--line);
}
.processing-meter span {
  display: block;
  height: 100%;
  width: 8%;
  background: var(--brand-teal);
  transition: width .25s ease;
}
.processing-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}
.processing-steps span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fff;
}
.processing-steps span.active {
  border-color: var(--brand-teal);
  color: var(--brand-navy);
  background: #effafa;
}
.processing-stage.has-failed .processing-meter span {
  background: var(--warn);
}
.processing-stage.has-poll-error .processing-meter span {
  background: var(--brand-navy);
}
.processing-stage.has-failed .processing-steps span.active {
  border-color: var(--warn);
  background: #fffbeb;
}
.processing-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.processing-actions form {
  margin: 0;
}

.workspace-head {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: var(--brand-navy);
  color: #fff;
  padding: 44px;
  margin: -32px -32px 32px;
}
.workspace-head.compact { min-height: 170px; }
.workspace-head h1 { font-size: clamp(34px, 5vw, 72px); line-height: .96; max-width: 1050px; margin: 8px 0 14px; letter-spacing: 0; }
.workspace-head.compact h1 { font-size: clamp(30px, 4vw, 52px); }
.eyebrow { color: var(--brand-teal); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; margin: 0 0 8px; }
.lede { color: rgba(255,255,255,.78); max-width: 680px; font-size: 18px; }
.request-context {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: rgba(255,255,255,.84);
  font-size: 13px;
}
.request-context span,
.request-context strong,
.request-context a {
  color: inherit;
}
.request-context a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.band, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.section-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 18px; }
.auth-layout { min-height: 60vh; display: grid; place-items: center; }
.auth-panel { max-width: 560px; text-align: center; }
.auth-panel h1 { font-size: 44px; margin: 6px 0 12px; }
.section-head h2 { margin: 0; font-size: 20px; }
.section-head p { margin: 0; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.upload-band { margin-bottom: 24px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.single { grid-template-columns: 1fr; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--brand-navy);
}
textarea { resize: vertical; }
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: 3px solid rgba(10, 163, 156, .16);
  border-color: var(--brand-teal);
}
.folder-picker {
  margin-top: 16px;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed var(--brand-teal);
  border-radius: 8px;
  background: var(--brand-mint-soft);
  cursor: pointer;
  position: relative;
  padding: 24px;
}
.folder-picker strong { display: block; color: var(--brand-navy); font-size: 18px; }
.folder-picker small { color: var(--muted); }
.folder-picker small.is-selected {
  display: inline-block;
  margin-top: 8px;
  border: 1px solid var(--brand-teal);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--brand-navy);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.folder-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.zip-picker {
  min-height: 150px;
}
.brand-logo-picker {
  min-height: 104px;
  margin-top: 14px;
}
.add-creatives-form {
  scroll-margin-top: 96px;
}

button, .button {
  border: 1px solid var(--brand-teal);
  background: #fff;
  color: var(--brand-navy);
  padding: 11px 18px;
  border-radius: 35px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
button:disabled {
  cursor: progress;
  opacity: .72;
}
.primary {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: #fff;
}
button:hover, .button:hover {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}

.flash-wrap {
  position: fixed;
  right: 22px;
  top: 88px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(720px, calc(100vw - 44px));
  pointer-events: none;
}
.flash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  background: var(--brand-navy);
  color: #fff;
  padding: 12px 14px 12px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  pointer-events: auto;
  transition: opacity .18s ease, transform .18s ease;
}
.flash.error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, .28);
}
.flash.success {
  background: var(--brand-mint-soft);
  color: var(--brand-navy);
  border: 1px solid rgba(10, 163, 156, .28);
}
.flash.warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid rgba(202, 138, 4, .28);
}
.flash.is-dismissed {
  opacity: 0;
  transform: translateY(-6px);
}
.flash span {
  overflow-wrap: anywhere;
}
.flash-close {
  min-height: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
}

.campaign-list, .mapping-list, .file-list { display: grid; gap: 10px; }
.campaign-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, .75fr);
  gap: 24px;
  align-items: start;
}
.campaign-list-card {
  min-height: 420px;
}
.upload-card {
  position: sticky;
  top: 96px;
}
.campaign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.file-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.file-list a strong,
.file-list a span {
  overflow-wrap: anywhere;
}
.file-list a span {
  justify-self: end;
}
.campaign-row small { display: block; color: var(--muted); margin-top: 4px; }
.status {
  background: var(--brand-mint);
  color: var(--brand-navy);
  border-radius: 999px;
  padding: 5px 11px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}
.status.large { font-size: 14px; padding: 9px 14px; }
.readiness-pill {
  align-self: center;
  border: 1px solid rgba(255,255,255,.4);
  background: var(--brand-mint);
  color: var(--brand-navy);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
}

.steps { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.step b { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-mint); color: var(--brand-navy); }
.step.active { color: var(--brand-navy); border-color: var(--brand-teal); }
.step.done b { background: var(--brand-teal); color: #fff; }
.step.muted { opacity: .55; }

.readiness-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 24px;
  overflow: hidden;
  background: #fff;
}
.readiness-strip div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}
.readiness-strip div:last-child {
  border-right: 0;
}
.readiness-strip strong {
  font-size: 28px;
  line-height: 1;
}
.readiness-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.handoff-strip {
  margin-bottom: 28px;
}

.package-creative-section {
  margin-bottom: 28px;
}
.source-review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 24px;
  background: #fff;
}
.source-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  align-items: center;
}
.source-review-grid > div {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--brand-mint-soft);
}
.source-review-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.source-review-grid strong {
  font-size: 22px;
  line-height: 1;
}
.source-review-grid .source-asset-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  background: #fff;
}
.source-asset-thumb,
.creative-thumb-button {
  min-height: 0;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: inherit;
}
.source-asset-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.source-asset-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.package-creative-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.package-creative-toolbar h2 {
  margin: 0;
  font-size: 24px;
}
.package-creative-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
}
.package-creative-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.package-creative-actions .primary {
  min-width: 280px;
  justify-content: center;
  border-radius: 8px;
}
.creative-search input {
  width: 190px;
  min-height: 34px;
  border: 1px solid var(--brand-teal);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--brand-navy);
  font: inherit;
}
.package-creative-table-wrap {
  max-height: none;
  margin-top: 0;
  background: #fff;
}
.package-creative-table {
  min-width: 1280px;
}
.package-creative-table th {
  background: #f0f0f0;
  color: var(--brand-navy);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  padding: 18px 12px;
}
.package-creative-table td {
  height: 92px;
  padding: 14px 12px;
  vertical-align: middle;
}
.package-creative-table td a {
  color: var(--brand-navy);
  font-weight: 700;
}
.system-id {
  color: var(--brand-navy);
  font-weight: 600;
}
.table-edit-input,
.table-edit-select {
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 9px;
  font-size: 12px;
  background: #fff;
}
.table-edit-input {
  min-width: 150px;
}
.table-edit-strong {
  min-width: 160px;
  font-weight: 800;
}
.table-status-select {
  min-width: 136px;
  border-radius: 999px;
  background: var(--brand-mint-soft);
  font-weight: 800;
  text-transform: uppercase;
}
.review-save-button {
  border-radius: 8px;
  background: #fff;
}
.creative-thumb {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: contain;
  background: #fff;
}
.creative-thumb-button {
  border: 1px solid var(--line);
  overflow: hidden;
  flex: 0 0 66px;
}
.creative-thumb-button:hover {
  border-color: var(--brand-teal);
  background: #fff;
}
.image-review-cell {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.image-review-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.image-review-meta small {
  display: block;
  max-width: 170px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-link-button {
  width: max-content;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--brand-teal);
  font-size: 12px;
  font-weight: 800;
}
.table-link-button:hover {
  background: transparent;
  color: var(--brand-navy);
}
.image-replace {
  border-top: 0;
  padding: 2px 0 0;
}
.image-replace summary {
  color: var(--brand-teal);
  font-size: 12px;
  font-weight: 800;
}
.image-replace form {
  width: min(360px, 70vw);
  display: grid;
  gap: 10px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(0, 48, 68, .12);
}
.table-status {
  display: inline-flex;
  white-space: nowrap;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
  position: relative;
}
.row-actions form {
  margin: 0;
}
.row-edit {
  border-top: 0;
  padding: 0;
  position: relative;
}
.row-edit summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--brand-navy);
  background: #fff;
  font-size: 12px;
}
.row-edit summary::marker,
.row-edit summary::-webkit-details-marker {
  display: none;
}
.row-edit form {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 8;
  width: 330px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 48, 68, .14);
}
.row-edit:not([open]) form {
  display: none;
}
.danger-button {
  min-height: 36px;
  border-color: var(--danger-soft);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--danger);
  background: #fff;
  font-size: 12px;
}
.danger-button:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.package-add-panel {
  margin-top: 18px;
}
.package-add-panel form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.template-action {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}
.dark-action {
  border-color: var(--brand-navy);
  border-radius: 8px;
  background: var(--brand-navy);
  color: #fff;
}
.review-issues-inline {
  margin-top: 18px;
}
.review-next-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
.review-next-actions form {
  margin: 0;
}
.zoom-dialog {
  width: min(960px, calc(100vw - 48px));
  border: 0;
  border-radius: 8px;
  padding: 18px;
  color: var(--brand-navy);
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 48, 68, .28);
}
.zoom-dialog::backdrop {
  background: rgba(0, 48, 68, .62);
}
.replace-dialog {
  width: min(520px, calc(100vw - 40px));
  border: 0;
  border-radius: 8px;
  padding: 20px;
  color: var(--brand-navy);
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 48, 68, .28);
}
.replace-dialog::backdrop {
  background: rgba(0, 48, 68, .62);
}
.replace-dialog form:first-child {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}
.replace-dialog form:not(:first-child) {
  display: grid;
  gap: 16px;
}
.dialog-head {
  display: grid;
  gap: 4px;
}
.dialog-head strong {
  color: var(--brand-navy);
  font-size: 22px;
}
.dialog-head span {
  color: var(--muted);
  font-size: 14px;
}
.zoom-dialog form {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}
.zoom-dialog img {
  width: 100%;
  max-height: 76vh;
  display: block;
  object-fit: contain;
  background: var(--brand-mint-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.zoom-dialog strong {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.zoom-close {
  min-height: 0;
  padding: 7px 12px;
}

.two-col, .review-layout, .package-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  gap: 24px;
  align-items: start;
}
.review-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.package-layout { grid-template-columns: 360px minmax(0, 1fr); }
.detail-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}
.detail-actions .panel {
  padding: 20px;
}
.detail-actions form {
  margin: 0;
}
.jira-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.handoff-actions {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 24px;
  background: #fff;
}
.handoff-actions .section-head,
.handoff-actions .inline-actions {
  margin: 0;
}
.handoff-browser {
  display: grid;
  grid-template-columns: minmax(300px, .38fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 32px;
}
.handoff-tree {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.tree-folder {
  border-top: 0;
  padding: 0;
}
.tree-folder summary {
  padding: 8px 0;
  color: var(--brand-navy);
  font-size: 14px;
}
.tree-folder.nested {
  margin-left: 14px;
}
.tree-file {
  width: 100%;
  min-height: 0;
  justify-content: flex-start;
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  overflow-wrap: anywhere;
}
.tree-file:hover,
.tree-file.is-active {
  background: var(--brand-mint-soft);
  color: var(--brand-navy);
}
.handoff-viewer {
  min-height: 560px;
}
.handoff-viewer .artifact-head h2 {
  margin: 0 0 4px;
}
.handoff-preview {
  min-height: 460px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-mint-soft);
  padding: 18px;
}
.handoff-preview img {
  max-width: 100%;
  max-height: 680px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}
.handoff-code {
  width: 100%;
  max-height: 620px;
  overflow: auto;
  align-self: stretch;
  justify-self: stretch;
  margin: 0;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-navy);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}
.package-browser-detail {
  display: block;
}

.package-browser {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.package-browser.package-browser-detail {
  display: block;
}
.package-rail {
  position: sticky;
  top: 96px;
  padding: 18px;
}
.compact-head {
  margin-bottom: 12px;
}
.package-nav {
  display: grid;
  gap: 8px;
  color: var(--brand-navy);
}
.package-nav a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.package-nav a:hover {
  border-color: var(--brand-teal);
  background: var(--brand-mint-soft);
}
.package-nav small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.package-nav b {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  justify-self: end;
  border-radius: 50%;
  background: var(--brand-mint);
  color: var(--brand-navy);
}
.package-main {
  display: grid;
  gap: 28px;
}
.package-section {
  scroll-margin-top: 96px;
  border-top: 2px solid var(--brand-navy);
  padding-top: 18px;
}
.package-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}
.package-section-head h2 {
  margin: 0 0 6px;
  font-size: 28px;
}
.package-section-head p {
  margin: 0;
  color: var(--muted);
}
.creative-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 18px;
}
.creative-output-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .9fr);
  gap: 18px;
  padding: 20px;
  background: var(--brand-mint-soft);
  border-bottom: 1px solid var(--line);
}
.creative-output-head h3 {
  margin: 0 0 6px;
  font-size: 24px;
}
.creative-output-head p {
  margin: 0;
  color: var(--muted);
}
.creative-output-head dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.creative-output-head dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.creative-output-head dd {
  margin: 3px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.artifact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}
.artifact-grid.lower {
  padding-top: 0;
}
.artifact-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}
.creative-output > .artifact-panel {
  margin: 0 18px 18px;
}
.artifact-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.artifact-head h4 {
  margin: 0;
  font-size: 16px;
}
.artifact-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.artifact-primary img {
  width: 100%;
  max-height: 520px;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  background: var(--brand-mint);
}
.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.variant-output {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--brand-mint-soft);
}
.variant-output img {
  width: 100%;
  height: 180px;
  display: block;
  object-fit: contain;
  background: var(--brand-mint);
}
.variant-output figcaption {
  padding: 10px;
  background: #fff;
}
.variant-output strong,
.variant-output small {
  display: block;
  overflow-wrap: anywhere;
}
.variant-output small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.kv-table th {
  width: 150px;
  color: var(--muted);
}
.kv-table td {
  overflow-wrap: anywhere;
}
.artifact-files {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.artifact-files a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 700;
  background: var(--brand-mint-soft);
}
.artifact-files a:hover {
  border-color: var(--brand-teal);
  background: var(--brand-mint);
}

details { border-top: 1px solid var(--line); padding: 14px 0; }
summary { cursor: pointer; font-weight: 800; }
summary span { color: var(--muted); font-weight: 500; margin-left: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 10px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.table-scroll {
  width: 100%;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
}
.table-scroll table {
  min-width: 980px;
}
.table-scroll th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.asset-grid, .preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.asset-grid.input-assets {
  grid-template-columns: repeat(auto-fit, minmax(220px, max-content));
  align-items: start;
}
.asset, .preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.asset img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; background: var(--brand-mint); }
.input-assets .asset {
  width: fit-content;
  max-width: 100%;
}
.input-assets .asset img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 320px;
  aspect-ratio: auto;
  object-fit: contain;
  margin: 0 auto;
}
.brand-logo-summary {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--brand-mint-soft);
}
.brand-logo-summary span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.brand-logo-summary img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.brand-logo-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.review-panel .preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.review-panel .preview {
  min-width: 0;
}
.review-panel .preview img {
  width: 100%;
  min-height: 300px;
  max-height: 520px;
  object-fit: contain;
  background: var(--brand-mint);
}
.preview img { width: 100%; display: block; max-height: 420px; object-fit: contain; background: var(--brand-mint); }
.asset strong, .asset small, .preview strong, .preview small { display: block; padding: 9px 10px 0; }
.asset small, .preview small { color: var(--muted); padding-bottom: 10px; }

.mapping {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 78px;
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.mapping img { width: 150px; height: 150px; object-fit: cover; border-radius: 6px; background: var(--brand-mint); }
.mapping h3 { margin: 0 0 6px; }
.mapping p { margin: 0 0 6px; color: var(--muted); }
.match-summary {
  font-weight: 700;
}
.payload-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 10px 0;
}
.payload-fields dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.payload-fields dd {
  margin: 2px 0 0;
  color: var(--brand-navy);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.review-panel form {
  margin-top: 18px;
}
.compact-matches {
  gap: 12px;
}
.evidence-toggle {
  border-top: 0;
  padding: 4px 0 0;
}
.evidence-toggle summary {
  color: var(--brand-teal);
  font-size: 12px;
  font-weight: 800;
}
.evidence-toggle p {
  margin-top: 8px;
  font-size: 13px;
}
.approval-note {
  margin-top: 18px;
  border: 1px solid var(--brand-mint);
  border-radius: 8px;
  background: var(--brand-mint-soft);
  padding: 13px 14px;
  color: var(--brand-navy);
  font-weight: 700;
}
.confidence { color: var(--brand-teal); font-weight: 900; font-size: 20px; text-align: right; }
.warn { color: var(--warn); }
.inline-actions, .actions-band { display: flex; gap: 12px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }
.inline-actions.tight { justify-content: flex-start; margin-top: 10px; }
.inline-actions.tight form { margin-top: 0; }
.empty { color: var(--muted); padding: 24px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; }
.issue-list { display: grid; gap: 10px; margin-bottom: 16px; }
.issue {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-teal);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}
.issue.error { border-left-color: var(--warn); }
.issue small { display: block; margin-top: 4px; color: var(--muted); }
.manual-match {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.manual-match form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.compact-field { width: 180px; }
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--brand-navy);
  font: inherit;
}
select:focus {
  outline: 3px solid rgba(10, 163, 156, .16);
  border-color: var(--brand-teal);
}

.traceability-drawer {
  border-top: 1px solid var(--line);
  padding: 0;
}
.traceability-drawer > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: #fff;
}
.traceability-drawer > summary span {
  margin-left: 0;
  color: var(--brand-navy);
  font-weight: 800;
}
.traceability-drawer > summary small {
  color: var(--muted);
  font-weight: 500;
}
.traceability-drawer[open] > summary {
  border-bottom: 1px solid var(--line);
}

@media (max-width: 900px) {
  .workspace-head, .two-col, .review-layout, .package-layout, .package-browser, .creative-output-head, .artifact-grid, .campaign-home-grid, .handoff-browser, .detail-actions { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .workspace-head { margin: -20px -20px 24px; padding: 28px 20px; }
  main { padding: 20px; }
  .topbar { padding: 0 18px; }
  nav { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .flash-wrap { right: 12px; top: 82px; width: calc(100vw - 24px); }
  .upload-card { position: static; }
  .handoff-actions { align-items: stretch; flex-direction: column; }
  .handoff-tree { position: static; max-height: none; }
  .form-grid,
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .mapping {
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: start;
  }
  .mapping img {
    width: 82px;
    height: 82px;
  }
  .mapping h3 {
    font-size: 16px;
  }
  .mapping p {
    font-size: 13px;
  }
  .payload-fields {
    grid-template-columns: 1fr;
  }
  .confidence {
    grid-column: 2;
    text-align: left;
    font-size: 16px;
  }
  .package-rail {
    position: static;
  }
  .creative-output-head dl {
    grid-template-columns: 1fr;
  }
  .artifact-grid,
  .artifact-grid.lower {
    padding: 14px;
  }
  .creative-output > .artifact-panel {
    margin: 0 14px 14px;
  }
  .kv-table th {
    width: 120px;
  }
  .readiness-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .readiness-strip div:nth-child(2n) {
    border-right: 0;
  }
  .readiness-strip div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }
  .traceability-drawer > summary {
    align-items: start;
    flex-direction: column;
  }
  .manual-match form {
    grid-template-columns: 1fr;
  }
  .package-creative-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .package-creative-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .package-creative-actions .primary,
  .creative-search input {
    width: 100%;
    min-width: 0;
  }
  .row-actions {
    min-width: 0;
  }
  .row-edit form {
    position: static;
    width: 280px;
    box-shadow: none;
    margin-top: 8px;
  }
  .package-add-panel form {
    grid-template-columns: 1fr;
  }
  .jira-form {
    grid-template-columns: 1fr;
  }
  .review-panel .preview-grid {
    grid-template-columns: 1fr;
  }
  .review-panel .preview img {
    min-height: 240px;
  }
  .source-review-grid {
    grid-template-columns: 1fr;
  }
  .source-review-grid .source-asset-strip {
    overflow-x: auto;
  }
  .image-review-cell {
    min-width: 220px;
  }
  .image-replace form {
    width: 260px;
  }
}
