/* Prototype Lab shell. The look follows the Recycle Mate admin (web/src/features/admin):
   same tokens, sidebar, page header, cards, buttons and sign-in. Dark only, like the admin. */

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Poppins Regular'), local('Poppins-Regular'), url('/fonts/Poppins-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local('Poppins Medium'), local('Poppins-Medium'), url('/fonts/Poppins-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: local('Poppins SemiBold'), local('Poppins-SemiBold'), url('/fonts/Poppins-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Poppins Bold'), local('Poppins-Bold'), url('/fonts/Poppins-Bold.woff2') format('woff2');
}

:root {
  --bg: #23292c;
  --bg-2: #2d3539;
  --nav: #1d2224;
  --surface: #343c40;
  --surface-2: #3a4347;
  --surface-3: #414a4e;
  --border: #444a4e;
  --border-2: #565f63;
  --text: #ffffff;
  --text-70: rgba(255, 255, 255, 0.72);
  /* Secondary text. A shade brighter than the admin's 0.52 so it keeps 4.5:1 on every surface (WCAG AA). */
  --text-50: rgba(255, 255, 255, 0.58);
  /* Disabled controls only: too faint for text that has to be read. */
  --text-30: rgba(255, 255, 255, 0.32);
  --primary: #99c753;
  --primary-2: #a7d362;
  --primary-dim: rgba(153, 199, 83, 0.16);
  --primary-ink: #1d2224;
  --secondary: #487d67;
  --danger: #e05a5a;
  --warning: #ffcc10;
  --info: #5cc3e3;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-2); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-2); }
.btn-secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-70); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; gap: 6px; }
.btn-block { width: 100%; padding: 12px 16px; }

.link-button {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--primary-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.link-button:disabled { color: var(--text-30); cursor: not-allowed; }
.link-button:not(:disabled):hover { text-decoration: underline; }

/* ── form fields ── */
.input, .textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus, .textarea:focus { border-color: var(--primary); background: var(--bg); }
.input::placeholder, .textarea::placeholder { color: var(--text-50); }
.input:disabled { opacity: 0.6; }
.textarea { resize: vertical; min-height: 96px; line-height: 1.45; }

/* ── layout: sidebar + content ── */
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
}
.shell.signed-out { grid-template-columns: minmax(0, 1fr); }
main { min-width: 0; min-height: 0; overflow: auto; }

.sidenav {
  height: 100vh;
  overflow-y: auto;
  background: var(--nav);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidenav .menu { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.menu-button, .backdrop { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  color: var(--text);
  text-decoration: none;
}
.brand img { width: 34px; height: 34px; object-fit: contain; display: block; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: 0.01em; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-50); margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; }

.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-50);
  padding: 14px 8px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-70);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item.active, .nav-item.active:hover {
  background: var(--primary-dim);
  color: var(--primary-2);
  border-color: rgba(153, 199, 83, 0.2);
}
.nav-item svg { opacity: 0.9; flex: none; }

/* The bridge's state, under the links: a dot and two lines, opening Setup. */
.bridge-status {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-decoration: none;
}
.bridge-status:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--border-2); }
.bridge-status .dot { grid-row: span 2; }
.bridge-status-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bridge-status-detail { font-size: 11px; color: var(--text-50); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px rgba(224, 90, 90, 0.18); }
.dot.online { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(255, 204, 16, 0.16); }

.nav-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #487d67, #99c753);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--primary-ink);
  font-size: 12px;
}
.nav-footer-identity { min-width: 0; }
.nav-footer-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-footer-role { font-size: 11px; color: var(--text-50); margin-top: 2px; }
.icon-button {
  margin-left: auto;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-50);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-button:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); border-color: var(--border); }

/* ── pages ── */
.page { width: 100%; max-width: 1440px; margin-inline: auto; padding: 24px 32px 48px; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.page-title { margin: 0 0 2px; font-size: 24px; font-weight: 700; letter-spacing: -0.015em; }
.breadcrumb { font-size: 12.5px; color: var(--text-50); letter-spacing: 0.02em; margin-bottom: 6px; }
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { margin: 0 6px; opacity: 0.5; }
.breadcrumb-current { color: var(--text-70); }
.intro { margin: -8px 0 20px; color: var(--text-70); max-width: 640px; line-height: 1.5; }
.section-title {
  margin: 32px 0 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-50);
  font-weight: 600;
}
.muted { color: var(--text-50); }

