/* AI Factory · «Диспетчерская»: graphite surfaces, teal signal, amber attention, mono telemetry labels. */
:root {
  color-scheme: dark;
  --bg: #0a0e14;
  --bg-raise: #0d131c;
  --panel: #111822;
  --panel-2: #0e151e;
  --border: #223043;
  --border-strong: #2f4560;
  --text: #e8eef8;
  --muted: #92a3bb;
  --faint: #66788f;
  --accent: #5fe0c5;
  --accent-ink: #062019;
  --blue: #9ab8ff;
  --warning: #f3c06d;
  --danger: #ff9ea3;
  --rail: 216px;
  --rail-collapsed: 64px;
  --top: 56px;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, monospace;
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
body {
  margin: 0; min-height: 100dvh; color: var(--text);
  background: radial-gradient(circle at 1px 1px, #ffffff0a 1px, transparent 0) 0 0 / 22px 22px, var(--bg);
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
}
body[data-rail="collapsed"] { --rail: var(--rail-collapsed); }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible,
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Rail navigation: always visible, collapsible to icons. */
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 12px 10px; border-right: 1px solid var(--border); background: var(--bg-raise); overflow: hidden; z-index: 5;
}
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 15px; min-width: 0; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font-weight: 450; font-size: 11px; }
.mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px;
  font: 800 12px/1 var(--mono); letter-spacing: .04em; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #8fd0ff);
}
.rail-toggle, .icon-button {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 8px;
  color: var(--muted); background: transparent; border: 1px solid transparent;
}
.rail-toggle:hover, .icon-button:hover { color: var(--text); background: #172233; border-color: var(--border); }
nav { display: grid; gap: 2px; margin-top: 6px; }
.nav-group { margin: 12px 10px 4px; color: var(--faint); font: 600 10.5px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
nav a {
  position: relative; display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 8px;
  color: var(--muted); font-weight: 560; font-size: 14px; white-space: nowrap;
}
nav a:hover { background: #151f2d; color: var(--text); }
nav a[aria-current] { background: #13252a; color: var(--text); }
nav a[aria-current]::before { content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
nav a[aria-current] .icon { color: var(--accent); }
.source { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; white-space: nowrap; }
.source strong { display: block; font-size: 12.5px; }
.source small { display: block; color: var(--muted); font-size: 11px; }
.signal { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--accent); box-shadow: 0 0 0 3px #5fe0c51f; }
body[data-rail="collapsed"] .brand-text, body[data-rail="collapsed"] .nav-label, body[data-rail="collapsed"] .nav-group { display: none; }
body[data-rail="collapsed"] .rail-head { flex-direction: column; }
body[data-rail="collapsed"] nav a { justify-content: center; padding: 0; }
body[data-rail="collapsed"] .source { justify-content: center; padding: 10px 0; border-color: transparent; }

/* Main area and compact top bar. */
main { min-width: 0; width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px) 28px; }
.top {
  position: sticky; top: 0; z-index: 4; height: var(--top); margin: 0 calc(-1 * clamp(16px, 3vw, 40px)) 18px;
  padding: 0 clamp(16px, 3vw, 40px); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #0a0e14e6; border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h2 { margin: 0; font-size: 18px; line-height: 1.25; letter-spacing: -.012em; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font: 600 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.top-tools { display: flex; align-items: center; gap: 10px; min-width: 0; }
.connection-state {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 30px; padding: 4px 10px; margin: 0; white-space: nowrap;
  border: 1px solid var(--border); color: var(--warning); font-size: 12px; background: var(--panel);
}
.connection-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.connection-state[data-state="ready"] { color: var(--accent); }
.connection-state[data-state="fault"] { color: var(--danger); }
.connection { display: flex; align-items: center; gap: 6px; }
.account-chip { display: flex; align-items: center; gap: 6px; padding: 3px 3px 3px 4px; border: 1px solid var(--border); border-radius: 30px; background: var(--panel); }
.account-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #1d3340; color: var(--accent); font: 700 12px/1 var(--mono); }
.account-name { font-size: 13px; font-weight: 600; padding-right: 2px; }
.account-name:hover { color: var(--accent); }
.account-chip .icon-button { width: 28px; height: 28px; border-radius: 50%; }
.account-chip .icon { width: 17px; height: 17px; }

button, select, input, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: 8px; }
button { cursor: pointer; padding: 6px 11px; font-size: 13px; }
button:hover:not(:disabled) { border-color: #48688c; }
button:disabled { cursor: default; opacity: .55; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; padding: 8px 15px; }
button.primary:hover:not(:disabled) { background: #86ecd6; }
.panel { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; padding: 16px 18px; }
.access-card {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px 18px; margin: 0 0 16px; padding: 12px 16px;
  border: 1px solid var(--border-strong); border-left: 3px solid var(--warning); border-radius: 10px; background: var(--panel);
}
.access-card #access-note { margin: 0; flex: 1 1 260px; }
.access-card #access-note:empty { display: none; }
.form-inline { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.access-card label, .composer label { display: grid; gap: 5px; color: var(--muted); font-size: 12.5px; }
.access-card input, .composer select, .composer textarea { padding: 8px 10px; max-width: 100%; }
.composer { display: grid; gap: 10px; }
.composer select { width: min(100%, 330px); }
.composer textarea { width: 100%; resize: none; }
.chat-list, .agents { display: grid; gap: 10px; }
.chat-list + button, #task-detail, .agents:not(:empty) + .section-heading { margin-top: 16px; }
.chat-turn p { margin: 0 0 9px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-status, #control-status { color: var(--accent); }
#control-status { margin: 0 0 12px; font-size: 13px; }
.task-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task-row p { margin: 0; }
#task-detail p { overflow-wrap: anywhere; }
.agents { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.activity { margin-bottom: 24px; }
#notice { padding: 11px 14px; color: var(--danger); background: #36202b; border: 1px solid #6f3846; border-radius: 8px; }
section { margin-bottom: 24px; scroll-margin-top: calc(var(--top) + 12px); }
.section-heading { margin-bottom: 11px; }
.section-heading span, .metric small, .quiet { color: var(--muted); font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric, .workers, .history-panel { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; }
.metric { padding: 13px 15px; display: grid; gap: 3px; }
.metric > span { color: var(--faint); font: 600 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.metric strong { font-size: clamp(20px, 2.4vw, 28px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.workers { padding: 12px 15px; }
.workers p { margin: 0; }
.worker { display: flex; align-items: center; gap: 11px; }
.worker .mark { width: 30px; height: 30px; font-size: 14px; }
.worker strong { display: block; }
.filters { padding: 12px 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; border-bottom: 1px solid var(--border); }
.filters label { color: var(--muted); display: grid; gap: 4px; font-size: 12px; min-width: 0; }
.filters select { width: 100%; padding: 7px; text-overflow: ellipsis; }
.feed { padding: 0 14px; }
.empty { margin: 0; padding: 34px 8px; text-align: center; color: var(--muted); }
.group-title { color: var(--blue); margin: 0; padding: 13px 7px 4px; font: 600 12px/1.3 var(--mono); overflow-wrap: anywhere; }
.event + .event { border-top: 1px solid var(--border); }
.event summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(160px, 1fr) minmax(93px, .5fr) minmax(115px, .66fr) auto; gap: 9px; align-items: center; min-height: 46px; padding: 7px 6px; }
.event summary::-webkit-details-marker { display: none; }
.event summary:hover { background: #142030; }
.event summary::after { content: '+'; color: var(--blue); }
.event[open] summary::after { content: '−'; }
.event-title { display: flex; align-items: center; min-width: 0; gap: 9px; font-weight: 650; }
.indicator { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--blue); }
.event[data-tone="tool"] .indicator { background: #bb9dff; }
.event[data-tone="done"] .indicator { background: var(--accent); }
.event[data-tone="error"] .indicator { background: var(--danger); }
.event code, .event time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.fields { background: var(--panel-2); border-radius: 8px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0 6px 9px; padding: 9px 12px; font-size: 13px; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; }

/* Focus mode: chat and Art Studio take the whole working area; only their own content scrolls. */
body[data-view="chat"], body[data-view="studio"] { height: 100dvh; overflow: hidden; }
body[data-view="chat"] main, body[data-view="studio"] main {
  height: 100dvh; display: flex; flex-direction: column; padding-bottom: 0; max-width: none;
}
body[data-view="chat"] main > section:not([hidden]):not(#owner-access),
body[data-view="studio"] main > section:not([hidden]):not(#owner-access) { flex: 1 1 auto; min-height: 0; margin-bottom: 0; }
body[data-view="chat"] .top, body[data-view="studio"] .top { flex: 0 0 auto; margin-bottom: 12px; }
body[data-view="chat"] main > :not(section), body[data-view="studio"] main > :not(section), #owner-access { flex-shrink: 0; }

@media (max-width: 1000px) {
  .metric { padding-inline: 10px; }
}
/* Phone: the rail becomes a fixed icon bar at the top; every section stays one tap away. */
@media (max-width: 760px) {
  :root { --top: 50px; --bar: 52px; }
  body, body[data-rail="collapsed"] { display: block; padding-top: var(--bar); }
  .sidebar {
    position: fixed; inset: 0 0 auto 0; height: var(--bar); flex-direction: row; align-items: center; gap: 0;
    padding: 0 4px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .rail-head, .source, .nav-group, .nav-label { display: none !important; }
  nav { display: flex; flex: 1; justify-content: space-between; gap: 0; margin: 0; }
  nav a, body[data-rail="collapsed"] nav a { flex: 1 1 0; justify-content: center; height: 44px; padding: 0; min-width: 0; }
  nav a[aria-current]::before { left: 22%; right: 22%; top: auto; bottom: -4px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  main { padding: 0 12px 20px; }
  .top { top: var(--bar); height: var(--top); margin: 0 -12px 14px; padding: 0 12px; }
  .top-tools { gap: 6px; }
  .connection-state { font-size: 0; padding: 0; width: 26px; height: 26px; justify-content: center; }
  .connection-state::before { width: 9px; height: 9px; }
  .account-name { display: none; }
  body[data-view="chat"] main, body[data-view="studio"] main { height: calc(100dvh - var(--bar)); }
  .metrics, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .section-heading span { text-align: right; font-size: 11px; }
  .event summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
  .event summary code { display: none; }
  .event-title { font-size: 13px; }
}

/* Model Hub */
.model-list { margin-top: 16px; }
.model-card, .agent-card { overflow-wrap: anywhere; }
.agent-model { color: var(--accent); font-weight: 650; }
.model-available { color: var(--accent); font-size: 13px; }
.model-unavailable { color: var(--warning); font-size: 13px; }

/* Developer Workspace */
.dev-patch {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 480px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
#dev-detail { overflow-wrap: anywhere; }


/* Dedicated engineering task page */
.task-page { display:grid; gap:20px; min-width:0; }
.task-back { color:var(--blue); font-weight:650; }
.task-back:hover { text-decoration:underline; }
.task-hero { padding:clamp(20px,4vw,34px); }
.task-hero h2 { font-size:clamp(24px,3vw,34px); }
.task-state { font-weight:700; }
.task-stat-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.task-tabs { display:flex; flex-wrap:wrap; margin:0; gap:6px; border-bottom:1px solid var(--border); }
.task-tabs a { padding:12px 16px; border-bottom:2px solid transparent; }
.task-tabs a[aria-current] { color:var(--accent); border-color:var(--accent); }
.task-content { padding:clamp(18px,3vw,30px); min-width:0; overflow-wrap:anywhere; }
.task-diff { background:#090f17; border:1px solid var(--border); border-radius:9px; padding:12px; overflow:auto; font:13px/1.7 ui-monospace,monospace; white-space:pre-wrap; }
.diff-line { padding:3px 8px; }
.diff-add { background:#12362b; color:#9cf1bc; }
.diff-remove { background:#3c2029; color:#ffb0b5; }
.diff-header { color:var(--blue); }
@media(max-width:760px) {
  .task-stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .task-tabs a { padding:9px 10px; }
}


/* Independent expert */
.expert-head { padding:20px; border:1px solid var(--border);
  border-radius:12px; background:#132333; margin-top:18px; }
.expert-head h2 { color:var(--accent); overflow-wrap:anywhere; }
.expert-line { padding:16px 18px; margin:12px 0;
  border:1px solid var(--border); border-radius:10px; }
.expert-line p:first-child { margin-top:0; }
.expert-line p:last-child { margin-bottom:0; }
.expert-source { padding:13px 15px; border-radius:8px;
  background:#090f17; border:1px solid var(--border);
  white-space:pre-wrap; overflow-wrap:anywhere;
  font:13px/1.7 ui-monospace,monospace; color:#b5d7ff; }
.expert-notice { border-left:3px solid var(--warning);
  padding:10px 18px; margin-top:24px; background:#211f22; }
.expert-notice h3 { margin-top:8px; }
.task-content details { margin-top:22px; color:var(--muted); }
.task-content summary { cursor:pointer; }


/* Unified AI Factory chat: focus layout with its own scroll area and a pinned composer. */
[data-section="chat"] { display: flex; flex-direction: column; min-height: 0; }
.chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.chat-scroll > * { width: min(100%, 920px); margin-inline: auto; }
.chat-welcome { padding: clamp(16px, 6vh, 64px) 0 12px; }
.chat-welcome h2 { font-size: clamp(22px, 3vw, 30px); letter-spacing: -.02em; }
.chat-welcome p.quiet { max-width: 560px; margin: 8px 0 0; }
.chat-scroll:has(#chat-history .unified-turn) .chat-welcome { display: none; }
#load-older { display: block; margin: 12px auto 0; }
.unified-history { display: flex; flex-direction: column; gap: 26px; padding: 18px 0 24px; }
.unified-turn { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.user-message {
  align-self: flex-end; max-width: 80%; width: fit-content; padding: 12px 16px;
  background: #18283a; border: 1px solid #24405a; border-radius: 14px 14px 4px 14px; overflow-wrap: anywhere;
}
.assistant-message {
  width: 100%; min-width: 0; padding: 4px 0 4px 16px; border-left: 2px solid #1f4a45; overflow-wrap: anywhere;
}
.message-author { color: var(--accent); font: 600 12px/1.4 var(--mono); letter-spacing: .02em; }
.assistant-text { font-size: 15.5px; line-height: 1.75; }
.chat-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 0; color: var(--blue); }
.chat-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: chat-spin .8s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-spinner { animation: none; } }
#chat-live { color: var(--muted); font-size: 13px; padding: 0 0 12px; margin: 0 auto; }
.chat-error { color: var(--danger); }
.inline-task-details { color: var(--muted); font-size: 13px; margin-top: 10px; }
.inline-task-details summary { cursor: pointer; padding: 6px 0; }
.inline-task-details[open] { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.unified-composer {
  flex: 0 0 auto; width: min(100%, 920px); margin: 0 auto 14px; padding: 10px 12px 10px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--panel); box-shadow: 0 -10px 30px #0a0e14;
}
.unified-composer:focus-within { border-color: #3f7d74; }
.unified-composer textarea { background: transparent; border: 0; font-size: 15.5px; padding: 6px 4px; min-height: 56px; max-height: 30vh; }
.unified-composer textarea:focus-visible { outline: none; }
.composer-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.composer-toolbar label { display: flex; align-items: center; gap: 8px; }
.composer-toolbar select { padding: 6px 8px; font-size: 13px; }
.composer-toolbar #chat-send { margin-left: auto; border-radius: 10px; padding: 8px 18px; }
.composer-hint { margin: 0; font-size: 12px; }
@media (max-width: 760px) {
  .user-message { max-width: 94%; }
  .assistant-message { padding-left: 10px; }
  .unified-composer { margin-bottom: 8px; border-radius: 12px; }
  .composer-toolbar label { flex: 1 1 100%; }
  .composer-toolbar label select { flex: 1; min-width: 0; }
  .composer-hint { display: none; }
}

/* Conversational Markdown */
.chat-markdown {
  font-size:16px;
  line-height:1.8;
  overflow-wrap:anywhere;
}
.chat-markdown p {
  margin:10px 0;
}
.chat-markdown h2,
.chat-markdown h3,
.chat-markdown h4 {
  margin:22px 0 10px;
  line-height:1.4;
}
.chat-markdown ul,
.chat-markdown ol {
  padding-left:25px;
  margin:12px 0;
}
.chat-markdown li {
  margin:6px 0;
}
.chat-markdown strong {
  font-weight:700;
}
.chat-markdown hr {
  border:0;
  border-top:1px solid var(--border);
  margin:22px 0;
}
.chat-markdown code {
  background:#182738;
  border-radius:5px;
  padding:2px 5px;
  font-family:ui-monospace,monospace;
}
.markdown-code-block {
  background:#080e16;
  border:1px solid var(--border);
  border-radius:12px;
  margin:18px 0;
  min-width:0;
  overflow:hidden;
}
.markdown-code-toolbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  background:#172332;
  padding:8px 12px;
  font-size:12px;
}
.markdown-code-block pre {
  padding:16px;
  margin:0;
  overflow-x:auto;
  font:13px/1.7 ui-monospace,monospace;
  white-space:pre;
}

/* Command Center: home and production */
.small { font-size: 12px; }
.home-intro { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 18px; }
.home-intro h2 { font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -.02em; }
.home-intro p.quiet { margin: 6px 0 0; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.action {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--panel); font-size: 13.5px; font-weight: 600;
}
.action:hover { border-color: #48688c; background: #142030; }
.action .icon { width: 18px; height: 18px; color: var(--accent); }
.action.primary-action { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.action.primary-action .icon { color: var(--accent-ink); }
.action.primary-action:hover { background: #86ecd6; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; margin-bottom: 26px; }
.status-card, .shortcut { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); min-width: 0; transition: border-color .15s, background .15s; }
.status-card:hover, .shortcut:hover { border-color: #3a5878; background: #131f2e; }
.status-label { color: var(--faint); font: 600 10.5px/1.3 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.status-card strong { font-size: clamp(19px, 2.2vw, 25px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.25; }
.status-card small, .shortcut small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
#home-journal[data-state="ready"] { color: var(--accent); }
#home-journal[data-state="wait"] { color: var(--warning); }
#home-journal[data-state="fault"] { color: var(--danger); }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.shortcut { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.shortcut > .icon { grid-row: span 2; width: 36px; height: 36px; padding: 8px; border-radius: 9px; color: var(--accent); background: #13252a; }
.meter { display: block; height: 6px; border-radius: 6px; background: #1c2a3d; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4fb8a3, var(--accent)); border-radius: inherit; transition: width .3s; }
.meter.large { height: 10px; margin: 6px 0 14px; }
.production-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; padding-block: 11px; }
.production-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.button-link { display: inline-flex; align-items: center; border-radius: 7px; padding: 6px 12px; font-size: 13px; border: 1px solid #38506b; }
.button-link.primary { background: var(--accent); color: #0b201b; border-color: transparent; font-weight: 700; }
.notice-panel { border-color: #6f3846; margin-bottom: 14px; }
.notice-panel h2 { color: var(--danger); }
.command { margin: 0; padding: 9px 12px; border-radius: 7px; background: #090f17; border: 1px solid var(--border); font: 13px/1.5 ui-monospace, monospace; overflow-x: auto; }
.production-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.subheading { margin: 18px 0 9px; font-size: 13px; color: var(--muted); font-weight: 650; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 0; }
.stat { padding: 9px 11px; border-radius: 8px; background: #0e1724; border: 1px solid #1f2d40; }
.stat dt { color: var(--muted); font-size: 12px; }
.stat dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat[data-tone="ok"] dd { color: var(--accent); }
.stat[data-tone="warn"] dd { color: var(--warning); }
.stat[data-tone="bad"] dd { color: var(--danger); }
#review-next { margin: 12px 0 0; }
.level-list, .art-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.level { display: grid; gap: 5px; }
.level-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.art-task { padding: 10px 12px; border-radius: 8px; background: #0e1724; border: 1px solid #1f2d40; min-width: 0; }
.art-task p { margin: 3px 0 0; overflow-wrap: anywhere; }
.art-task-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.art-tasks .empty { padding: 20px 8px; }
.badge { flex: 0 0 auto; padding: 2px 8px; border-radius: 20px; font-size: 12px; border: 1px solid currentColor; color: var(--blue); }
.badge[data-state="SUCCEEDED"] { color: var(--accent); }
.badge[data-state="RUNNING"], .badge[data-state="QUEUED"] { color: var(--warning); }
.badge[data-state="FAILED"] { color: var(--danger); }
@media (max-width: 1000px) {
  .production-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .production-actions { margin-left: 0; }
  .quick-actions { width: 100%; }
  .action { flex: 1 1 auto; justify-content: center; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .status-card { padding: 11px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .meter > span, .status-card, .shortcut { transition: none; }
}

/* Art Studio section (part of this page, no frame): it fills the working area and scrolls inside it, so the top bar
   and the rail stay in place; the studio's own styles are scoped to .art-studio (labs/art-studio/art-studio.css). */
[data-section="studio"] { display: flex; flex-direction: column; margin-bottom: 0; }
.studio-shell { flex: 1 1 auto; min-height: 0; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: auto; background: var(--bg); }
#studio-start { display: grid; gap: 8px; justify-items: start; }
@media (max-width: 760px) {
  .studio-shell { margin: 0 -12px; border-width: 1px 0 0; border-radius: 0; }
}

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; align-items: start; }
.settings-grid h2 { margin-bottom: 12px; }
.fields.account { margin: 0 0 10px; }
.settings-form { display: grid; gap: 11px; max-width: 420px; }
.settings-form label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.settings-form input { padding: 8px 10px; }
.settings-form button { justify-self: start; }
#password-note[data-error] { color: var(--danger); }
#home-routes[data-state="ready"] { color: var(--accent); }
#home-routes[data-state="fault"] { color: var(--danger); }
#home-routes { font-size: clamp(18px, 2vw, 22px); }

/* DEV-05: work cards, task details dialog and lifecycle timeline */
.work-card {
  display: grid; gap: 8px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); min-width: 0;
}
.work-card[data-state="running"], .work-card[data-state="queued"] { border-color: #2c5a52; }
.work-card[data-state="failed"], .work-card[data-state="blocked"], .work-card[data-state="interrupted"] { border-color: #6f3846; }
.work-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.work-avatar {
  display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px;
  background: #13252a; color: var(--accent); font: 700 13px/1 var(--mono);
}
.work-who { display: grid; min-width: 0; flex: 1; }
.work-who strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-model { color: var(--muted); font: 12px/1.35 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-state {
  flex: 0 0 auto; padding: 2px 9px; border-radius: 20px; border: 1px solid currentColor;
  font: 600 11.5px/1.5 var(--mono); color: var(--blue); white-space: nowrap;
}
.work-state[data-state="succeeded"] { color: var(--accent); }
.work-state[data-state="running"], .work-state[data-state="queued"], .work-state[data-state="cancelling"] { color: var(--warning); }
.work-state[data-state="failed"], .work-state[data-state="blocked"], .work-state[data-state="interrupted"] { color: var(--danger); }
.work-state[data-state="cancelled"] { color: var(--muted); }
.work-task { margin: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.work-time { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.work-time .chat-spinner { width: 13px; height: 13px; }
.work-timer { color: var(--text); font-family: var(--mono); }
.work-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.work-actions button { padding: 4px 10px; font-size: 12.5px; }
.work-actions [data-action="cancel"] { color: var(--danger); border-color: #6f3846; }
.assistant-message { display: grid; gap: 10px; border-left: 0; padding-left: 0; }
.assistant-message > .chat-markdown, .assistant-message > p { padding-left: 14px; border-left: 2px solid #1f4a45; margin: 0; }
.task-row { display: block; }
.task-row[aria-current] .work-card { border-color: var(--accent); }
#chat-tasks { gap: 8px; }
#task-detail { display: grid; gap: 4px; }

.task-dialog {
  width: min(720px, calc(100vw - 24px)); max-height: min(86dvh, 900px); padding: 0; border: 1px solid var(--border-strong);
  border-radius: 14px; background: var(--bg-raise); color: var(--text); box-shadow: 0 24px 70px #000a;
}
.task-dialog[open] { display: flex; flex-direction: column; }
.task-dialog::backdrop { background: #05080ccc; backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 18px; display: grid; gap: 2px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.detail-block { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail-block:last-child { border-bottom: 0; }
.detail-block h3 { margin: 0 0 8px; color: var(--faint); font: 600 10.5px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.detail-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 16px; margin: 0; font-size: 13.5px; }
.detail-facts dt { color: var(--muted); }
.detail-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0 0 8px; padding: 0 0 0 14px; border-left: 1px solid var(--border-strong); display: grid; gap: 7px; }
.timeline li { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -18px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.timeline li[data-state="succeeded"]::before { background: var(--accent); }
.timeline li[data-state="failed"]::before, .timeline li[data-state="interrupted"]::before { background: var(--danger); }
.timeline li[data-state="cancelled"]::before { background: var(--muted); }
.timeline time { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.handoffs { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 4px; }
.detail-block .chat-markdown { margin-bottom: 8px; }
@media (max-width: 760px) {
  .task-dialog { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  .work-foot { flex-direction: column; align-items: stretch; }
  .dialog-head h2 { white-space: normal; }
  .work-actions button { flex: 1 1 auto; }
  .timeline li { grid-template-columns: 64px minmax(0, 1fr); }
}

/* DEV-06: factory memory and context sources */
.memory-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 24px; margin-bottom: 14px; }
.memory-head h2 { font-size: clamp(20px, 2.4vw, 26px); letter-spacing: -.02em; }
.memory-head p.quiet { max-width: 640px; margin: 6px 0 0; }
.memory-tools { display: grid; gap: 10px; margin-bottom: 8px; }
.memory-search input { width: 100%; padding: 10px 12px; font-size: 14.5px; }
.memory-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 20px; padding: 4px 11px; font-size: 12.5px; color: var(--muted); }
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: transparent; font-weight: 650; }
.memory-list, .knowledge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.knowledge-entry { padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); min-width: 0; }
.knowledge-list .knowledge-entry { padding: 9px 11px; background: var(--panel-2); }
.knowledge-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.knowledge-head strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-entry > .quiet { margin: 3px 0 0; }
.knowledge-text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.knowledge-more summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.knowledge-status {
  flex: 0 0 auto; padding: 1px 8px; border-radius: 20px; border: 1px solid currentColor;
  font: 600 11px/1.6 var(--mono); white-space: nowrap; color: var(--blue);
}
.knowledge-status[data-tone="approved"] { color: var(--accent); }
.knowledge-status[data-tone="fact"] { color: #8fd0ff; }
.knowledge-status[data-tone="plan"] { color: var(--blue); }
.knowledge-status[data-tone="result"], .knowledge-status[data-tone="proposal"] { color: #c7a6ff; }
.knowledge-status[data-tone="unverified"] { color: var(--warning); }
.knowledge-status[data-tone="outdated"] { color: var(--faint); }
@media (max-width: 760px) {
  .memory-head .action { width: 100%; justify-content: center; }
}

/* DEV-07 coordinator: team steps come from stored workflow steps only. */
.team-plan { margin: .4rem 0; }
.team-steps, .team-log { margin: .2rem 0 .4rem; padding-left: 1.2rem; font-size: .85rem; }
.team-steps li { margin: .15rem 0; }
.team-steps li[data-state="running"] { font-weight: 600; }
.team-steps li[data-state="failed"], .team-steps li[data-state="interrupted"] { color: var(--danger, #c0392b); }
.team-steps li[data-state="cancelled"] { opacity: .7; }

/* UX-01: four spaces, section tabs, quick actions, command palette, project documents */
.spaces { display: grid; gap: 4px; }
.spaces a[aria-current="page"] { color: var(--text); background: #172233; border-color: var(--border); }
.palette-button { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 8px 10px;
  color: var(--muted); background: transparent; border: 1px dashed var(--border); border-radius: 8px; cursor: pointer; }
.palette-button:hover { color: var(--text); }
.title-block { display: grid; gap: 6px; min-width: 0; }
.subnav { display: flex; flex-wrap: wrap; gap: 4px; }
.subnav a { padding: 4px 10px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 13px; border: 1px solid transparent; }
.subnav a[aria-current="page"] { color: var(--text); background: #172233; border-color: var(--border); }
.subnav a[hidden] { display: none; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.quick-actions button { padding: 5px 10px; font-size: 13px; border-radius: 999px; }
.quick-actions button[aria-disabled="true"] { opacity: .55; }
.advanced-executor summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.advanced-executor[open] { display: grid; gap: 6px; }
.palette { width: min(640px, 92vw); padding: 0; color: var(--text); background: var(--panel, #0f1724); border: 1px solid var(--border); border-radius: 12px; }
.palette::backdrop { background: rgba(3, 7, 14, .6); }
.palette-form { display: grid; gap: 8px; padding: 12px; }
.palette-form input { width: 100%; padding: 10px 12px; font-size: 15px; }
.palette-list { display: grid; gap: 2px; max-height: 55vh; overflow: auto; margin: 0; padding: 0; list-style: none; }
.palette-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; padding: 6px 8px; border-radius: 8px; }
.palette-item > button:first-child { justify-self: start; background: none; border: 0; color: var(--text); font-weight: 600; cursor: pointer; padding: 0; }
.palette-item .quiet { grid-column: 1; }
.palette-item .palette-star { grid-column: 2; grid-row: 1 / span 2; background: none; border: 0; font-size: 18px; color: #e8b84a; cursor: pointer; }
.palette-item[aria-disabled="true"] > button:first-child { color: var(--muted); }
.palette-item:hover { background: #172233; }
.doc-tabs { gap: 6px; margin-bottom: 8px; }
.doc-tabs [aria-pressed="true"] { background: #172233; border-color: var(--border); }
.doc-body { max-height: 70vh; overflow: auto; line-height: 1.5; }
.engineer-journal summary { cursor: pointer; font-weight: 600; }
.engineer-turn .team-log { max-height: 260px; overflow: auto; }
/* The header now carries the section tabs of the current space. */
:root { --top: 92px; }
.top { align-items: center; }
.title-block h1 { line-height: 1.25; }
@media (max-width: 760px) {
  :root { --top: 96px; }
  .subnav .nav-label { display: inline !important; }
  .subnav { display: flex !important; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
  .subnav a { flex: 0 0 auto !important; height: auto !important; padding: 4px 10px !important; }
  .palette-button .nav-label { display: none !important; }
  .palette-button { width: auto; margin: 0; border: 0; }
}
.doc-tabs [aria-pressed="true"] { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .spaces { display: flex !important; flex: 1; justify-content: space-between; }
}
.title-block { flex: 1 1 0; min-width: 0; }
.top-tools { flex: 0 0 auto; }
.subnav { min-width: 0; max-width: 100%; }
@media (max-width: 760px) {
  .title-block { overflow: hidden; }
  /* Only the normal state is hidden on a phone; waiting and faults stay visible. */
  .top-tools .connection:has(.connection-state[data-state="ready"]) { display: none; }
}

/* RELEASE-01: visible ways out — a labelled sign-out, a close button on every dialog (Esc still works). */
.logout-button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 7px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.logout-button:hover { border-color: var(--warning); color: var(--warning); }
.logout-button .icon { width: 16px; height: 16px; }
.close-button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.close-button:hover { border-color: var(--accent); }
.palette-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#product-version { color: var(--accent); }

/* RELEASE-01 · Проект → Каталог наработок */
.catalog-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.catalog-filters label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.catalog-filters input, .catalog-filters select { width: 100%; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.catalog-card { display: grid; gap: 4px; padding: 8px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.catalog-card:hover, .catalog-card[aria-pressed="true"] { border-color: var(--accent); }
.catalog-card strong { font-size: 13px; overflow-wrap: anywhere; }
.catalog-card small { color: var(--muted); font-size: 12px; }
.catalog-thumb { display: grid; place-items: center; height: 110px; border-radius: 6px; background: var(--bg); color: var(--muted); font: 600 15px var(--mono); overflow: hidden; }
.catalog-thumb img { width: 100%; height: 100%; object-fit: contain; }
.catalog-badge { justify-self: start; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: #1a293a; color: var(--blue); }
.catalog-badge[data-status="reference"], .catalog-badge[data-status="standard"] { background: #12302b; color: var(--accent); }
.catalog-badge[data-status="accepted"] { background: #172e32; color: #9fe6d6; }
.catalog-badge[data-status="candidate"] { background: #3a2f1a; color: var(--warning); }
.catalog-badge[data-status="archive"] { background: #20242c; color: var(--faint); }
.catalog-view .dialog-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.catalog-view h2 { overflow-wrap: anywhere; }
.catalog-actions { display: flex; gap: 8px; align-items: center; }
.catalog-body img, .catalog-body video { display: block; max-width: 100%; max-height: 70vh; margin: 8px auto 0; border-radius: 8px; background: #000; }
.catalog-text { max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font: 13px/1.5 var(--mono); }
.catalog-studio { display: flex; flex-wrap: wrap; gap: 10px; }
.catalog-studio-link { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.catalog-studio-link:hover { border-color: var(--accent); }
.catalog-studio-link span { color: var(--muted); font-size: 13px; }
.catalog-variants { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .catalog-filters { grid-template-columns: 1fr 1fr; } .catalog-search { grid-column: 1 / -1; } }

/* RELEASE-01 · Система → Пользователи и доступ */
.users-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.user-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.user-card h3 { margin: 0 0 4px; font-size: 15px; overflow-wrap: anywhere; }
.user-edit { display: grid; gap: 6px; margin-top: 8px; }
.user-edit input:not([type=checkbox]), .user-edit select, .user-form input, .user-form select { width: 100%; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.user-edit .permission { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.user-form { display: grid; gap: 8px; max-width: 520px; }
.user-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.audit-list { margin: 0; padding-left: 18px; max-height: 50vh; overflow: auto; font: 13px/1.6 var(--mono); color: var(--muted); }
.catalog-view, [data-section] > .panel { scroll-margin-top: calc(var(--top) + 24px); }

/* RELEASE-01 FINAL · header: the section tabs stay on one line (scroll sideways instead of wrapping under the sticky
   header), the header grows instead of clipping its title; version visible everywhere; preview is marked. */
.top { height: auto; min-height: var(--top); padding-top: 6px; padding-bottom: 6px; }
.subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.subnav a { flex: 0 0 auto; white-space: nowrap; }
.version-chip { display: none; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 14px; color: var(--accent); font: 600 12px/1 var(--mono); white-space: nowrap; background: var(--panel); }
body[data-rail="collapsed"] .version-chip, body[data-instance="preview"] .version-chip { display: inline-flex; }
body[data-instance="preview"] .version-chip { color: var(--warning); border-color: #6b5320; }
.instance-tag { color: var(--warning); font-weight: 700; }
.rail-version { display: none; color: var(--accent); font: 600 10px/1 var(--mono); }
body[data-rail="collapsed"] .rail-version { display: block; text-align: center; margin-top: 4px; }
body[data-rail="collapsed"] .brand { flex-direction: column; }
.product-facts { margin-bottom: 8px; }
.changelog { margin: 8px 0; }
.changelog summary { cursor: pointer; color: var(--accent); }
@media (max-width: 760px) {
  .version-chip { display: inline-flex; padding: 0 7px; font-size: 11px; }
  .logout-button > span { display: none; }
  .logout-button { padding: 0 7px; }
}

/* RELEASE-01 FINAL · feedback */
.feedback-button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid #2f5c52; border-radius: 16px; background: #0f2420; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.feedback-button:hover { border-color: var(--accent); }
.feedback-dialog { width: min(640px, 94vw); }
.feedback-dialog textarea, .feedback-dialog select, #password-required input { width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.feedback-list { display: grid; gap: 10px; }
.feedback-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.feedback-item header { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; color: var(--muted); font-size: 13px; }
.feedback-item p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.feedback-item img { max-width: min(100%, 520px); max-height: 320px; border-radius: 8px; border: 1px solid var(--border); }
.feedback-item form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.feedback-item select, .feedback-item input { padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; }
.feedback-item input { flex: 1 1 220px; }
.feedback-filters { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
@media (max-width: 760px) { .feedback-button > span:last-child { display: none; } .feedback-button { padding: 0 8px; } .feedback-filters { grid-template-columns: 1fr; } }
body[data-role="coauthor"] #palette-open, body[data-role="member"] #palette-open { display: none; }
@media (max-width: 760px) { .title-block h1 { font-size: 16px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; } }
/* the section tabs get their own full-width row under the title and the tools (never hidden behind the tools) */
.top { flex-wrap: wrap; row-gap: 6px; }
.top > .title-block { display: contents; }
.top > .title-block > h1 { order: 1; flex: 1 1 200px; min-width: 0; }
.top > .top-tools { order: 2; }
.top > .title-block > .subnav { order: 3; flex: 1 0 100%; }
@media (max-width: 760px) { .detail-facts { grid-template-columns: 1fr !important; } .detail-facts dt { margin-top: 6px; } }
