/* Sandbox demo layout — reuses the site's design tokens from ../styles.css */

.demo-body { overflow: visible; height: auto; }
.demo-body::before { position: fixed; }

.demo-header { flex-wrap: wrap; gap: 0 16px; }
.demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  order: 3;
  flex-basis: 100%;
  min-width: 0;
  padding-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  justify-content: center;
  text-align: center;
}
.demo-banner-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(51, 214, 166, 0.18);
}

.demo-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  height: calc(100vh - 104px);
  width: 100%;
  border-top: 1px solid var(--line);
}

/* sidebar */
.demo-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.demo-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
}
.demo-sidebar-head h2 { font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 600; }
.demo-new-btn {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--cyan));
  border: none;
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  font-weight: 700;
}
.demo-session-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px; }

.demo-session {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--body);
}
.demo-session:hover { background: rgba(255, 255, 255, 0.03); }
.demo-session.is-active { background: rgba(113, 214, 255, 0.08); border-color: rgba(113, 214, 255, 0.28); }
.demo-session-title { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.demo-session-meta { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.demo-status-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.demo-provider-chip {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--faint);
}
.demo-session-pin { margin-left: auto; color: var(--gold); font-size: 11px; }

/* thread */
.demo-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.demo-thread-head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.demo-thread-head h1 { font-size: 18px; font-family: var(--display); font-weight: 600; }
.demo-thread-head .demo-thread-sub { font-family: var(--mono); font-size: 12px; color: var(--faint); }

.demo-thread-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }

.demo-msg { max-width: 78ch; display: flex; flex-direction: column; gap: 10px; }
.demo-msg-user { align-self: flex-end; }
.demo-msg-bubble { padding: 12px 16px; border-radius: 12px; font-size: 14.5px; line-height: 1.55; }
.demo-msg-user .demo-msg-bubble { background: linear-gradient(135deg, rgba(244,201,93,0.16), rgba(113,214,255,0.12)); border: 1px solid rgba(113,214,255,0.25); }
.demo-msg-assistant .demo-msg-bubble { background: var(--surface-2); border: 1px solid var(--line); }
.demo-msg-time { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }

.demo-tool { border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.02); padding: 10px 14px; font-family: var(--mono); font-size: 12px; }
.demo-tool-label { color: var(--cyan); font-weight: 600; }
.demo-tool-detail { color: var(--faint); margin-left: 6px; }
.demo-tool-out { margin-top: 6px; color: var(--muted); white-space: pre-wrap; }

.demo-diff { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.demo-diff-head { padding: 8px 14px; font-family: var(--mono); font-size: 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.demo-diff-file { color: var(--text); }
.demo-diff-stat-add { color: var(--ok); }
.demo-diff-stat-del { color: #FF7A7A; }
.demo-diff-patch { margin: 0; padding: 10px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.6; overflow-x: auto; background: var(--ink); }
.demo-diff-patch .add { color: var(--ok); }
.demo-diff-patch .del { color: #FF7A7A; }

.demo-thinking { font-family: var(--mono); font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.demo-thinking-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: demo-pulse 1.1s ease-in-out infinite; }
@keyframes demo-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.demo-composer { display: flex; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.demo-composer input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  font-family: var(--body);
}
.demo-composer input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.demo-composer button {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  padding: 0 20px;
  border: none;
  border-radius: 9px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--cyan));
  cursor: pointer;
}

/* right context panel */
.demo-context { padding: 18px 16px; overflow-y: auto; background: var(--surface); display: flex; flex-direction: column; gap: 24px; }
.demo-context-block h3 { font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); margin: 0 0 10px; font-weight: 600; }
.demo-approvals, .demo-workers { display: flex; flex-direction: column; gap: 10px; }
.demo-empty { font-family: var(--mono); font-size: 12px; color: var(--faint); }

.demo-approval-card { border: 1px solid rgba(244,201,93,0.35); background: rgba(244,201,93,0.06); border-radius: 10px; padding: 12px; }
.demo-approval-action { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.demo-approval-detail { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 10px; word-break: break-all; }
.demo-approval-risk { display: inline-block; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 999px; margin-bottom: 10px; }
.demo-risk-high { color: #FF7A7A; border: 1px solid rgba(255,122,122,0.4); }
.demo-risk-medium { color: var(--gold); border: 1px solid rgba(244,201,93,0.4); }
.demo-approval-actions { display: flex; gap: 8px; }
.demo-approval-actions button {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
}
.demo-approve-btn { border-color: rgba(51,214,166,0.5) !important; color: var(--ok) !important; }
.demo-deny-btn { border-color: rgba(255,122,122,0.4) !important; color: #FF7A7A !important; }
.demo-approval-resolved { font-family: var(--mono); font-size: 11.5px; color: var(--ok); }

.demo-worker-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.demo-worker-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.demo-worker-task { font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 980px) {
  .demo-shell { grid-template-columns: 1fr; height: auto; }
  .demo-sidebar, .demo-thread, .demo-context { border-right: none; border-bottom: 1px solid var(--line); }
  .demo-sidebar { max-height: 260px; }
  .demo-thread-body { max-height: 60vh; }
  .demo-banner { display: none; }
}