/* A chip on the right of a page header (Setup shows the bridge in one). */
.header-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.empty { max-width: 420px; margin: 48px auto 0; text-align: center; }
.empty h1 { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.empty p { margin: 0 0 20px; color: var(--text-70); line-height: 1.5; }
.empty-hint {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--text-50);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── notices ── */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 204, 16, 0.35);
  background: rgba(255, 204, 16, 0.08);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.45;
}
.notice svg { flex: none; margin-top: 1px; }
.notice a { color: inherit; font-weight: 600; }
.notice.bad { border-color: rgba(224, 90, 90, 0.35); background: rgba(224, 90, 90, 0.1); color: #f08a8a; }
.notice.good { border-color: rgba(153, 199, 83, 0.25); background: rgba(153, 199, 83, 0.08); color: var(--primary-2); }
.notice strong { color: var(--text); font-weight: 600; }
.error-msg { color: var(--danger); font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.error-msg:empty { display: none; }

/* ── badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-70);
}
.badge.success { background: var(--primary-dim); color: var(--primary-2); }
.badge.running { background: rgba(23, 153, 194, 0.18); color: var(--info); }
.badge.running::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }

/* ── sign-in ── */
.auth-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(153, 199, 83, 0.08), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(72, 125, 103, 0.1), transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-2);
}
.auth-card .brand { padding: 0; border: 0; margin-bottom: 28px; }
.auth-card .brand img { width: 36px; height: 36px; }
.auth-card .brand-name { font-weight: 700; font-size: 15px; }
.auth-card .brand-sub { font-size: 10.5px; letter-spacing: 0.08em; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 6px; }
.auth-subtitle { font-size: 13.5px; color: var(--text-50); line-height: 1.5; margin: 0 0 24px; overflow-wrap: anywhere; }
.auth-subtitle strong { color: var(--text); font-weight: 600; }
.auth-card .input { padding: 14px 16px; border-radius: var(--radius); font-size: 14px; }
.auth-card .btn-block { margin-top: 20px; }
.auth-card .notice { margin-bottom: 16px; font-size: 12.5px; }

.otp-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.otp-input {
  width: 100%;
  min-width: 0;
  height: 56px;
  padding: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  caret-color: var(--primary);
  transition: border-color 0.15s, background 0.15s;
}
.otp-input:focus { border-color: var(--primary); background: var(--bg); }
.otp-input.filled { border-color: var(--border-2); }
.otp-input.error { border-color: var(--danger); background: rgba(224, 90, 90, 0.06); }
.otp-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-50); margin-top: 12px; }

/* ── ideas ── */
.new-idea { display: flex; gap: 8px; max-width: 640px; }
.new-idea .input { padding: 11px 14px; }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease;
}
a.card:hover { background: var(--surface-2); border-color: var(--border-2); }
.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--primary-dim);
  color: var(--primary-2);
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; }
.card-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.card-title { margin: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.card-meta { color: var(--text-50); font-size: 12.5px; }
.card-body {
  margin: 0;
  flex: 1;
  color: var(--text-70);
  line-height: 1.5;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-action { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--primary-2); font-size: 13px; font-weight: 600; }
a.card:hover .card-action { color: var(--primary); }

/* ── setup ── */
.setup { max-width: 820px; display: grid; gap: 12px; }
.steps { display: grid; gap: 12px; margin-top: 4px; }
.step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-70);
  font-weight: 700;
  font-size: 13px;
}
.step.done .step-number { background: var(--primary-dim); color: var(--primary-2); }
.step-body { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.step h3 { font-size: 15px; font-weight: 600; margin-top: 4px; }
.step p { color: var(--text-70); line-height: 1.5; }
.step p.status { font-size: 12.5px; color: var(--text-50); display: flex; align-items: center; gap: 6px; }
.step p.status.ok { color: var(--primary-2); }
.step p.status.bad { color: var(--danger); }
/* Long labels (the download button) wrap rather than overflow a narrow step. */
.step-body .btn { max-width: 100%; white-space: normal; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: rgba(255, 255, 255, 0.08); color: var(--text); padding: 1px 6px; border-radius: 4px; }
pre.command {
  justify-self: stretch;
  background: var(--nav);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── idea view: prototype + change panel ── */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: 100%; }
.stage { position: relative; min-width: 0; background: var(--bg-2); }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg-2); }
.stage-note {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-70);
  box-shadow: var(--shadow-2);
}

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
}
.side section { display: grid; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.side section:last-child { border-bottom: 0; }
.side h2 {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-50);
  font-weight: 600;
}
.side .breadcrumb { margin-bottom: 0; }
.idea-head h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.idea-head p { color: var(--text-50); font-size: 12.5px; line-height: 1.5; }
.prompt-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn-ghost.active, .btn-ghost.active:hover:not(:disabled) {
  background: var(--primary-dim);
  border-color: rgba(153, 199, 83, 0.45);
  color: var(--primary-2);
}

