/* Trust Bar editor chrome — marketplace playground / demo builder.
   Uses marketplace theme tokens; does not restyle the app preview theme. */

.tb-ed-root {
  font-family: var(--theme-body-font, var(--body, system-ui, sans-serif));
  color: var(--theme-text, var(--ink, #2e2a2b));
}

.tb-ed-banner {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--theme-radius-small, 10px);
  background: var(--theme-accent-soft, rgba(168, 74, 94, 0.12));
  color: var(--theme-text, var(--ink));
  margin-bottom: 6px;
  border: 1px solid var(--theme-border, var(--line));
}

.tb-ed-banner-safe {
  background: color-mix(in srgb, var(--theme-primary, var(--orange, #C85A2C)) 10%, #fff);
  border-color: color-mix(in srgb, var(--theme-primary, var(--orange, #C85A2C)) 22%, transparent);
}

/* Left (Items + Content) | Style — tinted Style zone separates the columns */
.tb-ed-zones {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.85fr);
  gap: 12px;
  align-items: start;
}

.tb-ed-zones-single {
  grid-template-columns: 1fr;
}

/* Portrait stack: full-width single column (must beat .tb-ed-copyheavy 2-col rules) */
.tb-ed-stack.tb-ed-root .tb-ed-zones,
.tb-ed-stack.tb-ed-root.tb-ed-copyheavy .tb-ed-zones,
.tb-ed-stack.tb-ed-root.tb-ed-sec-textBox .tb-ed-zones,
.tb-ed-stack.tb-ed-copyheavy.tb-ed-root .tb-ed-zones {
  grid-template-columns: minmax(0, 1fr);
}

.tb-ed-stack .tb-ed-zone-left,
.tb-ed-stack .tb-ed-zone-content,
.tb-ed-stack .tb-ed-zone-style,
.tb-ed-stack .tb-ed-zones > * {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.tb-ed-stack .tb-ed-zone-content .tb-ed-color-grid,
.tb-ed-stack .tb-ed-zone-style .tb-ed-color-grid,
.tb-ed-stack .tb-ed-color-grid,
.tb-ed-stack.tb-ed-root .tb-ed-zone-style .tb-ed-color-grid {
  grid-template-columns: minmax(0, 1fr);
}

.tb-ed-stack .tb-ed-card .tin,
.tb-ed-stack .tb-ed-card input[type="text"],
.tb-ed-stack .tb-ed-card input[type="url"],
.tb-ed-stack .tb-ed-card input[type="number"],
.tb-ed-stack .tb-ed-card textarea,
.tb-ed-stack .tb-ed-card select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tb-ed-stack .tb-ed-textarea-f textarea {
  min-height: 112px;
}

.tb-ed-stack .tb-ed-textarea-main textarea {
  min-height: 168px;
}

.tb-ed-zone-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Custom section style — shaded group; fields only matter when enabled */
.tb-ed-app-box {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 12px 12px 10px;
  border-radius: 10px;
  background: rgba(0, 21, 41, 0.06);
  border: 1px solid rgba(0, 21, 41, 0.12);
}

.tb-ed-app-box.on {
  background: rgba(0, 21, 41, 0.09);
  border-color: rgba(0, 21, 41, 0.18);
}

.tb-ed-app-head .tb-ed-check-f {
  margin-bottom: 0;
}

.tb-ed-app-hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--theme-text-muted, var(--mut, #5c6778));
  font-weight: 500;
}

.tb-ed-app-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 21, 41, 0.1);
}

.tb-ed-app-fields[hidden] {
  display: none !important;
}

/* Dual colour pairs: bg|eyebrow, stroke|title, intro spans when alone */
.tb-ed-app-fields > .tb-ed-field,
.tb-ed-app-fields > .tb-ed-color-f,
.tb-ed-app-fields > .tb-ed-f,
.tb-ed-app-fields > .f {
  min-width: 0;
}

.tb-ed-stack .tb-ed-app-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 360px) {
  .tb-ed-app-fields,
  .tb-ed-stack .tb-ed-app-fields {
    grid-template-columns: 1fr;
  }
}

.tb-ed-zone-items,
.tb-ed-zone-content,
.tb-ed-zone-style {
  margin-bottom: 0;
  min-width: 0;
}

.tb-ed-zone-items,
.tb-ed-zone-style {
  height: auto;
}

.tb-ed-zone-content .tb-ed-color-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Textareas / images span the content grid so copy editors use the full column */
.tb-ed-span-2 {
  grid-column: 1 / -1;
}

.tb-ed-textarea-f textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.45;
  font-size: 13.5px;
}

.tb-ed-textarea-main textarea {
  min-height: 180px;
}

/* Apps with copy + style only (e.g. Text Box) — give the left column more room */
.tb-ed-copyheavy.tb-ed-root .tb-ed-zones,
.tb-ed-sec-textBox .tb-ed-zones {
  grid-template-columns: minmax(0, 1.75fr) minmax(220px, 0.85fr);
}

/* Portrait stack must win over copyheavy / textBox split above */
.tb-ed-stack.tb-ed-root.tb-ed-copyheavy .tb-ed-zones,
.tb-ed-stack.tb-ed-root.tb-ed-sec-textBox .tb-ed-zones,
.tb-ed-stack.tb-ed-sec-textBox .tb-ed-zones {
  grid-template-columns: minmax(0, 1fr);
}

.tb-ed-sec-textBox .tb-ed-zone-content .tb-ed-color-grid {
  gap: 10px 12px;
}

.tb-ed-sec-textBox .tb-ed-textarea-main textarea {
  min-height: 200px;
}

@media (min-width: 1100px) {
  .tb-ed-stack.tb-ed-root .tb-ed-zone-style .tb-ed-color-grid,
  .tb-ed-stack .tb-ed-zone-content .tb-ed-color-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tb-ed-zone-style {
  /* Fallback first for older iOS, then color-mix when supported */
  background: rgba(168, 74, 94, 0.08);
  background: color-mix(in srgb, var(--theme-primary, var(--rose, #a84a5e)) 12%, #fff);
  border-color: rgba(168, 74, 94, 0.28);
  border-color: color-mix(in srgb, var(--theme-primary, var(--rose, #a84a5e)) 28%, var(--theme-border, #e4d5cd));
  box-shadow: inset 0 0 0 1px rgba(168, 74, 94, 0.06);
}

.tb-ed-zone-style .tin,
.tb-ed-zone-style input[type="text"],
.tb-ed-zone-style select,
.tb-ed-zone-style .tb-ed-hex {
  background: #fff;
}

.tb-ed-zone-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--theme-primary, var(--rose, #a84a5e));
  margin: 0 0 8px;
}

.tb-ed-card {
  background: var(--theme-surface, #fff);
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

.tb-ed-card-tight {
  padding: 8px 10px 6px;
}

.tb-ed-card h2 {
  font-family: var(--theme-heading-font, var(--disp, Georgia, serif));
  font-size: 0.95rem;
  font-weight: 400;
  margin: 0;
}

.tb-ed-card .lede { display: none; }

.tb-ed-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 10px;
  margin-bottom: 6px;
  align-items: end;
}

.tb-ed-zone-style .tb-ed-toolbar {
  grid-template-columns: 1fr;
}

.tb-ed-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  margin-top: 2px;
}

.tb-ed-zone-style .tb-ed-color-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 1100px) {
  .tb-ed-zone-style .tb-ed-color-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tb-ed-stack .tb-ed-zone-style .tb-ed-color-grid,
  .tb-ed-stack .tb-ed-zone-content .tb-ed-color-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep side-by-side on iPad / tablet; stack only on narrow phones */
@media (max-width: 640px) {
  .tb-ed-zones {
    grid-template-columns: 1fr;
  }

  .tb-ed-zone-style .tb-ed-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .tb-ed-zone-style .tb-ed-color-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tb-ed-card .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  margin-bottom: 4px;
}

.tb-ed-card .f label,
.tb-ed-f label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--theme-text-muted, var(--mut));
}

.tb-ed-card .tin,
.tb-ed-card input[type="text"],
.tb-ed-card input[type="url"],
.tb-ed-card textarea,
.tb-ed-card select {
  width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
  background: var(--theme-surface, #fff);
  color: inherit;
  line-height: 1.25;
}

.tb-ed-card input[type="range"] {
  width: 100%;
  touch-action: none;
}

.tb-ed-color {
  display: flex;
  gap: 4px;
  align-items: center;
}

.tb-ed-color input[type="color"] {
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  flex: 0 0 auto;
}

.tb-ed-hex {
  width: 4.75rem !important;
  flex: 0 0 4.75rem !important;
  max-width: 4.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px !important;
  padding: 4px 6px !important;
}

.tb-ed-clr {
  flex: 0 0 auto;
  min-width: 28px;
  padding: 3px 6px !important;
}

.tb-ed-check-f {
  display: flex;
  align-items: flex-end;
  padding-bottom: 2px;
}

.tb-ed-card .ck {
  display: flex;
  gap: 5px;
  align-items: center;
  font-weight: 600;
  font-size: 12px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  color: inherit;
}

.tb-ed-card .btn.ghost.sm {
  appearance: none;
  border: 1px solid var(--theme-border, var(--line));
  background: transparent;
  border-radius: 6px;
  padding: 3px 7px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--theme-text-muted, var(--mut));
}

.tb-ed-card .btn.ghost.sm:hover {
  border-color: var(--theme-primary, var(--rose));
  color: var(--theme-primary-hover, var(--rose-d));
}

/* Items card + tabs */
.tb-ed-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tb-ed-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--theme-border, var(--line));
}

.tb-ed-tab {
  appearance: none;
  border: 1px solid var(--theme-border, var(--line, #e7e7e7));
  background: var(--theme-surface, #fff);
  border-radius: 999px;
  padding: 3px 8px 3px 5px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--theme-text-muted, var(--mut));
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
}

.tb-ed-tab-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-text, #2e2a2b) 10%, transparent);
  font-size: 10px;
  font-weight: 800;
}

.tb-ed-tab-l {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-ed-tab:hover {
  border-color: var(--theme-primary, var(--rose));
  color: var(--theme-text, var(--ink));
}

.tb-ed-tab.on {
  background: var(--theme-primary, var(--rose));
  border-color: var(--theme-primary, var(--rose));
  color: #fff;
}

.tb-ed-tab.on .tb-ed-tab-n {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.tb-ed-tab.off { opacity: 0.55; }
.tb-ed-tab.off.on { opacity: 0.85; }

.tb-ed-item {
  border: 1px solid var(--theme-border, var(--line, #e7e7e7));
  border-radius: 8px;
  padding: 8px;
  background: var(--theme-surface, #fff);
}

.tb-ed-item-panel { margin: 0; }

.tb-ed-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.tb-ed-item-actions { display: flex; gap: 3px; }

.tb-ed-item-actions button {
  appearance: none;
  border: 1px solid var(--theme-border, var(--line));
  background: var(--theme-surface, #fff);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--theme-text-muted, var(--mut));
  padding: 2px 6px;
}

.tb-ed-item-actions button:hover {
  border-color: var(--theme-primary, var(--rose));
  color: var(--theme-text, var(--ink));
}

.tb-ed-item-actions button.danger {
  color: var(--theme-danger, #b42318);
  border-color: color-mix(in srgb, var(--theme-danger, #b42318) 35%, var(--theme-border, #e4d5cd));
}

.tb-ed-item-main {
  margin: 0 !important;
  align-items: start;
}

.tb-ed-text-f { grid-column: span 1; }
.tb-ed-img-f { margin-bottom: 4px; }
.tb-ed-fit-row { margin-bottom: 4px !important; }

.tb-ed-empty {
  margin: 0;
  font-size: 12px;
  color: var(--theme-text-muted, var(--mut));
}

/* Chip list — suburbs / newline-joined string arrays in compact playground */
.tb-ed-chiplist {
  grid-column: 1 / -1;
}

.tb-ed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
  min-height: 28px;
}

.tb-ed-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 999px;
  background: var(--theme-surface, #fff);
  font-size: 12px;
  font-weight: 600;
  color: var(--theme-text, var(--ink));
  line-height: 1.3;
}

.tb-ed-chip-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--theme-text-muted, var(--mut));
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 0 6px 0 2px;
  border-radius: 999px;
}

.tb-ed-chip-x:hover {
  color: var(--theme-primary, var(--rose));
  background: var(--theme-accent-soft, rgba(168, 74, 94, 0.12));
}

.tb-ed-chip-add {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tb-ed-chip-add .tin {
  flex: 1 1 auto;
  min-width: 0;
}

.tb-ed-chip-add .tb-ed-add {
  flex: 0 0 auto;
}

.tb-ed-add {
  appearance: none;
  border: 1px dashed var(--theme-border-strong, var(--line));
  background: var(--theme-surface, #fff);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--theme-text, var(--ink));
  flex: 0 0 auto;
}

.tb-ed-add:hover {
  border-color: var(--theme-primary, var(--rose));
  color: var(--theme-primary-hover, var(--rose-d));
}

.tb-ed-card :focus-visible,
.tb-ed-item :focus-visible,
.tb-ed-tab:focus-visible,
.tb-ed-add:focus-visible {
  outline: 3px solid var(--theme-focus, var(--rose));
  outline-offset: 2px;
}

.tb-ed-compact .tb-ed-card {
  padding: 7px 9px;
  margin-bottom: 5px;
}

.tb-ed-compact .tb-ed-item textarea {
  min-height: 36px;
}

.tb-ed-compact .tb-ed-tab-l { max-width: 64px; }

.tb-ed-compact .tb-ed-zones {
  gap: 8px;
}

@media (max-width: 520px) {
  .tb-ed-tab-l { display: none; }
  .tb-ed-tab { padding: 3px 7px; }
  .tb-ed-zone-style .tb-ed-toolbar,
  .tb-ed-zone-style .tb-ed-color-grid {
    grid-template-columns: 1fr 1fr;
  }
}
