/* AgentForge-inspired: black canvas, charcoal surfaces, teal-green CTAs */
:root {
  --bg: #000000;
  --surface: #1a1a1a;
  --surface-elevated: #1e1e1e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: #9ca3af;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-dim: rgba(16, 185, 129, 0.15);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled,
.btn-primary[disabled] {
  background: #404040;
  color: rgba(255, 255, 255, 0.42);
  cursor: not-allowed;
}

/* Video generator connection status (Studio → External video jobs) */
.video-provider-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  align-items: center;
}
.video-provider-status__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: var(--panel);
  color: var(--text);
}
.video-provider-status__pill--ok {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}
.video-provider-status__pill--warn {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
  color: #b45309;
}
.video-provider-status__pill--muted {
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--muted);
  font-weight: 500;
}

.required-mark {
  color: #f87171;
  font-weight: 700;
  margin-left: 0.15em;
  text-decoration: none;
  cursor: help;
}

/* New integrator key preview: one line in card, horizontal scroll (no stray wrap). */
.api-key-copy-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
}
.api-key-copy-scroll pre.api-key-pre {
  margin: 0;
  white-space: nowrap;
  word-break: normal;
  overflow: visible;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
}

.btn-ghost {
  background: #2a2a2a;
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-weight: 500;
}
.btn-ghost:hover {
  background: #333333;
  border-color: rgba(255, 255, 255, 0.18);
}

.input,
.input-file {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
.analytics-event-label {
  font-weight: 500;
  color: var(--text);
}

.field-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  vertical-align: middle;
  color: var(--muted);
  cursor: help;
  line-height: 0;
}
.field-help-icon:hover,
.field-help-icon:focus-visible {
  color: var(--accent);
  outline: none;
}

.input:focus,
.input-file:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-area {
  min-height: 4rem;
  resize: vertical;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.field {
  margin-bottom: 0.25rem;
}

.form-errors {
  color: #ff3b30;
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

/* Keep long backend validation payloads inside form cards. */
.errorlist {
  margin: 0 0 0.45rem;
  padding-left: 1rem;
  color: #ff6961;
  font-size: 0.9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.errorlist li {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.msg {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.msg-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-hover);
}
.msg-info {
  background: rgba(156, 163, 175, 0.08);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.msg-error {
  background: rgba(255, 59, 48, 0.12);
  border: 1px solid rgba(255, 59, 48, 0.35);
  color: #ff6961;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list a {
  display: block;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.list a:hover {
  color: var(--accent);
  text-decoration: none;
}
.list li:last-child a {
  border-bottom: none;
}

.product-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}
.product-list-toolbar__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(100%, 11rem);
  flex: 1 1 10rem;
}
/* Second row: Origin + actions share one flex line so the select lines up with the buttons. */
.product-list-toolbar__tail {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 0.85rem;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}
.product-list-toolbar__field--origin {
  flex: 1 1 12rem;
  min-width: min(100%, 14rem);
  max-width: 28rem;
}
.product-list-toolbar__label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
/* Matches real label height so Apply/Clear sit on the same baseline as Search/Sort inputs. */
.product-list-toolbar__label--phantom {
  opacity: 0;
  pointer-events: none;
  user-select: none;
}
.product-list-toolbar__input,
.product-list-toolbar__select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.product-list-toolbar__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  flex: 0 0 auto;
  margin-left: auto;
}
.product-list-toolbar__actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.product-list__count {
  margin: 0 0 0.5rem;
}

.product-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.product-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.product-list__item:last-child {
  border-bottom: none;
}
.product-list__main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}
.product-list__thumb-wrap {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}
.product-list__thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}
.product-list__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}
.product-list__text {
  min-width: 0;
}
.product-list__name {
  color: var(--text);
  display: block;
}
.product-list__meta {
  display: block;
  margin: 0.15rem 0 0;
}
.product-list__edit {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.product-list__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.product-list__delete-form {
  margin: 0;
  display: inline;
}

.product-list__delete {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  margin-left: 0.5rem;
}
.status-ready {
  background: var(--accent-dim);
  color: var(--accent-hover);
}
.status-pending {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
}
.status-failed {
  background: rgba(255, 59, 48, 0.15);
  color: #ff6961;
}

/* Videos index – explicit column counts, no min() tricks */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1.75rem;
}
@media (min-width: 640px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }
}
@media (min-width: 960px) {
  .video-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }
}

