/* SM-CAMPAIGNS-01 R2 — Shared interaction primitives (direction skins override look) */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.proto-banner {
  position: sticky; top: 0; z-index: 200;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  padding: 0.4rem 1rem; background: #0f172a; color: #cbd5e1; font-size: 0.75rem;
}
.proto-banner strong { color: #fff; }
.proto-banner a { color: #93c5fd; text-decoration: none; padding: 0.15rem 0.45rem; border-radius: 4px; }
.proto-banner a:hover, .proto-banner a.is-on { background: rgba(59,130,246,0.25); color: #fff; }
.proto-banner .proto-links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.25rem; }

.demo-bar {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  padding: 0.45rem 1rem; background: #1e293b; color: #94a3b8; font-size: 0.72rem;
}
.demo-bar button {
  border: 1px solid #334155; background: transparent; color: #e2e8f0;
  padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.72rem;
}
.demo-bar button.is-active { background: #2563eb; border-color: #2563eb; }
.demo-bar .note { margin-left: 0.5rem; }

.unsaved-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.45rem 1rem; background: #fff7ed; color: #9a3412;
  border-bottom: 1px solid #fdba74; font-size: 0.84rem;
}
.unsaved-bar[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border-radius: 6px; border: 1px solid transparent; padding: 0.45rem 0.85rem;
  font-weight: 600; font-size: 0.84rem; background: #e2e8f0; color: #0f172a;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary.is-dirty { box-shadow: 0 0 0 2px #93c5fd; }
.btn-secondary { background: #fff; border-color: #cbd5e1; }
.btn-ghost { background: transparent; border-color: transparent; color: #475569; }
.btn-danger-outline { background: #fff; border-color: #fca5a5; color: #b91c1c; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn-xs { padding: 0.15rem 0.4rem; font-size: 0.72rem; }
.btn-block { width: 100%; }

.toast-host { position: fixed; right: 1rem; bottom: 1rem; z-index: 400; display: flex; flex-direction: column; gap: 0.4rem; }
.toast {
  background: #0f172a; color: #f8fafc; padding: 0.65rem 0.9rem; border-radius: 8px;
  font-size: 0.84rem; box-shadow: 0 8px 24px rgba(15,23,42,0.25); max-width: 22rem;
}

.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 300;
  display: none; align-items: flex-start; justify-content: center; padding: 5vh 1rem; overflow: auto;
}
.overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: min(560px, 100%);
  box-shadow: 0 20px 50px rgba(15,23,42,0.25); max-height: 90vh; display: flex; flex-direction: column;
}
.modal.wide { width: min(760px, 100%); }
.modal-head, .modal-foot {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.modal-foot { border-bottom: 0; border-top: 1px solid #e2e8f0; justify-content: flex-end; }
.modal-head h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.modal-body { padding: 1rem; overflow: auto; }

.pick-item {
  display: flex; flex-direction: column; gap: 0.15rem; width: 100%; text-align: left;
  padding: 0.55rem 0.65rem; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; margin-bottom: 0.4rem;
}
.pick-item:hover { border-color: #2563eb; background: #eff6ff; }
.pick-item code { font-size: 0.75rem; color: #64748b; }

.tok { display: inline; padding: 0.05rem 0.3rem; border-radius: 4px; font-weight: 600; }
.tok-ok { background: #dcfce7; color: #166534; }
.tok-fb { background: #ffedd5; color: #9a3412; border-bottom: 1px dashed #ea580c; }
.tok-miss { background: #fee2e2; color: #991b1b; }

.example-mark {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: #92400e; background: #fef3c7; padding: 0.1rem 0.35rem; border-radius: 3px;
}

.status-pill {
  display: inline-flex; align-items: center; padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.status-pill.pending { background: #e2e8f0; color: #334155; }
.status-pill.active { background: #dcfce7; color: #166534; }
.status-pill.paused { background: #ffedd5; color: #9a3412; }
.status-pill.completed { background: #dbeafe; color: #1e40af; }
.status-pill.cancelled { background: #fee2e2; color: #991b1b; }

.metric-strip { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: baseline; }
.metric .m-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.metric .m-val { font-size: 1.1rem; font-weight: 700; }

.ready-item {
  display: flex; align-items: center; gap: 0.65rem; width: 100%; text-align: left;
  padding: 0.55rem 0.65rem; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; margin-bottom: 0.35rem;
}
.ready-item .ri-icon {
  width: 1.4rem; height: 1.4rem; border-radius: 999px; display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.ready-item.ok .ri-icon { background: #dcfce7; color: #166534; }
.ready-item.warn .ri-icon { background: #ffedd5; color: #9a3412; }
.ready-item.bad .ri-icon { background: #fee2e2; color: #991b1b; }
.ready-item .ri-text { display: flex; flex-direction: column; gap: 0.1rem; flex: 1; min-width: 0; }
.ready-item .ri-text span { font-size: 0.78rem; color: #64748b; }
.ready-item .ri-go { font-size: 0.72rem; font-weight: 700; color: #2563eb; }
.ready-list.compact .ready-item { padding: 0.4rem 0.5rem; }

.diag-row { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.4rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.84rem; }
.diag-row.bad strong { color: #b91c1c; }
.diag-row.ok strong { color: #166534; }
.diag-passed { margin-top: 0.5rem; font-size: 0.8rem; color: #64748b; }

.callout { padding: 0.75rem 0.9rem; border-radius: 8px; margin: 0.75rem 0; font-size: 0.84rem; }
.callout.info { background: #eff6ff; color: #1e3a8a; }
.callout.warn { background: #fff7ed; color: #9a3412; }

.hint { font-size: 0.75rem; color: #64748b; }
.sub { font-size: 0.84rem; color: #64748b; margin: 0.25rem 0 0; }
.disable-reason { font-size: 0.75rem; color: #b91c1c; margin-top: 0.35rem; }
.is-highlight { outline: 2px solid #2563eb; outline-offset: 3px; animation: pulse 1.2s ease 2; }
@keyframes pulse { 50% { outline-color: #93c5fd; } }
.field.is-error input, .field.is-error select { border-color: #ef4444; }
.error-text { color: #b91c1c; font-size: 0.75rem; margin-top: 0.25rem; }

.field { margin-bottom: 0.75rem; }
.field label { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; margin-bottom: 0.25rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.55rem 0.65rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
}
.field textarea { min-height: 12rem; resize: vertical; line-height: 1.5; }

.seq-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: start; }
.seq-layout.is-collapsed { grid-template-columns: 64px 1fr; }
.seq-layout.is-collapsed .step-meta, .seq-layout.is-collapsed .wait-pill em, .seq-layout.is-collapsed .spine-head strong { display: none; }
.spine-list { list-style: none; margin: 0; padding: 0; }
.spine-step button {
  display: flex; gap: 0.55rem; width: 100%; text-align: left; padding: 0.55rem; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
}
.spine-step.is-active button { background: #eff6ff; border-color: #bfdbfe; }
.step-ico {
  width: 1.6rem; height: 1.6rem; border-radius: 999px; background: #e2e8f0; display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.spine-step.initial .step-ico { background: #2563eb; color: #fff; }
.spine-wait { padding: 0.25rem 0 0.25rem 0.7rem; position: relative; }
.wait-line { position: absolute; left: 1.35rem; top: 0; bottom: 0; width: 2px; background: #cbd5e1; }
.wait-pill {
  position: relative; display: inline-flex; align-items: center; gap: 0.25rem; flex-wrap: wrap;
  background: #f8fafc; border: 1px dashed #94a3b8; border-radius: 999px; padding: 0.2rem 0.55rem;
  font-size: 0.72rem; color: #475569; z-index: 1;
}
.wait-pill input { width: 2.6rem; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.1rem 0.25rem; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.mode-toggle { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden; }
.mode-toggle button { border: 0; background: #fff; padding: 0.3rem 0.65rem; font-size: 0.75rem; font-weight: 600; }
.mode-toggle button.is-on { background: #2563eb; color: #fff; }
.editor-inspector { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid #e2e8f0; }
.insp-row { margin-bottom: 0.65rem; font-size: 0.84rem; }
.chip {
  display: inline-flex; margin: 0.15rem; padding: 0.2rem 0.45rem; border-radius: 999px;
  border: 1px solid #cbd5e1; background: #f8fafc; font-size: 0.72rem;
}

.progress-viz { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #e2e8f0; }
.bar-seg { height: 100%; }
.seg-muted { background: #94a3b8; }
.seg-info { background: #3b82f6; }
.seg-ok { background: #22c55e; }
.legend { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.78rem; }
.legend i { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 2px; margin-right: 0.3rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; padding: 0.4rem; border-bottom: 1px solid #e2e8f0; }
.data-table td { padding: 0.55rem 0.4rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.data-table tr[data-action]:hover { background: #f8fafc; cursor: pointer; }

.sender-list { list-style: none; padding: 0; margin: 0; }
.sender-list li { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.84rem; }
.health { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 999px; margin-right: 0.35rem; }
.health.ok { background: #22c55e; }
.health.warn { background: #f59e0b; }

.day-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0; }
.day-chip {
  min-width: 2.6rem; padding: 0.35rem 0.45rem; border-radius: 6px; border: 1px solid #cbd5e1;
  background: #fff; font-size: 0.75rem; font-weight: 600;
}
.day-chip.is-on { background: #2563eb; color: #fff; border-color: #2563eb; }

.funnel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; align-items: center; margin-bottom: 0.35rem; }
.funnel-bar { height: 28px; border-radius: 6px; background: linear-gradient(90deg, #2563eb, #60a5fa); }
.funnel-meta { font-size: 0.84rem; }
.funnel-meta .hint { display: block; }

.preview-step { border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.75rem; margin-bottom: 0.65rem; }
.preview-step header { font-weight: 700; margin-bottom: 0.35rem; }
.preview-step .subj { font-weight: 600; margin-bottom: 0.5rem; }

/* Prototype chrome above page content; recipient drawer/backdrop sit above chrome when open (C-8 dismissibility). */
.proto-banner, .demo-bar, .unsaved-bar { position: relative; z-index: 200; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35); z-index: 270;
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: #fff;
  box-shadow: -12px 0 40px rgba(15,23,42,0.15); z-index: 280; transform: translateX(100%);
  transition: transform 0.2s ease; display: flex; flex-direction: column;
  max-height: 100vh;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; padding: 0.85rem 1rem; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.drawer-head h2 { margin: 0; font-size: 1rem; flex: 1; }
.drawer-body { padding: 1rem; overflow: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 8rem 1fr; gap: 0.35rem 0.75rem; font-size: 0.84rem; }
.kv dt { color: #64748b; }

.review-panel {
  position: fixed; left: 0; bottom: 0; right: 0; max-height: 42vh; overflow: auto; z-index: 250;
  background: #0f172a; color: #cbd5e1; padding: 0.85rem 1rem; font-size: 0.75rem;
  border-top: 1px solid #334155; display: none;
}
body.review-open .review-panel { display: block; }
.review-panel h3 { margin: 0 0 0.5rem; color: #fff; font-size: 0.85rem; }
.review-panel code { color: #93c5fd; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ops-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.readonly-block { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 0.65rem; opacity: 0.85; }
.ro-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; font-size: 0.84rem; border-bottom: 1px solid #f1f5f9; }
.fallback-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; align-items: end; margin-bottom: 0.5rem; }
.recap-list { margin: 0; padding-left: 1.1rem; }
.recap-list li { margin-bottom: 0.35rem; }
.recap-list .warn { color: #9a3412; }

.status-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 999px; margin-right: 0.35rem; }
.status-dot.pending { background: #64748b; }
.status-dot.active { background: #22c55e; }
.status-dot.paused { background: #f59e0b; }
.status-dot.completed { background: #3b82f6; }
.status-dot.cancelled { background: #ef4444; }

@media (max-width: 900px) {
  .seq-layout, .ops-grid, .form-grid, .funnel-row, .fallback-row { grid-template-columns: 1fr; }
  .drawer { width: min(100vw, 100%); }
}
@media (max-width: 720px) {
  .chrome-actions .btn-secondary { display: none; }
  .proto-banner, .demo-bar { flex-wrap: wrap; }
  .app, .atelier, .content-split { display: block !important; }
  .status-rail, .idx-rail { position: static; width: auto; max-height: none; }
  .side-index, .brand-rail, .app-nav { width: auto; }
  body { overflow-x: hidden; }
  .seq-editor textarea { min-height: 12rem; }
  .top-actions, .chrome-actions { flex-wrap: wrap; }
}
