/* TC App Factory — layered on the Travel Counsellors design tokens. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--tc-bg);
  color: var(--tc-text);
  font-family: var(--tc-font-body);
  font-size: var(--tc-body-s);
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--tc-text-subdued); }
.small { font-size: var(--tc-body-xs); }

.repo-line {
  margin: var(--tc-space-xs) 0 0;
  font-size: var(--tc-body-s);
  color: var(--tc-text-subdued);
  word-break: break-all;
}
.repo-line a { color: var(--tc-text-link, var(--tc-brand, #0b5)); }

h1, h2, h3 { font-family: var(--tc-font-title); color: var(--tc-text-headline); font-weight: 500; }
h1 { font-size: var(--tc-title-s); line-height: 1.1; margin: 0 0 var(--tc-space-s); }
h2 { font-size: var(--tc-display-m); margin: 0; }
h3 { font-size: var(--tc-body-l); margin: 0 0 var(--tc-space-s); }

.eyebrow {
  font-size: var(--tc-body-xxs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--tc-cherry-ink);
  margin: 0 0 var(--tc-space-2xs);
}

a { color: var(--tc-text-link); }

/* ---- Buttons ---- */
.btn {
  font-family: var(--tc-font-body);
  font-weight: 700;
  font-size: var(--tc-body-s);
  border: none;
  border-radius: var(--tc-radius-pill);
  padding: 12px 24px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, opacity 160ms ease;
}
.btn-sm { padding: 8px 16px; font-size: var(--tc-body-xs); }
.btn-primary { background: var(--tc-cherry); color: var(--tc-text-inverted); }
.btn-primary:hover { background: var(--tc-cherry-deep); }
.btn-primary:disabled { opacity: 0.5; cursor: progress; }
.btn-secondary { background: var(--tc-surface); color: var(--tc-cherry); border: 1px solid var(--tc-line); }
.btn-secondary:hover { background: var(--tc-bg-sand); }
.btn-ghost-light { background: rgba(255,255,255,0.12); color: #fff; }
.btn-ghost-light:hover { background: rgba(255,255,255,0.22); }

input, textarea {
  font-family: var(--tc-font-body);
  font-size: var(--tc-body-s);
  color: var(--tc-text);
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--tc-line-strong);
  border-radius: var(--tc-radius-m2);
  background: var(--tc-surface);
}
input:focus, textarea:focus { outline: none; box-shadow: var(--tc-shadow-focus); border-color: var(--tc-coral); }
textarea { resize: vertical; line-height: 1.5; }

.card {
  background: var(--tc-surface);
  border-radius: var(--tc-radius-l);
  box-shadow: var(--tc-shadow-m);
  padding: var(--tc-space-2xl);
}

.error { color: var(--tc-error); font-size: var(--tc-body-xs); margin: 0; }

/* ---- Login ---- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--tc-space-xl);
  background:
    linear-gradient(180deg, rgba(83,14,47,0.78), rgba(83,14,47,0.88)),
    url("/assets/brand/hero.jpg") center/cover no-repeat;
}
.login-card {
  background: var(--tc-surface);
  border-radius: var(--tc-radius-xl);
  box-shadow: var(--tc-shadow-l);
  padding: var(--tc-space-3xl);
  width: min(420px, 100%);
  text-align: center;
}
.login-logo { height: 34px; margin-bottom: var(--tc-space-l); }
.login-card form { display: grid; gap: var(--tc-space-m); margin-top: var(--tc-space-l); }
.login-card .btn { width: 100%; }

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tc-cherry-deep);
  padding: var(--tc-space-m) var(--tc-space-2xl);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: var(--tc-space-s); }
.brand img { height: 26px; }
.brand-tag {
  font-size: var(--tc-body-xs);
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  border-left: 1px solid rgba(255,255,255,0.3);
  padding-left: var(--tc-space-s);
}
.topbar-right { display: flex; align-items: center; gap: var(--tc-space-s); }

/* ---- Layout ---- */
.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--tc-space-3xl) var(--tc-space-xl);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--tc-space-2xl);
  align-items: start;
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
}