.video-card {
  display: block;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(165deg, #141414 0%, #0c0c0c 100%);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 40px -24px rgba(0, 0, 0, 0.9);
  transition:
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.video-card:hover {
  text-decoration: none;
  border-color: rgba(16, 185, 129, 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(16, 185, 129, 0.12),
    0 28px 56px -20px rgba(0, 0, 0, 0.85),
    0 0 48px -30px rgba(16, 185, 129, 0.15);
  transform: translateY(-3px);
  color: var(--text);
}

.video-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.video-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #050505;
}

.video-card__thumb-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.video-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  vertical-align: middle;
  transform: scale(1.001);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

video.video-card__thumb--preview {
  pointer-events: none;
  background: #000;
}

.video-card:hover .video-card__thumb {
  transform: scale(1.06);
}

.video-card__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 80% 80% at 50% 40%, #1f1f1f 0%, #0a0a0a 70%);
}

.video-card__placeholder-glyph {
  font-size: 1.5rem;
  color: rgba(16, 185, 129, 0.5);
  line-height: 1;
  user-select: none;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.video-card__status {
  position: absolute;
  right: 0.55rem;
  top: 0.55rem;
  z-index: 2;
  margin-left: 0;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  background: rgba(8, 8, 8, 0.62) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.video-card__status.status-ready {
  border-color: rgba(16, 185, 129, 0.25);
}
.video-card__status.status-pending {
  border-color: rgba(251, 191, 36, 0.2);
}
.video-card__status.status-failed {
  border-color: rgba(255, 105, 97, 0.25);
}

.video-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.65rem 0.75rem 0.75rem;
  pointer-events: none;
  background: linear-gradient(
    185deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 38%,
    rgba(0, 0, 0, 0.55) 72%,
    rgba(0, 0, 0, 0.88) 100%
  );
  transition: padding 0.25s ease;
}

.video-card:hover .video-card__overlay {
  padding-bottom: 0.85rem;
}

.video-card__title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.85);
}

.video-card__overlay-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.video-card__duration {
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.82);
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-card__cta {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-hover);
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.video-card:hover .video-card__cta {
  opacity: 1;
  transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
  .video-card,
  .video-card__thumb,
  .video-card:hover,
  .video-card:hover .video-card__thumb,
  .video-card__overlay,
  .video-card:hover .video-card__overlay,
  .video-card__cta,
  .video-card:hover .video-card__cta {
    transition: none !important;
    transform: none !important;
  }
}

video.preview {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(72vh, 560px);
  border-radius: var(--radius);
  background: #000;
  object-fit: contain;
  vertical-align: middle;
  display: block;
  margin: 0 auto;
}

.tag-video-stage {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tag-video-inner {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  /* align-self: auto – inherit .tag-video-stage align-items:center (video editor) or
     .tag-shoppable-image-stage align-items:flex-start (image editor) */
}

.tag-video-stage video.preview {
  border-radius: 0;
  border: none;
  width: auto;
  max-width: 100%;
}

.tag-video-stage img.preview {
  border-radius: 0;
  border: none;
  width: auto;
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}

/* Shoppable image detail: match original preview size (not full-width video stage). */
.tag-video-stage.tag-shoppable-image-stage {
  width: fit-content;
  max-width: 100%;
  background: transparent;
  align-items: flex-start;
}

.tag-shoppable-image-stage .tag-video-inner {
  max-width: min(100%, 420px);
}

.tag-shoppable-image-stage img.tag-shoppable-editor-img {
  max-width: min(100%, 420px);
  width: auto;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
}

.tag-draw-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  touch-action: none;
}

.tag-draw-layer.is-active {
  pointer-events: auto;
  cursor: crosshair;
}

.tag-draw-rect {
  position: absolute;
  left: 0;
  top: 0;
  border: 2px solid var(--accent);
  background: rgba(16, 185, 129, 0.2);
  box-sizing: border-box;
  pointer-events: none;
  border-radius: 4px;
}

.tag-draw-trace-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
  display: block;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.tag-draw-mode-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.tag-draw-mode-group .tag-draw-mode-btn.is-selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(16, 185, 129, 0.12);
}

