/* Sandbox workspace (/sandbox/<id>) and the small pieces approvals.css shares (.ox-badge, .ox-chip).
 * Tokens only: brand/tokens.css. Type 12/13/15/17/22, radii 6/10/16/999, shadows 1 and 2. */

.ox-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--ox-r-full);
  font-size: var(--ox-t-xs); font-weight: 600; white-space: nowrap;
  background: var(--ox-surface-2); color: var(--ox-ink-2);
}
.ox-badge.is-ok { background: color-mix(in srgb, var(--ox-ok) 12%, var(--ox-surface)); color: var(--ox-ok-ink); }
.ox-badge.is-warn { background: color-mix(in srgb, var(--ox-warn) 13%, var(--ox-surface)); color: var(--ox-warn-ink); }
.ox-badge.is-info { background: color-mix(in srgb, var(--ox-info) 12%, var(--ox-surface)); color: var(--ox-info-ink); }
.ox-badge.is-danger { background: color-mix(in srgb, var(--ox-danger) 12%, var(--ox-surface)); color: var(--ox-danger-ink); }
.ox-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ox-chip {
  font-size: var(--ox-t-xs); font-weight: 500; padding: 3px 9px; border-radius: var(--ox-r-full);
  background: var(--ox-surface-2); color: var(--ox-ink-2);
}

.sbw { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; background: var(--ox-bg); color: var(--ox-ink); }

/* Left: the app */
.sbw-app { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--ox-line); }
.sbw-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 16px;
  background: var(--ox-surface); border-bottom: 1px solid var(--ox-line); font-size: var(--ox-t-sm);
}
.sbw-name { font-weight: 600; }
.sbw-note { color: var(--ox-ink-3); flex: 1; min-width: 160px; }
.sbw-version { height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: var(--ox-r-sm);
  background: var(--ox-surface-2); font-weight: 600; color: var(--ox-ink-2); }
.sbw-stage { position: relative; flex: 1; min-height: 0; }
.sbw-frame, .sbw-iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--ox-surface); }
.sbw-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: color-mix(in srgb, var(--ox-surface) 82%, transparent); backdrop-filter: blur(2px);
  font-size: var(--ox-t-base); color: var(--ox-ink-2);
}
.sbw-overlay[hidden], .sbw-toast[hidden] { display: none; }
.sbw-toast {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 9px 14px; border-radius: var(--ox-r-md);
  background: var(--ox-brand); color: var(--ox-surface); font-size: var(--ox-t-sm); font-weight: 600; box-shadow: var(--ox-shadow-2);
}
.sbw-empty { max-width: 460px; margin: 0 auto; padding: 15% 20px 0; text-align: center; display: grid; gap: 10px; justify-items: center; }   /* padding, not margin: a top margin would leak out of the frame and leave a stripe */
.sbw-empty h2 { font-size: var(--ox-t-lg); font-weight: var(--ox-heading-weight); letter-spacing: var(--ox-heading-tracking); }
.sbw-empty p { color: var(--ox-ink-3); }