.hero { margin-bottom: var(--tc-space-2xl); }
.hero h1 { font-size: var(--tc-title-m); }
.hero .muted { max-width: 60ch; }
#idea-form { margin-top: var(--tc-space-l); }
.idea-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tc-space-m);
  margin-top: var(--tc-space-m);
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  font-size: var(--tc-body-xxs);
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--tc-radius-pill);
  background: var(--tc-bg-sand);
  color: var(--tc-text-subdued);
  white-space: nowrap;
}
.badge.is-running { background: var(--color-information-100); color: var(--color-information-1100); animation: tc-pulse 1.2s ease-in-out infinite; }
@keyframes tc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.badge.is-awaiting { background: var(--color-caution-100); color: var(--color-caution-1100); }
.badge.is-completed { background: var(--color-success-100); color: var(--color-success-1100); }
.badge.is-failed { background: var(--color-error-100); color: var(--color-error-1100); }
.badge.is-cancelled { background: var(--tc-bg-sand); color: var(--tc-text-subdued); }
.badge.is-undeployed { background: var(--tc-bg-sand); color: var(--tc-text-subdued); }

/* ---- Job panel ---- */
.job-panel { display: grid; gap: var(--tc-space-l); }
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--tc-space-m); }

.progress-track {
  height: 12px;
  border-radius: var(--tc-radius-pill);
  background: var(--tc-bg-sand);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--tc-radius-pill);
  background: linear-gradient(90deg, var(--tc-cherry), var(--tc-coral));
  transition: width 500ms ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: var(--tc-space-xs);
  font-size: var(--tc-body-xs);
  color: var(--tc-text-subdued);
}
#progress-phase { font-weight: 600; color: var(--tc-text); }

/* ---- Deployed banner ---- */
.deployed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tc-space-m);
  background: var(--color-success-100);
  border: 1px solid var(--color-success-300);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-m) var(--tc-space-l);
}
.deployed .eyebrow { color: var(--color-success-1100); }
.deployed-url { font-weight: 700; word-break: break-all; }
.deployed-actions { display: flex; align-items: center; gap: var(--tc-space-s); flex-shrink: 0; }
/* The side-by-side workbench needs width; hide its entry point on portrait phones. */
@media (max-width: 640px) and (orientation: portrait) {
  #sidebyside-btn { display: none !important; }
}

/* ---- Question ---- */
.question {
  background: var(--color-caution-100);
  border: 1px solid var(--color-caution-300);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-l);
}
.question p { margin: 0 0 var(--tc-space-s); }
#reply-form { display: flex; gap: var(--tc-space-s); }
#reply-form input { flex: 1; }

/* ---- Follow-up ("make changes") ---- */
.followup {
  background: var(--color-info-100, var(--color-caution-100));
  border: 1px solid var(--color-info-300, var(--color-caution-300));
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-l);
}
.followup p { margin: 0 0 var(--tc-space-s); }
#followup-form { display: flex; gap: var(--tc-space-s); }
#followup-form input { flex: 1; }