/* Readout + draw toolbar: centered under video / image stage */
.tag-editor-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 0.65rem;
  gap: 0.35rem;
  box-sizing: border-box;
}

.tag-editor-readout.tag-editor-hint {
  margin: 0;
  text-align: center;
  max-width: 42rem;
}

.tag-editor-controls .tag-editor-toolbar {
  margin-top: 0;
  width: 100%;
  justify-content: center;
}

.tag-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  align-items: center;
  justify-content: center;
}

.tag-editor-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Long tag-editor instructions: keep below the video so the draft overlay is never covered. */
.tag-editor-hint--below-stage {
  margin: 0.5rem 0 0;
  text-align: center;
  max-width: 42rem;
  align-self: center;
}

.tag-form-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.tag-form-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--muted);
}

/* Multi-tag draft: overlay on video */
.tag-draft-panel {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 0.4rem;
  width: min(46rem, calc(100% - 0.9rem));
  transform: translateX(-50%);
  z-index: 4;
  padding: 0.7rem 0.78rem 0.78rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.75) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  display: none;
  /* Stay inside the video frame; scroll internally so tall forms never clip the top (e.g. product name). */
  max-height: calc(100% - 0.85rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.tag-draft-panel.is-open {
  display: block;
}
.tag-draft-panel .tag-draft-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.58rem;
  margin-bottom: 0.5rem;
}
.tag-draft-new-block {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.58rem;
  align-content: start;
}
.tag-draft-new-block[hidden] {
  display: none !important;
}
.tag-draft-catalog-summary[hidden] {
  display: none !important;
}
.tag-draft-catalog-summary__line {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
}
.tag-draft-catalog-summary__edit {
  font-size: 0.78rem;
  margin-top: 0.35rem;
  display: inline-block;
}
.tag-mini-card__catalog-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-hover);
  margin-right: 0.35rem;
}
.tag-mini-card__title[readonly] {
  opacity: 0.92;
  cursor: default;
}
.tag-draft-field {
  display: flex;
  flex-direction: column;
  gap: 0.26rem;
}
.tag-draft-span-2 {
  grid-column: 1 / -1;
}
.tag-draft-section {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tag-draft-section-head {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.tag-draft-section-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.tag-draft-ship-row {
  display: flex;
  align-items: center;
}
.tag-draft-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text);
  margin: 0;
}
.tag-draft-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.tag-draft-switch input:focus-visible + .tag-draft-switch-ui {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tag-draft-switch-ui {
  position: relative;
  width: 2.5rem;
  height: 1.32rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tag-draft-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.32rem - 6px);
  height: calc(1.32rem - 6px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease;
}
.tag-draft-switch input:checked + .tag-draft-switch-ui {
  background: rgba(16, 185, 129, 0.4);
  border-color: rgba(16, 185, 129, 0.65);
}
.tag-draft-switch input:checked + .tag-draft-switch-ui::after {
  transform: translateX(1.12rem);
}
.tag-draft-switch-label {
  user-select: none;
}
.tag-draft-field-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
}
.tag-destination-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12.5rem;
  overflow: auto;
  padding: 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.3);
}
.tag-destination-country {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.tag-destination-country__head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.35rem 0.28rem 0.28rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tag-destination-country__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.35rem;
  margin: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.tag-destination-country__toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}
.tag-destination-country__caret {
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  font-size: 0.65rem;
  opacity: 0.85;
}
.tag-destination-country__count {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.tag-destination-country__all {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 0.15rem 0.25rem;
}
.tag-destination-country__all input {
  margin: 0;
}
.tag-destination-country__body {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.35rem 0.4rem 0.45rem 0.55rem;
}
.tag-destination-country__body[hidden] {
  display: none !important;
}
.tag-destination-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.42rem;
  padding: 0.28rem 0.38rem;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}