/* Right: Chat */
.sbw-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--ox-surface); }
.sbw-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ox-line); }
.sbw-head b { display: block; font-size: var(--ox-t-base); font-weight: 600; }
.sbw-head span:not(.sbw-who) { font-size: var(--ox-t-xs); color: var(--ox-ink-3); }
.sbw-who { width: 28px; height: 28px; border-radius: var(--ox-r-full); display: grid; place-items: center; background: var(--ox-brand); color: var(--ox-surface); flex: none; }
.sbw-orig { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: var(--ox-t-xs); color: var(--ox-accent); text-decoration: none; }
.sbw-orig:hover { text-decoration: underline; }
.sbw-steps { list-style: none; margin: 0; padding: 10px 16px; display: flex; gap: 14px; border-bottom: 1px solid var(--ox-line); font-size: var(--ox-t-xs); color: var(--ox-ink-3); }
.sbw-review-banner { margin: 12px 16px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--ox-warn) 30%, var(--ox-line)); border-radius: var(--ox-r-md); background: color-mix(in srgb, var(--ox-warn) 10%, var(--ox-surface)); color: var(--ox-ink); font-size: var(--ox-t-sm); }
.sbw-review-banner[hidden] { display: none; }
.sbw-step { display: flex; align-items: center; gap: 6px; }
.sbw-dot { width: 18px; height: 18px; border-radius: var(--ox-r-full); display: grid; place-items: center; border: 1.5px solid var(--ox-line-2); font-size: 10px; font-weight: 700; }
.sbw-step.is-done { color: var(--ox-ink); }
.sbw-step.is-done .sbw-dot { background: var(--ox-ok); border-color: var(--ox-ok); color: var(--ox-surface); }
.sbw-step.is-now { color: var(--ox-ink); font-weight: 600; }
.sbw-step.is-now .sbw-dot { border-color: var(--ox-accent); color: var(--ox-accent); }
.sbw-ctx { margin: 12px 16px 0; padding: 10px 12px; border-radius: var(--ox-r-md); background: var(--ox-bg); border: 1px solid var(--ox-line); display: grid; gap: 6px; }
.sbw-ctx b { font-size: var(--ox-t-xs); font-weight: 600; color: var(--ox-ink-3); }
.sbw-ctx .ox-chip { background: var(--ox-surface); border: 1px solid var(--ox-line); }
.sbw-ctx-note { margin: 0; font-size: var(--ox-t-xs); color: var(--ox-ink-3); }
.sbw-ctx-note:empty { display: none; }
.sbw-log { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.sbw-log > * { flex-shrink: 0; }   /* cards keep their full height; the log scrolls instead */
.sbw-bubble { font-size: var(--ox-t-base); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.sbw-bubble.is-me { align-self: flex-end; max-width: 88%; padding: 8px 12px; background: var(--ox-surface-2); border-radius: var(--ox-r-md) var(--ox-r-md) 4px var(--ox-r-md); }
.sbw-bubble.is-note { font-size: var(--ox-t-sm); color: var(--ox-ink-2); padding: 8px 12px; border-radius: var(--ox-r-md); background: var(--ox-brand-soft); }
.sbw-issue {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--ox-r-md);
  border: 1px solid color-mix(in srgb, var(--ox-danger) 28%, transparent);
  background: color-mix(in srgb, var(--ox-danger) 7%, var(--ox-surface));
}
.sbw-issue-title { display: flex; align-items: center; gap: 8px; color: var(--ox-danger-ink); font-weight: 600; font-size: var(--ox-t-sm); }
.sbw-issue code { align-self: flex-start; max-width: 100%; font-family: var(--ox-mono); font-size: var(--ox-t-xs); color: var(--ox-ink-2);
  background: color-mix(in srgb, var(--ox-surface) 75%, transparent); border-radius: var(--ox-r-sm); padding: 2px 6px; overflow-wrap: anywhere; }
.sbw-issue .btn { align-self: flex-start; }
.sbw-change { border: 1px solid var(--ox-line); border-radius: var(--ox-r-md); overflow: hidden; }
.sbw-change-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: var(--ox-t-xs); font-weight: 600;
  background: color-mix(in srgb, var(--ox-ok) 11%, var(--ox-surface)); color: var(--ox-ok-ink); }
.sbw-change ul { margin: 0; padding: 8px 12px 10px 28px; color: var(--ox-ink-2); font-size: var(--ox-t-xs); line-height: 1.6; }
.sbw-composer { margin: 0 16px 12px; display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--ox-line-2); border-radius: var(--ox-r-lg); padding: 8px 8px 8px 12px; }
.sbw-composer:focus-within { border-color: var(--ox-accent); }
.sbw-input { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: var(--ox-t-sm); color: var(--ox-ink); max-height: 140px; }
.sbw-send { width: 32px; height: 32px; padding: 0; justify-content: center; }
.sbw-foot { margin: 0 16px 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.sbw-foot .btn { flex: 1 1 auto; justify-content: center; }

@media (max-width: 900px) {
  /* One column that scrolls as a page: the app first, then the conversation at its natural height. */
  .sbw { grid-template-columns: 1fr; grid-template-rows: minmax(300px, 50vh) auto; overflow: auto; }
  .sbw-app { border-right: 0; border-bottom: 1px solid var(--ox-line); }
  .sbw-log { flex: none; overflow: visible; min-height: 120px; }
}

/* Publish an app: your apps in progress */
.subs-list { display: grid; gap: 8px; }
.subs-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 14px; border: 1px solid var(--ox-line); border-radius: var(--ox-r-md); background: var(--ox-surface); }
.subs-main { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.subs-row .subs-actions { margin: 0; }
.publish-developer { margin-top: 18px; }
.publish-developer > summary { cursor: pointer; color: var(--ox-accent); font-size: var(--ox-t-sm); font-weight: 600; padding: 6px 0; }
.publish-developer[open] > summary { margin-bottom: 12px; }

.sbw-empty h2, .sbw-head b { word-spacing: 0.06em; }

@media (max-width: 600px) {
  .sbw-send { width: 44px; height: 44px; }
}