/* picked elements: chips under the prompt, and the hint over the prototype while picking */
.prompt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.refs { display: contents; }
.ref-review-slot { display: contents; } /* no gap while it's empty */
.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 3px 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-70);
}
.ref-chip:hover { border-color: var(--primary); color: var(--text); }
.ref-n { font: 600 11.5px var(--mono); color: var(--primary-2); flex: none; }
.ref-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-screen { flex: none; color: var(--text-50); font-size: 11px; }
.ref-remove {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--text-50);
  cursor: pointer;
}
.ref-remove:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.ref-review {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid rgba(153, 199, 83, 0.45);
  border-radius: var(--radius-sm);
}
.ref-review p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-70); }
.ref-review-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Never clamped or hidden: what is approved must be what is sent. */
.ref-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  margin: 0;
  padding: 8px 10px;
  background: var(--nav);
  border-radius: var(--radius-sm);
  font: 11.5px/1.5 var(--mono);
}
.ref-details dt { color: var(--text-50); }
.ref-details dd { margin: 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.stage.picking iframe { outline: 2px solid var(--primary); outline-offset: -2px; }
.pick-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  background: var(--nav);
  border: 1px solid rgba(153, 199, 83, 0.45);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-70);
  box-shadow: var(--shadow-2);
  pointer-events: none;
  text-align: center;
}
.kbd-hint { font-size: 11.5px; color: var(--text-50); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }

.terminal {
  background: var(--nav);
  color: var(--text-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: 12px/1.55 var(--mono);
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.terminal .tool { color: var(--text); }
.terminal .tool b { color: var(--primary-2); font-weight: 600; }
.terminal .text { color: var(--text-50); }
.terminal .log, .terminal .status { color: var(--warning); }

.history { display: grid; gap: 10px; }
.version {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.version.viewing { border-color: rgba(153, 199, 83, 0.55); box-shadow: inset 3px 0 0 var(--primary); }
.version .meta { font-size: 12px; color: var(--text-50); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.version .prompt { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.prompt-refs { margin-top: 6px; font-weight: 400; }
.prompt-refs summary { font-size: 12px; color: var(--text-50); cursor: pointer; }
.prompt-refs .ref-n { margin-top: 8px; }
.version .summary { color: var(--text-70); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.version .summary.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.version .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.diff {
  background: var(--nav);
  color: var(--text-70);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}
.diff .add { color: var(--primary-2); }
.diff .del { color: #f08a8a; }
.diff .hunk { color: var(--info); }
.diff .file { color: var(--text); font-weight: 700; }

/* ── narrow screens: the sidebar becomes a bar across the top with a drop-down menu ── */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .shell.signed-out { grid-template-rows: minmax(0, 1fr); }
  .sidenav {
    position: relative;
    z-index: 50;
    height: auto;
    overflow: visible;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidenav .bar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .sidenav .brand { padding: 0; border-bottom: 0; margin-bottom: 0; }
  .sidenav .brand img { width: 30px; height: 30px; }
  .menu-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-70);
    cursor: pointer;
  }
  .menu-button:hover, .sidenav.open .menu-button { background: rgba(255, 255, 255, 0.04); color: var(--text); }
  .sidenav .menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1;
    max-height: calc(100vh - 61px);
    overflow-y: auto;
    padding: 8px 16px 16px;
    background: var(--nav);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-2);
  }
  .sidenav.open .menu { display: flex; }
  .nav-footer { margin-top: 12px; }
  .sidenav.open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); }

  .page { padding: 20px 16px 40px; }
  .new-idea { flex-direction: column; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: 70vh auto; height: auto; }
  .side { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .auth-card { padding: 24px; }
}