.tag-destination-item:hover {
  border-color: rgba(16, 185, 129, 0.35);
}
.tag-destination-item__label {
  font-size: 0.77rem;
  color: var(--text);
}
.tag-destination-item__meta {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}
.tag-destination-item--nested {
  padding: 0.22rem 0.32rem;
  gap: 0.32rem;
}
.tag-draft-labels-pair,
.tag-draft-time-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.tag-draft-time-section {
  padding: 0.5rem 0.65rem;
}
@media (max-width: 560px) {
  .tag-draft-panel .tag-draft-grid {
    grid-template-columns: 1fr;
  }
  .tag-draft-panel {
    width: calc(100% - 0.7rem);
    bottom: 0.25rem;
    padding: 0.62rem 0.64rem 0.64rem;
  }
  .tag-destination-item {
    grid-template-columns: auto 1fr;
  }
  .tag-destination-item__meta {
    grid-column: 2;
    white-space: normal;
  }
  .tag-draft-labels-pair,
  .tag-draft-time-pair {
    grid-template-columns: 1fr;
  }
}
.tag-draft-panel input,
.tag-draft-panel select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
}
.tag-draft-preview {
  float: right;
  width: 3.25rem;
  height: 3.25rem;
  object-fit: cover;
  border-radius: 8px;
  margin-left: 0.5rem;
  border: 1px solid var(--border);
}
.tag-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

/* Compact tag cards (grid) */
.tag-mini-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.tag-mini-card {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  min-height: 5.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tag-mini-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12);
}
.tag-mini-card__thumb-wrap {
  flex: 0 0 3.25rem;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border);
}
.tag-mini-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tag-mini-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tag-mini-card__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
}
.tag-mini-card__title {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  width: 100%;
}
.tag-mini-card__badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-hover);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}
.tag-mini-card__badge input {
  width: 4rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: right;
  padding: 0;
}
.tag-mini-card__meta {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tag-mini-card__meta input {
  flex: 1;
  min-width: 4rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
}
.tag-mini-card__ship-row {
  align-items: center;
}
.tag-mini-ship-wide {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
}
.tag-mini-ship-wide input {
  margin: 0;
}
.tag-mini-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.35rem;
}
.tag-mini-card__foot--image {
  justify-content: flex-end;
}
.tag-mini-card__time {
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.tag-mini-card__time input {
  width: 3.2rem;
  font-size: 0.68rem;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
}
.tag-mini-card__btns {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.tag-mini-card__btns .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
}
.tag-mini-card__btns .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.tag-mini-card__btns .btn-primary:disabled,
.tag-mini-card__btns .btn-primary[disabled] {
  background: #404040;
  color: rgba(255, 255, 255, 0.42);
}
.tag-currency-input {
  width: 2.5rem !important;
  font-size: 0.7rem !important;
  margin-left: 0.25rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
th,
td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-weight: 500;
}

.checkbox {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.code {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  word-break: break-all;
}

/* Order UUID links: keep on one line; table-wrap provides horizontal scroll if needed */
.code.code--uuid {
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
  display: inline-block;
  padding: 0.2rem 0.45rem;
  font-size: 0.68rem;
  max-width: max-content;
}

/* Inline pill for table status cells – avoids full-row height when a sibling cell is tall */
.code-badge {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.25;
  background: var(--surface);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
}

/* Readonly embed signing token: explicit fg/bg so UA “field” colors never yield invisible text */
.embed-token-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.embed-token-field {
  flex: 1;
  min-width: 0;
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.45rem 0.65rem;
  margin: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  overflow-x: auto;
}
.embed-token-field:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.embed-token-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.55rem;
  min-width: 2.5rem;
}

.stack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Integrations: catalog (Shopify/Woo) vs ShopOS checkout */
.integration-checkout-callout {
  max-width: 640px;
  margin-bottom: 1rem;
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.06);
}
.integration-checkout-callout__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.integration-checkout-callout__lead {
  margin: 0 0 0.55rem !important;
}
.integration-checkout-callout__list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.integration-checkout-callout__list li {
  margin-bottom: 0.4rem;
}
.integration-checkout-callout__list li:last-child {
  margin-bottom: 0;
}
.integration-checkout-callout__list strong {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
}

.btn-block {
  width: 100%;
}

/* – App shell (dashboard / infrastructure layout) – */
body.app-noscroll {
  overflow: hidden;
}

.layout-app {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
  background: var(--bg);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.52);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.layout-app--sidebar-open .sidebar-backdrop {
  display: block;
}

.app-sidebar {
  width: 15.25rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #141414 0%, #0f0f0f 100%);
  z-index: 50;
}