/* ---- Attachments ---- */
.attach { margin-top: var(--tc-space-s); display: flex; flex-direction: column; gap: var(--tc-space-s); }
.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--tc-space-xs);
  align-self: flex-start;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-brand-1100, #8a1538);
  border: 1px dashed var(--color-neutral-300, #e6e1dc);
  border-radius: var(--tc-radius-m2, 8px);
  padding: var(--tc-space-xs) var(--tc-space-m);
  background: var(--tc-bg-sand, #f7f4f0);
}
.attach-btn:hover { border-color: var(--color-brand-1100, #8a1538); }
.attach-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--tc-space-xs); }
.attach-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tc-bg-sand, #f3efe9);
  border: 1px solid var(--color-neutral-300, #e6e1dc);
  border-radius: 999px;
  padding: 3px 6px 3px 10px;
  font-size: 0.8rem;
  max-width: 240px;
}
.attach-chips .chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-chips .chip button {
  border: 0;
  background: var(--color-neutral-300, #e6e1dc);
  color: var(--tc-text, #2a2320);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- New app bar ---- */
.newapp-bar { display: flex; margin-bottom: var(--tc-space-m); }

/* ---- Mode tabs (Build / Plan) ---- */
.mode-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: var(--tc-space-m);
  background: var(--tc-bg-sand, #f3efe9);
  border-radius: 999px;
}
.mode-tab {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: var(--tc-space-xs) var(--tc-space-l);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--tc-text-subdued, #6b635c);
}
.mode-tab.is-active { background: #fff; color: var(--color-brand-1100, #8a1538); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.plan-detail { display: inline-flex; align-items: center; gap: var(--tc-space-xs); font-size: 0.85rem; color: var(--tc-text-subdued, #6b635c); margin-right: auto; }
.plan-detail select { padding: 4px 8px; border-radius: var(--tc-radius-m2, 8px); border: 1px solid var(--color-neutral-300, #e6e1dc); }

/* ---- Plan spec ---- */
.spec-box {
  border: 1px solid var(--color-info-300, var(--color-neutral-300, #e6e1dc));
  background: var(--color-info-100, #eef4ff);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-m);
}
.spec-head { display: flex; align-items: center; justify-content: space-between; gap: var(--tc-space-s); margin-bottom: var(--tc-space-s); }
.spec-head .eyebrow { margin: 0; }
.spec-text {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  background: #fff;
  border-radius: var(--tc-radius-m2, 8px);
  padding: var(--tc-space-s);
}

/* ---- Deployment dashboard ---- */
.dash-wrap {
  border: 1px solid var(--color-neutral-300, #e6e1dc);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-s) var(--tc-space-m);
}
.dash-wrap > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  padding: var(--tc-space-xs) 0;
}
.dash-wrap > summary::-webkit-details-marker { display: none; }
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tc-space-s);
  margin: var(--tc-space-s) 0 var(--tc-space-m);
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--tc-space-m);
}
.metric {
  border: 1px solid var(--color-neutral-300, #e6e1dc);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-m);
  background: var(--color-neutral-100, #faf8f6);
}
.metric-label {
  margin: 0 0 var(--tc-space-xs);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-neutral-900, #6b635c);
}
.metric-num { margin: 0 0 var(--tc-space-s); font-size: 1.9rem; font-weight: 800; line-height: 1; }
.kvs { display: flex; flex-direction: column; gap: 2px; }
.kv { display: flex; justify-content: space-between; gap: var(--tc-space-s); font-size: 0.9rem; }
.kv span { color: var(--color-neutral-900, #6b635c); }
.bars { display: flex; flex-direction: column; gap: var(--tc-space-xs); }
.bar-row { display: grid; grid-template-columns: 8rem 1fr auto; align-items: center; gap: var(--tc-space-s); font-size: 0.85rem; }
.bar-label { color: var(--color-neutral-900, #6b635c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--color-neutral-300, #e6e1dc); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--color-brand-1100, #8a1538); border-radius: 999px; }
.bar-fill.alt { background: var(--color-info-700, #2563eb); }
.bar-val { font-variant-numeric: tabular-nums; }
.dash-links { display: flex; flex-wrap: wrap; gap: var(--tc-space-s); margin-top: var(--tc-space-m); }
.hbadge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.hbadge.up { background: var(--color-success-200, #d6f3e0); color: var(--color-success-1100, #0f6b3d); }
.hbadge.down { background: var(--color-caution-200, #fde2e0); color: var(--color-danger-1100, #b3261e); }
.hbadge.none { background: var(--color-neutral-300, #e6e1dc); color: var(--color-neutral-900, #6b635c); }

/* ---- Services ---- */
.metric-wide { grid-column: 1 / -1; }
.svc-list { display: flex; flex-direction: column; gap: var(--tc-space-s); }
.svc { border: 1px solid var(--color-neutral-300, #e6e1dc); border-radius: var(--tc-radius-m2, 8px); padding: var(--tc-space-s) var(--tc-space-m); background: #fff; }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: var(--tc-space-s); }
.svc-name { font-weight: 700; }
.svc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.svc-logs { margin: var(--tc-space-s) 0 0; max-height: 240px; overflow: auto; background: #1e1b19; color: #ece7e1; border-radius: var(--tc-radius-m2, 8px); padding: var(--tc-space-s); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.76rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }

/* ---- Side-by-side workbench ---- */
.wb {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--tc-bg-sand, #f3efe9);
}
.wb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tc-space-m);
  padding: var(--tc-space-s) var(--tc-space-l);
  background: var(--color-brand-1100, #8a1538);
  color: #fff;
}
.wb-title { display: flex; align-items: baseline; gap: var(--tc-space-m); min-width: 0; }
.wb-title strong { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.wb-url { color: #fff; opacity: 0.85; text-decoration: underline; word-break: break-all; font-size: 0.85rem; }
.wb-actions { display: flex; gap: var(--tc-space-s); flex-shrink: 0; }
.wb-body { flex: 1; display: flex; min-height: 0; }
.wb-preview { flex: 1; position: relative; background: #fff; min-width: 0; }
.wb-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.wb-frame-note {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: var(--tc-space-xs) var(--tc-space-m);
  font-size: 0.78rem;
  color: var(--tc-text-subdued, #6b635c);
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--color-neutral-300, #e6e1dc);
}
.wb-chat {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--color-neutral-300, #e6e1dc);
  background: #fff;
}
.wb-chat-head {
  display: flex;
  align-items: center;
  gap: var(--tc-space-s);
  padding: var(--tc-space-s) var(--tc-space-m);
  border-bottom: 1px solid var(--color-neutral-300, #e6e1dc);
}
.wb-log { flex: 1; overflow-y: auto; margin: 0; padding: var(--tc-space-m); list-style: none; display: flex; flex-direction: column; gap: var(--tc-space-s); }
.wb-msg { max-width: 90%; padding: var(--tc-space-xs) var(--tc-space-s); border-radius: var(--tc-radius-m2); font-size: 0.88rem; line-height: 1.35; }
.wb-msg.agent { align-self: flex-start; background: var(--tc-bg-sand, #f3efe9); }
.wb-msg.user { align-self: flex-end; background: var(--color-brand-1100, #8a1538); color: #fff; }
.wb-msg.meta { align-self: flex-start; color: var(--tc-text-subdued, #6b635c); font-size: 0.78rem; background: transparent; padding-left: 0; }
.wb-msg.deployed { align-self: flex-start; background: var(--color-success-100, #d6f3e0); color: var(--color-success-1100, #0f6b3d); font-weight: 600; }
.wb-msg.error { align-self: flex-start; background: var(--color-error-100, #fde2e0); color: var(--color-error-1100, #b3261e); }
.wb-form { display: flex; gap: var(--tc-space-s); padding: var(--tc-space-m); border-top: 1px solid var(--color-neutral-300, #e6e1dc); }
.wb-form input { flex: 1; }
@media (max-width: 800px) {
  .wb-body { flex-direction: column; }
  .wb-chat { width: auto; border-left: 0; border-top: 1px solid var(--color-neutral-300, #e6e1dc); height: 45%; }
}

/* ---- App danger / archive ---- */
.app-danger { display: flex; justify-content: flex-end; margin-top: var(--tc-space-s); }
#delete-btn { color: var(--color-error-1100, #b3261e); }
#delete-btn:hover { background: var(--color-error-100, #fde2e0); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: var(--tc-space-s); margin-bottom: var(--tc-space-s); }
.side-head .side-title { margin: 0; }

/* ---- Inbox ---- */
.inbox-wrap {
  border: 1px solid var(--color-neutral-300, #e6e1dc);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-s) var(--tc-space-m);
}
.inbox-wrap > summary { cursor: pointer; font-weight: 700; padding: var(--tc-space-xs) 0; }
.inbox-form { display: flex; gap: var(--tc-space-s); margin: var(--tc-space-s) 0 var(--tc-space-m); }
.inbox-form input { flex: 1; }
.inbox-form select { border-radius: var(--tc-radius-m2, 8px); border: 1px solid var(--color-neutral-300, #e6e1dc); padding: 4px 8px; }
.inbox-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--tc-space-m); }
.inbox-col h4 { margin: 0 0 var(--tc-space-s); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-neutral-900, #6b635c); font-weight: 700; }
.inbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--tc-space-s); min-height: 24px; }
.inbox-empty { padding: var(--tc-space-s) 0; }
.inbox-item { border: 1px solid var(--color-neutral-300, #e6e1dc); border-left-width: 4px; border-radius: var(--tc-radius-m2, 8px); padding: var(--tc-space-s); background: #fff; }
.inbox-item.k-bug { border-left-color: var(--color-error-1100, #b3261e); }
.inbox-item.k-change { border-left-color: var(--color-brand-1100, #8a1538); }
.inbox-item.k-idea { border-left-color: var(--color-info-700, #2563eb); }
.inbox-item.dragging { opacity: 0.5; }
.inbox-item[draggable="true"] { cursor: grab; }
.ii-head { display: flex; align-items: center; gap: var(--tc-space-s); margin-bottom: 4px; }
.ii-kind { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-neutral-900, #6b635c); }
.ii-status { font-size: 0.72rem; color: var(--color-brand-1100, #8a1538); font-weight: 600; }
.ii-status.fail { color: var(--color-error-1100, #b3261e); }
.ii-text { font-size: 0.86rem; line-height: 1.35; }
.ii-result { margin-top: var(--tc-space-xs); font-size: 0.76rem; color: var(--tc-text-subdued, #6b635c); white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: auto; background: var(--tc-bg-sand, #f7f4f0); border-radius: 6px; padding: 4px 6px; }
.ii-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--tc-space-s); }
@media (max-width: 720px) { .inbox-cols { grid-template-columns: 1fr; } }

/* ---- Log ---- */
.log-wrap summary {
  cursor: pointer;
  font-weight: 700;
  font-size: var(--tc-body-xs);
  color: var(--tc-text-subdued);
  padding: var(--tc-space-xs) 0;
}
.log {
  list-style: none;
  margin: var(--tc-space-s) 0 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  gap: var(--tc-space-xs);
}
.log li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: var(--tc-space-s);
  font-size: var(--tc-body-xs);
  padding: var(--tc-space-xs) 0;
  border-bottom: 1px solid var(--tc-line);
  align-items: start;
}
.log li:last-child { border-bottom: none; }
.log .dot { margin-top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--tc-line-strong); }
.log .k-status .dot { background: var(--tc-cherry); }
.log .k-deployed .dot { background: var(--tc-success); }
.log .k-question .dot { background: var(--tc-caution); }
.log .k-error .dot { background: var(--tc-error); }
.log .k-tool .dot, .log .k-thinking .dot { background: var(--tc-line-strong); }
.log .k-thinking { color: var(--tc-text-subdued); font-style: italic; }
.log .ltext { word-break: break-word; }

/* ---- History ---- */
.side-title { margin-bottom: var(--tc-space-m); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--tc-space-xs); }
.history li {
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-s) var(--tc-space-m);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease;
}
.history li:hover { background: var(--tc-bg-sand); }
.history li.active { border-color: var(--tc-coral); background: var(--tc-bg-sand); }
.history .h-idea {
  font-weight: 600;
  font-size: var(--tc-body-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history .h-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.history .h-time { font-size: 10px; color: var(--tc-text-subdued); }

.agent-line { margin: var(--tc-space-xs) 0 0; }
.agent-link { font-size: var(--tc-body-s); font-weight: 600; }

/* ---------- Publish as a myTC app ---------- */
.mytc-toggle {
  display: flex;
  align-items: center;
  gap: var(--tc-space-xs);
  margin-top: var(--tc-space-m);
  font-size: var(--tc-body-s);
  color: var(--tc-text-headline);
  cursor: pointer;
}
/* The global `input { width:100% }` rule would stretch the checkbox into a big
   box — keep it a native-sized control. */
.mytc-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  accent-color: var(--tc-cherry);
  cursor: pointer;
}
.mytc-options {
  margin-top: var(--tc-space-s);
  padding: var(--tc-space-m);
  border: 1px solid var(--tc-line);
  border-radius: var(--tc-radius-m2);
  background: var(--tc-bg-sand);
  display: grid;
  gap: var(--tc-space-xs);
}
.mytc-banner { border-left: 3px solid var(--tc-cherry); }

/* ---------- Workshop: profile selector ---------- */
.ws-profiles {
  border: none;
  padding: 0;
  margin: var(--tc-space-m) 0 0;
  display: grid;
  gap: var(--tc-space-s);
}
.ws-profiles legend { padding: 0; margin-bottom: var(--tc-space-2xs); }
.ws-profile {
  display: flex;
  gap: var(--tc-space-s);
  padding: var(--tc-space-m);
  border: 1px solid var(--tc-line);
  border-radius: var(--tc-radius-m2);
  background: var(--tc-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ws-profile:hover { border-color: var(--tc-line-strong); }
.ws-profile:has(input:checked) { border-color: var(--tc-cherry); background: var(--tc-bg-sand); }
/* Keep the radio a native-sized control (the global input width:100% otherwise
   stretches it into a huge circle). */
.ws-profile input[type="radio"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 3px 0 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  accent-color: var(--tc-cherry);
  cursor: pointer;
}
.wsp-body { display: grid; gap: 2px; }
.wsp-name { font-weight: 600; color: var(--tc-text-headline); }

/* ---------- Workshop: pipeline strip ---------- */
.workshop-box { margin: var(--tc-space-m) 0; }
.stage-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--tc-space-s);
}
@media (max-width: 720px) {
  .stage-strip { grid-template-columns: 1fr 1fr; }
}
.stage-card {
  border: 1px solid var(--tc-line);
  border-radius: var(--tc-radius-m2);
  background: var(--tc-surface);
  padding: var(--tc-space-s);
  display: flex;
  flex-direction: column;
  gap: var(--tc-space-2xs);
  min-height: 82px;
}
.stage-card.sc-running { border-color: var(--color-information-1100); box-shadow: 0 0 0 1px var(--color-information-100) inset; }
.stage-card.sc-passed { border-color: var(--color-success-1100); }
.stage-card.sc-failed { border-color: var(--color-error-1100); }
.sc-head { display: flex; justify-content: space-between; align-items: center; gap: var(--tc-space-2xs); }
.sc-title { font-weight: 600; color: var(--tc-text-headline); }
.sc-badge {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: var(--tc-radius-pill);
  background: var(--tc-bg-sand);
  color: var(--tc-text-subdued);
  white-space: nowrap;
}
.sb-running { background: var(--color-information-100); color: var(--color-information-1100); animation: tc-pulse 1.2s ease-in-out infinite; }
.sb-passed { background: var(--color-success-100); color: var(--color-success-1100); }
.sb-failed { background: var(--color-error-100); color: var(--color-error-1100); }
.sc-detail { line-height: 1.3; }
.sc-reviews { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.verdict {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--tc-radius-pill);
  border: 1px solid var(--tc-line);
}
.verdict.v-pass { background: var(--color-success-100); color: var(--color-success-1100); border-color: transparent; }
.verdict.v-fail { background: var(--color-error-100); color: var(--color-error-1100); border-color: transparent; }
.sc-link { font-size: var(--tc-body-xs); font-weight: 600; }
.sc-agent { font-size: 10px; }

/* ---------- Workshop: gate + memory ---------- */
.gate-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--tc-space-m);
  margin-top: var(--tc-space-m);
  padding: var(--tc-space-m);
  border: 1px solid var(--color-caution-1100);
  background: var(--color-caution-100);
  border-radius: var(--tc-radius-m2);
}
.gate-text { margin: 0; color: var(--tc-text-headline); }
.memory-wrap {
  margin-top: var(--tc-space-m);
  border: 1px solid var(--tc-line);
  border-radius: var(--tc-radius-m2);
  padding: var(--tc-space-s) var(--tc-space-m);
}
.memory-wrap summary { cursor: pointer; font-weight: 600; color: var(--tc-text-headline); }
.memory-filter {
  width: 100%;
  margin: var(--tc-space-s) 0 0;
  padding: var(--tc-space-2xs) var(--tc-space-s);
  border: 1px solid var(--tc-line);
  border-radius: var(--tc-radius-s, 8px);
  font: inherit;
  font-size: var(--tc-body-s);
}
.memory-list { list-style: none; margin: var(--tc-space-s) 0 0; padding: 0; display: grid; gap: var(--tc-space-s); }
.mem-item {
  font-size: var(--tc-body-s);
  padding: var(--tc-space-s);
  background: var(--tc-bg-sand);
  border-radius: var(--tc-radius-s, 8px);
  color: var(--tc-text-body, var(--tc-text-headline));
}
.mem-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.mem-idx { font-weight: 600; color: var(--tc-text-headline); font-size: var(--tc-body-xs); }
.mem-date { color: var(--tc-text-subdued); font-size: 10px; }
.mem-body p { margin: 0 0 var(--tc-space-2xs); }
.mem-body ul { margin: 0; padding-left: 1.1em; }
.mem-body code { background: rgba(0,0,0,0.06); padding: 0 3px; border-radius: 4px; font-size: 0.92em; }

/* ---------- Workshop: review findings ---------- */
.review-findings-list { display: grid; gap: var(--tc-space-s); margin-top: var(--tc-space-s); }
.rv {
  border: 1px solid var(--tc-line);
  border-left-width: 3px;
  border-radius: var(--tc-radius-s, 8px);
  padding: var(--tc-space-s);
  background: var(--tc-surface);
}
.rv-pass { border-left-color: var(--color-success-1100); }
.rv-fail { border-left-color: var(--color-error-1100); }
.rv-head { display: flex; align-items: center; gap: var(--tc-space-2xs); }
.rv-head b { color: var(--tc-text-headline); }
.rv-agent { margin-left: auto; }
.rv-note { margin-top: var(--tc-space-2xs); color: var(--tc-text-headline); font-size: var(--tc-body-s); }
.rv-body { margin-top: var(--tc-space-2xs); font-size: var(--tc-body-s); color: var(--tc-text-body, var(--tc-text-headline)); }
.rv-body p { margin: 0 0 var(--tc-space-2xs); }
.rv-body ul { margin: 0; padding-left: 1.1em; }
.k-stage .dot { background: var(--color-information-1100); }
.k-gate .dot { background: var(--color-caution-1100); }
.k-verdict .dot { background: var(--color-success-1100); }
.k-learning .dot { background: var(--tc-cherry); }
