:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-elev: #101318;
  --panel: #14181e;
  --panel-2: #181d24;
  --line: #242b34;
  --line-strong: #343d49;
  --text: #f4f7fb;
  --muted: #98a2b3;
  --faint: #667085;
  --accent: #8aa4ff;
  --accent-strong: #b8c6ff;
  --success: #67d391;
  --danger: #ff8585;
  --warning: #f4c66b;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 20%, rgba(138,164,255,.11), transparent 32%),
    radial-gradient(circle at 80% 75%, rgba(89,208,164,.07), transparent 30%),
    var(--bg);
}

.auth-card {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(20,24,30,.94);
  box-shadow: var(--shadow);
}

.brand-row { display: flex; gap: 14px; align-items: center; }
.brand-row h1, .brand-row strong { margin: 0; }
.brand-row.compact { padding: 18px 14px 24px; }
.brand-row.compact div:last-child { display: grid; gap: 2px; }
.brand-row.compact span { color: var(--muted); font-size: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #e8ecff, #8aa4ff);
  color: #10131b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.42);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 700;
}

h1 { font-size: 34px; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.lead { color: #c5ccd6; line-height: 1.6; margin: 28px 0 22px; }
.help, .status-line { color: var(--muted); font-size: 13px; line-height: 1.5; }
.status-line { min-height: 20px; margin: 16px 0 0; }

.button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
  font-weight: 650;
}
.button:hover { transform: translateY(-1px); border-color: #4a5565; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-large { width: 100%; padding: 13px 16px; }
.button-primary { background: #e9edff; color: #11141a; border-color: #e9edff; }
.button-secondary { background: #1b2129; color: var(--text); }
.button-danger { background: rgba(255,133,133,.07); color: #ffb2b2; border-color: rgba(255,133,133,.28); }

.auth-switch { display: flex; gap: 6px; margin: 26px 0 18px; padding: 4px; border-radius: 10px; background: #0f1216; }
.auth-tab { flex: 1; border: 0; border-radius: 8px; padding: 9px 12px; background: transparent; color: var(--muted); cursor: pointer; }
.auth-tab.active { background: #1d232b; color: var(--text); }
.stack { display: grid; gap: 14px; }
label { display: block; margin-bottom: 7px; color: #c7ced8; font-size: 13px; font-weight: 600; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  background: #0f1216; color: var(--text); padding: 10px 11px; outline: none;
}
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138,164,255,.12); }

.app-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 10px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: #0e1115;
}
.nav-list { display: grid; gap: 4px; }
.nav-item {
  width: 100%; padding: 10px 12px; text-align: left;
  border: 1px solid transparent; border-radius: 9px; background: transparent;
  color: var(--muted); cursor: pointer;
}
.nav-item:hover { background: #151a20; color: var(--text); }
.nav-item.active { background: #1a2028; color: var(--text); border-color: var(--line); }
.sidebar-footer {
  margin-top: auto; display: grid; grid-template-columns: 34px minmax(0,1fr) 34px;
  gap: 9px; align-items: center; padding: 10px 8px; border-top: 1px solid var(--line);
}
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #242b34; font-weight: 800; }
.identity-compact { min-width: 0; display: grid; gap: 2px; }
.identity-compact strong, .identity-compact span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-compact strong { font-size: 13px; }
.identity-compact span { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.icon-button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #14191f; cursor: pointer; }

.workspace { min-width: 0; }
.topbar {
  height: 80px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: rgba(11,13,16,.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.security-badge { padding: 7px 10px; border: 1px solid rgba(103,211,145,.28); background: rgba(103,211,145,.07); color: #9ce6b7; border-radius: 999px; font-size: 12px; font-weight: 700; }
.view { padding: 28px 30px 46px; max-width: 1240px; margin: 0 auto; }
.hero-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 26px 28px; border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(120deg, rgba(138,164,255,.08), rgba(20,24,30,.9) 48%, rgba(103,211,145,.035));
}
.hero-panel h3 { font-size: 24px; margin-bottom: 7px; }
.hero-panel p:last-child { color: var(--muted); margin: 0; }
.hero-status { display: flex; align-items: center; gap: 8px; color: #b5ddc3; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(103,211,145,.08); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.metric-card, .panel { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; }
.metric-card { padding: 18px; display: grid; gap: 7px; }
.metric-card strong { font-size: 23px; letter-spacing: -.02em; }
.metric-card > span:last-child { color: var(--muted); font-size: 12px; }
.metric-label { color: var(--muted); font-size: 12px; }
.panel { padding: 20px; margin-top: 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin: 0; }
.detail-item { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #11151a; }
.detail-item dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.detail-item dd { margin: 0; word-break: break-word; }
.section-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: 16px; }
.section-grid .panel { margin-top: 0; }
.security-span { grid-column: 1 / -1; }
.current-authority-row { border-color: #38566f; background: #111923; }
.pill-current { border-color: #4b7191; color: #d8edff; background: #162432; }
.list { display: grid; gap: 8px; }
.list-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #11151a; }
.list-main { min-width: 0; display: grid; gap: 4px; }
.list-main strong { font-size: 13px; overflow-wrap: anywhere; }
.list-main span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: #bac3cf; background: #181d23; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.empty-state { padding: 20px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); text-align: center; }
.recovery-status { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #11151a; margin-bottom: 12px; }
.recovery-status strong { display: block; font-size: 22px; margin-bottom: 4px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.button-row.end { justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-actions { grid-column: 1 / -1; }

.dialog { width: min(640px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0,0,0,.66); backdrop-filter: blur(4px); }
.dialog-card { padding: 22px; }
.secret-value { max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #0d1014; color: #dbe2ec; }

.toast-region { position: fixed; top: 18px; right: 18px; z-index: 100; display: grid; gap: 8px; width: min(390px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #171c22; box-shadow: 0 16px 40px rgba(0,0,0,.35); font-size: 13px; }
.toast.error { border-color: rgba(255,133,133,.4); }
.toast.success { border-color: rgba(103,211,145,.35); }


/* WEB WORKBENCH CONVERSATION CORE V1 */
.workbench-view { max-width: none; height: calc(100vh - 80px); padding: 0; overflow: hidden; }
.workbench-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100%; min-height: 0; }
.workbench-rail {
  min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line);
  background: #0f1216; overflow: hidden;
}
.rail-section { min-height: 0; padding: 16px 12px; border-bottom: 1px solid var(--line); }
.rail-section.grow { flex: 1; display: flex; flex-direction: column; border-bottom: 0; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rail-heading h3 { font-size: 14px; }
.rail-list { display: grid; gap: 5px; min-height: 0; overflow-y: auto; }
.rail-section.grow .rail-list { flex: 1; }
.rail-item {
  width: 100%; border: 1px solid transparent; border-radius: 9px; background: transparent;
  color: var(--muted); padding: 9px 10px; text-align: left; cursor: pointer; display: grid; gap: 3px;
}
.rail-item:hover { background: #151a20; color: var(--text); }
.rail-item.active { background: #1a2028; color: var(--text); border-color: var(--line); }
.rail-item strong { color: inherit; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item span { color: var(--faint); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-empty { padding: 14px 10px; color: var(--faint); font-size: 12px; line-height: 1.5; }

.rail-filter { width: 100%; margin: 0 0 9px; padding: 7px 9px; border-radius: 8px; border-color: var(--line); background: #0c0f13; color: var(--text); font-size: 11px; }
.rail-filter::placeholder { color: var(--faint); }
.conversation-item { gap: 4px; }
.rail-presence { display: flex !important; align-items: center; gap: 5px; color: #aeb8c5 !important; }
.rail-presence-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 999px; background: #69d79a; box-shadow: 0 0 0 3px rgba(105,215,154,.08); }

.chat-shell { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto auto auto minmax(0,1fr) auto auto; background: #0c0f13; }
.run-presence { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 7px 20px; border-bottom: 1px solid var(--line); background: rgba(86,129,209,.07); color: var(--muted); font-size: 10px; }
.run-presence.mine { background: rgba(87,202,135,.06); }
.run-presence.waiting { background: rgba(244,198,107,.07); }
.run-presence strong { color: var(--text); font-size: 10px; }
.run-presence > span:not(.run-presence-dot) { padding-left: 8px; border-left: 1px solid var(--line); }
.run-presence-dot { width: 7px; height: 7px; border-radius: 999px; background: #69d79a; box-shadow: 0 0 0 4px rgba(105,215,154,.08); }
.run-presence.waiting .run-presence-dot { background: #e8bd69; box-shadow: 0 0 0 4px rgba(232,189,105,.08); }
.chat-header { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); background: rgba(13,16,20,.96); }
.chat-title-block { min-width: 0; }
.chat-title-block h3 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions { display: flex; align-items: flex-end; gap: 8px; }
.runtime-picker { margin: 0; min-width: 155px; }
.runtime-picker span { display: block; color: var(--faint); font-size: 10px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .08em; }
.runtime-picker select { padding-block: 8px; font-size: 12px; }
.runtime-banner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #11151a; }
.runtime-banner > div:first-child { min-width: 0; display: grid; gap: 3px; }
.runtime-banner strong { font-size: 12px; }
.runtime-banner span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.runtime-actions { display: flex; align-items: center; gap: 8px; }
.inline-form { display: flex; align-items: center; gap: 7px; }
.inline-form input { width: 230px; padding-block: 8px; font-size: 11px; }
.timeline-notice { padding: 7px 20px; border-bottom: 1px solid rgba(244,198,107,.2); background: rgba(244,198,107,.06); color: #e6cb8e; font-size: 11px; }

.conversation-timeline { min-height: 0; overflow-y: auto; padding: 22px max(22px, calc((100% - 920px) / 2)); scroll-behavior: smooth; }
.chat-empty { min-height: 100%; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.chat-empty span { max-width: 440px; font-size: 12px; line-height: 1.6; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.message { display: grid; gap: 6px; margin: 12px 0 18px; }
.message.user { justify-items: end; }
.message.assistant { justify-items: start; }
.message-meta { color: var(--faint); font-size: 10px; display: flex; align-items: center; gap: 7px; }
.message-bubble { max-width: min(780px, 86%); padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: #151a20; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 13px; }
.message.user .message-bubble { background: #20283a; border-color: #303c57; }
.message-steering .message-bubble { border-style: dashed; background: rgba(138,164,255,.08); }

.run-events { margin: 8px 0 18px; display: grid; gap: 6px; }
.event-card { border: 1px solid var(--line); border-radius: 9px; background: #101419; overflow: hidden; }
.event-card[open] { border-color: var(--line-strong); }
.event-card summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 9px 11px; }
.event-card summary::-webkit-details-marker { display: none; }
.event-icon { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); }
.event-title { min-width: 0; display: grid; gap: 2px; }
.event-title strong { font-size: 11px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-title span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-time { color: var(--faint); font-size: 9px; }
.event-body { border-top: 1px solid var(--line); padding: 10px 11px; }
.event-body pre { margin: 0; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: #b8c1cd; font-size: 10px; line-height: 1.5; }
.event-card.error .event-icon { background: var(--danger); }
.event-card.verification .event-icon { background: var(--success); }
.event-card.reasoning .event-icon { background: var(--warning); }

.steering-bar { padding: 9px 20px; border-top: 1px solid var(--line); background: #11161c; display: flex; align-items: center; gap: 12px; }
.steering-bar > span { color: var(--accent-strong); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.steering-form { flex: 1; display: grid; grid-template-columns: minmax(120px,1fr) auto auto; gap: 8px; align-items: center; }
.steering-form input[type="text"] { padding-block: 8px; font-size: 11px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.checkbox-label input { width: auto; }

.composer { padding: 12px 20px 16px; border-top: 1px solid var(--line); background: #0f1318; }
.composer textarea { max-height: 220px; background: #131820; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.composer-footer span { color: var(--faint); font-size: 10px; }
.dialog-actions { margin-top: 16px; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.composer-tools { min-width: 0; display: flex; align-items: center; gap: 10px; }
.button-compact { padding: 7px 10px; font-size: 10px; }
.attachment-tray { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-bottom: 9px; }
.attachment-card { position: relative; min-width: 0; display: grid; grid-template-columns: 44px minmax(0,1fr) 26px; align-items: center; gap: 9px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: #111720; }
.attachment-preview { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); background: #0b0e12; }
.attachment-copy { min-width: 0; display: grid; gap: 3px; }
.attachment-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.attachment-copy span { color: var(--muted); font-size: 9px; }
.attachment-remove { width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 17px; }
.attachment-remove:hover { background: rgba(255,255,255,.05); color: var(--text); }
.message-image-row { display: flex; flex-wrap: wrap; gap: 6px; max-width: min(780px, 86%); }
.message.user .message-image-row { justify-content: flex-end; }
.message-image-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: #111720; color: var(--muted); font-size: 9px; }
.event-card.command .event-icon { background: #63a9ff; }
.event-card.vision .event-icon { background: #b58cff; }
.event-status-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: #171c23; color: var(--muted); font-size: 9px; }
.status-pill.ok { border-color: rgba(87,202,135,.35); background: rgba(87,202,135,.08); color: #88dbaa; }
.status-pill.bad { border-color: rgba(242,107,107,.35); background: rgba(242,107,107,.08); color: #ff9b9b; }
.event-copy, .vision-analysis { margin: 0 0 10px; color: #c4ccd7; font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-output { max-height: 320px !important; padding: 9px 10px; border: 1px solid #222b35; border-radius: 7px; background: #090c10; color: #b8d4be !important; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.path-block { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #0b0f14; color: #b9c7dc; overflow-wrap: anywhere; }
.plan-list { margin: 0; padding-left: 22px; display: grid; gap: 7px; }
.plan-list li { padding-left: 3px; color: #c6ced8; font-size: 11px; line-height: 1.45; }
.plan-list code { margin-right: 8px; color: var(--accent); }
.check-list { display: grid; gap: 7px; }
.check-item { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #0d1116; }
.check-item > div { min-width: 0; display: grid; gap: 3px; }
.check-item strong { font-size: 10px; overflow-wrap: anywhere; }
.check-item span:not(.status-pill) { color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }

@media (max-width: 920px) {
  .workbench-grid { grid-template-columns: 220px minmax(0,1fr); }
  .chat-header { align-items: flex-start; }
  .chat-actions { flex-direction: column; align-items: stretch; }
  .inline-form input { width: 160px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .workbench-view { height: auto; min-height: calc(100vh - 80px); overflow: visible; }
  .workbench-grid { grid-template-columns: 1fr; min-height: calc(100vh - 80px); }
  .workbench-rail { max-height: 310px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-shell { min-height: 760px; }
  .conversation-timeline { min-height: 420px; padding-inline: 16px; }
  .runtime-banner, .chat-header { align-items: flex-start; flex-direction: column; }
  .runtime-actions, .inline-form { width: 100%; }
  .inline-form input { width: 100%; }
  .steering-bar { align-items: stretch; flex-direction: column; }
  .steering-form { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-row.compact { padding-bottom: 12px; }
  .nav-list { grid-template-columns: repeat(3, 1fr); }
  .nav-item { text-align: center; }
  .sidebar-footer { margin-top: 10px; }
  .topbar { padding: 0 18px; }
  .view { padding: 20px 18px 36px; }
  .hero-panel { align-items: flex-start; flex-direction: column; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .public-shell { padding: 16px; }
  .auth-card { padding: 24px 20px; border-radius: 16px; }
  .metric-grid { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .nav-item { font-size: 12px; padding-inline: 6px; }
}


/* ADR-0051: conversation lifecycle + canonical run Git result */
.conversation-item.archived { opacity: .72; }
.conversation-item.archived strong::after { content: " · archivada"; font-size: .72rem; font-weight: 600; color: var(--muted); }
.run-result { margin: 0 18px 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); display: grid; gap: 12px; }
.run-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.run-result-heading h4 { margin: 2px 0 0; }
.run-result-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .82rem; }
.run-result-meta span { overflow-wrap: anywhere; }
.run-git-paths { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.run-git-paths code { padding: 4px 7px; border-radius: 7px; background: var(--code-bg); border: 1px solid var(--line); font-size: .75rem; }
.run-git-diff-stat, .run-git-patch { max-height: 280px; overflow: auto; }
.run-git-patch-details summary { cursor: pointer; color: var(--text); font-weight: 700; }


/* ADR-0052: project runtime + repository settings */
.project-settings-card { width: min(1040px, calc(100vw - 32px)); max-height: min(900px, calc(100vh - 32px)); overflow: auto; }
.project-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.settings-section { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); display: grid; gap: 10px; align-content: start; }
.settings-section-wide { grid-column: 1 / -1; }
.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.settings-section-heading h4 { margin: 2px 0 0; }
.stack-form { display: grid; gap: 9px; }
.settings-list { display: grid; gap: 7px; }
.settings-list-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #0d1116; }
.settings-list-copy { min-width: 0; display: grid; gap: 3px; }
.settings-list-copy strong, .settings-list-copy span { overflow-wrap: anywhere; }
.settings-list-copy span { color: var(--muted); font-size: 10px; }
.settings-form-grid { align-items: end; }
.settings-wide-field, .settings-secret-field { grid-column: span 2; }
.settings-repository-current { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #0d1116; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .project-settings-grid { grid-template-columns: 1fr; }
  .settings-section-wide { grid-column: auto; }
  .settings-wide-field, .settings-secret-field { grid-column: auto; }
}

.settings-member-row { align-items: center; gap: 12px; }
.settings-member-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.settings-member-role { min-width: 130px; }
@media (max-width: 920px) {
  .settings-member-controls { width: 100%; justify-content: stretch; }
  .settings-member-role { flex: 1; }
}