.app-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.05rem 1rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.app-sidebar__brand {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.app-sidebar__brand:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.app-sidebar__close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.app-sidebar__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.app-sidebar__nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem 0.65rem;
  overflow: auto;
  overscroll-behavior: contain;
}

.app-sidebar__group {
  margin-bottom: 0.65rem;
}

.app-sidebar__group + .app-sidebar__group {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.app-sidebar__group:first-child {
  margin-top: 0;
}

/* Category labels: rotate sage / slate / amber (muted, low saturation). Text vs pill bg ≥ WCAG AA for small text. */
.app-sidebar__label {
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.55rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-radius: 6px;
  border-left: 3px solid;
}

.app-sidebar__group:nth-child(3n + 1) .app-sidebar__label {
  color: #e8f0eb;
  background: #1a2420;
  border-left-color: #4d7a63;
}

.app-sidebar__group:nth-child(3n + 2) .app-sidebar__label {
  color: #e9ecf2;
  background: #1a1e24;
  border-left-color: #5c6a7a;
}

.app-sidebar__group:nth-child(3n + 3) .app-sidebar__label {
  color: #f2ebe0;
  background: #1f1c18;
  border-left-color: #8a7a55;
}

.app-sidebar__group:first-child .app-sidebar__label {
  margin-top: 0;
}

.app-sidebar__group-items {
  margin-left: 0.15rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar__link {
  display: block;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.app-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
}

.app-sidebar__link.is-active {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.app-sidebar__footer {
  padding: 1rem 0.85rem 1.15rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-sidebar__user {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__subtle {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
.app-sidebar__subtle:hover {
  color: var(--accent-hover);
}

.app-sidebar__logout {
  margin: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 35;
}

.app-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}
.app-menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.app-menu-btn__bars,
.app-menu-btn__bars::before,
.app-menu-btn__bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}
.app-menu-btn__bars::before,
.app-menu-btn__bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.app-menu-btn__bars::before {
  top: -5px;
}
.app-menu-btn__bars::after {
  top: 5px;
}

.app-topbar__crumb {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-messages {
  padding: 0.75rem 1.25rem 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.app-messages .msg:last-child {
  margin-bottom: 0.5rem;
}

.app-body {
  flex: 1;
  padding: 1.35rem 1.5rem 2.75rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Two-column main: primary (left half) + reserved aside (right half) – e.g. shoppable images list */
.studio-main-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: start;
  width: 100%;
}
.studio-main-split__primary {
  min-width: 0;
}
.studio-main-split__aside {
  min-height: 1px;
}

/* Collapsible sidebar + top bar (tablets / phones) */
@media (max-width: 900px) {
  .layout-app {
    flex-direction: column;
  }

  .app-topbar {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(17.5rem, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: none;
  }

  .layout-app--sidebar-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
  }

  .app-sidebar__close {
    display: inline-flex;
  }

  .app-messages,
  .app-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .studio-main-split {
    grid-template-columns: 1fr;
  }
  .studio-main-split__aside {
    display: none;
  }
}

@media (min-width: 901px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
  }

  .layout-app--sidebar-open .sidebar-backdrop {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    transition: none !important;
  }
}

/* Auth-only pages (no sidebar) */
.layout-auth {
  min-height: 100vh;
  padding: 0 1.1rem 3rem;
}

.auth-header {
  display: flex;
  align-items: center;
  padding: 1rem 0 1.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.auth-header .brand {
  text-decoration: none;
}
.auth-header .brand:hover {
  color: var(--accent-hover);
}

.layout-auth__messages {
  max-width: 560px;
  margin: 0 auto 1rem;
}

.auth-header--portal {
  justify-content: space-between;
  gap: 1rem;
}

.auth-header__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  font-size: 0.88rem;
}

.auth-header__nav a {
  color: var(--muted);
  text-decoration: none;
}

.auth-header__nav a:hover {
  color: var(--accent-hover);
}

.integration-grid {
  display: grid;
  gap: 0.85rem;
  max-width: 720px;
  margin-top: 1.25rem;
}

@media (min-width: 560px) {
  .integration-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.integration-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.integration-card:hover {
  text-decoration: none;
  color: inherit;
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12);
}

.integration-card--muted {
  opacity: 0.72;
  cursor: default;
}

.integration-card__name {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.integration-card__hint {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.integration-card__cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-hover);
  margin-top: 0.25rem;
}

.doc-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 40rem;
}
.doc-index-list li {
  margin: 0.65rem 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.doc-index-intro {
  margin-bottom: 1rem;
  max-width: 40rem;
}
.doc-index-list__item--pinned {
  border-bottom-color: rgba(16, 185, 129, 0.25);
  padding-top: 0.15rem;
}
.doc-index-pinned-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.45);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.docs-search-form {
  margin-bottom: 1.35rem;
  max-width: 42rem;
}
.docs-search-form__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.docs-search-form__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.docs-search-form__input {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}
.docs-search-form__submit {
  flex: 0 0 auto;
}
.docs-search-form__hint {
  margin-top: 0.5rem;
  margin-bottom: 0;
  max-width: 40rem;
}
.docs-search-form__error {
  color: #b45309;
  margin-top: 0.75rem;
}
.docs-search-results__item {
  margin-bottom: 1rem;
}
.docs-search-results__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}
.docs-search-results__badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}
.docs-search-results__snippet {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 48rem;
}

.doc-page.doc-content {
  max-width: 52rem;
  padding-bottom: 2rem;
}
.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 1.35rem 0 0.65rem;
  line-height: 1.3;
}
.doc-content h1 {
  font-size: 1.45rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.doc-content h2 {
  font-size: 1.15rem;
}
.doc-content h3 {
  font-size: 1.02rem;
}
.doc-content p {
  margin: 0.5rem 0 0.85rem;
  color: var(--text);
  line-height: 1.55;
}
.doc-content ul,
.doc-content ol {
  margin: 0.35rem 0 0.85rem;
  padding-left: 1.35rem;
  color: var(--text);
  line-height: 1.5;
}
.doc-content li {
  margin: 0.25rem 0;
}
.doc-content a {
  color: var(--accent);
}
.doc-content a:hover {
  color: var(--accent-hover);
}
.doc-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
.doc-content pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0.65rem 0 1rem;
  font-size: 0.82rem;
  line-height: 1.45;
}
.doc-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.doc-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0.75rem 0 1rem;
}
.doc-content th,
.doc-content td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
}
.doc-content th {
  background: rgba(0, 0, 0, 0.25);
  font-weight: 600;
}
.doc-content blockquote {
  margin: 0.65rem 0;
  padding: 0.35rem 0 0.35rem 0.85rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

/* Runway queue: catalog + motion prompt templates */
.runway-fields-panel {
  --runway-chip-bg: rgba(255, 255, 255, 0.04);
  --runway-chip-border: rgba(255, 255, 255, 0.1);
}
.runway-prompt-textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 6.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.runway-prompt-textarea:hover {
  border-color: rgba(255, 255, 255, 0.18);
}
.runway-prompt-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.runway-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.runway-prompt-chip {
  appearance: none;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--runway-chip-border);
  background: var(--runway-chip-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.runway-prompt-chip:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #fff;
}
.runway-prompt-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.runway-prompt-chip.is-selected {
  background: var(--accent-dim);
  border-color: rgba(16, 185, 129, 0.55);
  color: #fff;
}

/* External video jobs queue: submit after provider fields */
.external-job-form-actions {
  margin-top: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.external-job-submit-hint {
  color: var(--muted);
  max-width: 36rem;
}
.mock-artifact-fields {
  padding: 0.75rem 0.9rem;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-width: 40rem;
}

/* Video job wizard (multi-step + provider registry) */
.video-job-wizard-card {
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
  background: linear-gradient(165deg, rgba(30, 30, 30, 0.98) 0%, var(--surface-elevated) 100%);
}
.video-job-wizard__header {
  margin-bottom: 1rem;
}
.video-job-wizard__title {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.video-job-wizard__lede {
  margin: 0 0 0.85rem;
  line-height: 1.5;
  max-width: 42rem;
}
.video-job-wizard__api-hint {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  opacity: 0.88;
}
.video-job-wizard__progress {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.video-job-wizard__step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.video-job-wizard__step.is-active {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.1);
  color: var(--text);
}
.video-job-wizard__step.is-done {
  border-color: rgba(16, 185, 129, 0.25);
  color: rgba(255, 255, 255, 0.75);
}
.video-job-wizard__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 600;
}
.video-job-wizard__panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.05rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}
.video-job-wizard__panel.is-hidden,
.video-job-wizard__panel[hidden] {
  display: none !important;
}
.video-job-wizard__panel-title {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
  font-weight: 600;
}
.video-job-wizard__panel-desc {
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
  line-height: 1.45;
}
.video-job-archetype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.55rem;
}
.video-job-archetype-card {
  display: block;
  cursor: pointer;
  margin: 0;
}
.video-job-archetype-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.video-job-archetype-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  min-height: 3.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.video-job-archetype-card input:focus-visible + .video-job-archetype-card__body {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.video-job-archetype-card input:checked + .video-job-archetype-card__body {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
}
.video-job-archetype-card__title {
  font-weight: 600;
  font-size: 0.86rem;
}
.video-job-archetype-card__tag {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}
.video-job-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
  gap: 0.55rem;
}
.video-job-provider-grid > .video-job-provider-card {
  min-width: 0;
}
.video-job-provider-card {
  display: block;
  cursor: pointer;
  margin: 0;
}
.video-job-provider-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.video-job-provider-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  min-height: 6.5rem;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.video-job-provider-card input:checked + .video-job-provider-card__body {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.08);
}
.video-job-provider-card.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.video-job-provider-card.is-disabled .video-job-provider-card__body {
  filter: grayscale(0.3);
}
.video-job-provider-card__badge {
  align-self: flex-start;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.video-job-provider-card__badge--test {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}
.video-job-provider-card__badge--integration {
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
}
.video-job-provider-card__badge--ai {
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.video-job-provider-card__name {
  font-weight: 650;
  font-size: 0.92rem;
}
.video-job-provider-card__sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}
.video-job-provider-card__soon {
  font-size: 0.72rem;
  color: #a78bfa;
  font-weight: 600;
}
.video-job-provider-card__warn {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: #fbbf24;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.video-job-provider-card__code {
  display: inline;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.62rem;
  word-break: break-all;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.1em 0.25em;
  border-radius: 4px;
  vertical-align: baseline;
}
.video-job-wizard__fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.video-job-wizard__full {
  width: 100%;
  max-width: 40rem;
}
.video-job-wizard__input {
  width: 100%;
  max-width: 40rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}
.video-job-product-fieldset {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin: 0;
}
.video-job-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.4rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.15rem 0;
}
.video-job-product-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid transparent;
}
.video-job-product-tile:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.video-job-product-tile input {
  margin-top: 0.15rem;
}
.video-job-runway-panel {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.video-job-runway-adv {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}
.video-job-review {
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}
.video-job-review__dl {
  margin: 0;
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.86rem;
}
.video-job-review__dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}
.video-job-review__dl dd {
  margin: 0;
}
.video-job-wizard__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.video-job-wizard__submit {
  margin-left: auto;
}
.video-job-wizard__hint {
  flex: 1 1 100%;
  margin: 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: var(--muted);
}
.mock-artifact-fields.is-hidden,
.mock-artifact-fields[hidden] {
  display: none !important;
}
.video-job-runway-panel.is-hidden,
.video-job-runway-panel[hidden] {
  display: none !important;
}

/* Native <dialog> – remove media, tombstone snapshot messaging */
.studio-dialog {
  max-width: 28rem;
  width: calc(100vw - 2rem);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.studio-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.studio-dialog__header {
  padding: 1rem 1.25rem 0;
}
.studio-dialog__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.studio-dialog__body {
  padding: 0.85rem 1.25rem 1rem;
}
.studio-dialog__body .sub {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.studio-dialog__body ul.studio-dialog__missing {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}
.studio-dialog__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.25rem 1.1rem;
  border-top: 1px solid var(--border);
}
.studio-dialog__info {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}
.studio-dialog__info-trigger {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  font-style: italic;
  user-select: none;
}
.studio-dialog__info-trigger::-webkit-details-marker {
  display: none;
}
.studio-dialog__info[open] .studio-dialog__info-trigger {
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.45);
}
.studio-dialog__info-panel {
  margin-top: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.studio-dialog__info-panel .sub {
  margin: 0;
  font-size: 0.85rem;
}
