.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--bar-h);
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: stretch;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .97);
}

.brand {
  min-width: 188px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-right: 1px solid var(--line);
}
.solar-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid var(--ink);
  border-radius: 50%;
}
.solar-mark::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--solar);
  box-shadow: 0 0 0 4px var(--surface);
}
.brand-name { font-stretch: 112%; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.brand-sub { margin-top: 1px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.room-nav {
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}
.room-nav::-webkit-scrollbar { display: none; }
.room-link {
  --room-color: var(--muted);
  position: relative;
  min-width: 72px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-right: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-stretch: 110%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
  white-space: nowrap;
}
.room-link::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--room-color);
  opacity: .55;
  transition: opacity var(--ease), transform var(--ease);
}
.room-link::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--room-color);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--ease);
}
.room-link:hover { color: var(--ink); background: var(--surface-quiet); }
.room-link:hover::before { opacity: 1; transform: scale(1.25); }
.room-link.active { color: var(--ink); background: #fff; }
.room-link.active::before { opacity: 1; }
.room-link.active::after { transform: scaleX(1); }
.room-link[data-room='focus'] { --room-color: var(--focus); }
.room-link[data-room='sell'] { --room-color: var(--sell); }
.room-link[data-room='make'] { --room-color: var(--make); }
.room-link[data-room='ship'] { --room-color: var(--ship); }
.room-link[data-room='money'] { --room-color: var(--money); }
.room-link[data-room='catalog'] { --room-color: var(--catalog); }
.room-link[data-room='company'] { --room-color: var(--company); }

.global-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}
.tool-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
}
.tool-button:hover, .tool-button[aria-expanded='true'] { border-color: var(--line); background: var(--surface-quiet); }
.tool-button kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font: 500 10px/1.2 var(--font-mono);
}
.thread-button { max-width: 240px; }
.thread-button .thread-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
}

.room-menu, .role-menu, .thread-menu {
  position: fixed;
  z-index: 80;
  top: 56px;
  min-width: 260px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow-menu);
}
.room-menu { left: var(--menu-left, 200px); }
.role-menu, .thread-menu { right: 14px; }
.thread-menu { right: 150px; width: 340px; }
.menu-head { padding: 10px 11px 7px; color: var(--muted); }
.menu-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}
.menu-item:hover, .menu-item.active { background: var(--surface-quiet); color: var(--ink); }
.menu-item.active { box-shadow: inset 3px 0 0 var(--room-color, var(--solar)); }
.menu-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.menu-sep { height: 1px; margin: 7px 4px; background: var(--line); }

.app-main { width: 100%; }
.page-frame {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 32px clamp(22px, 3.5vw, 58px) 54px;
}

.room-heading {
  --room-color: var(--focus);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  margin-bottom: 22px;
}
.room-heading[data-room='sell'] { --room-color: var(--sell); }
.room-heading[data-room='make'] { --room-color: var(--make); }
.room-heading[data-room='ship'] { --room-color: var(--ship); }
.room-heading[data-room='money'] { --room-color: var(--money); }
.room-heading[data-room='catalog'] { --room-color: var(--catalog); }
.room-heading[data-room='company'] { --room-color: var(--company); }
.room-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; color: var(--room-color); }
.room-eyebrow::before { content: ''; width: 18px; height: 2px; background: currentColor; }
.room-title { margin: 0; font-stretch: 108%; font-size: clamp(26px, 2.6vw, 38px); font-weight: 560; letter-spacing: -.035em; line-height: 1.08; }
.room-deck { max-width: 720px; margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }

.viewbar {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
  overflow-x: auto;
  scrollbar-width: none;
}
.viewbar::-webkit-scrollbar { display: none; }
.view-link {
  position: relative;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
}
.view-link:hover { color: var(--ink); background: rgba(255,255,255,.56); }
.view-link.active { color: var(--ink); background: var(--surface-strong); box-shadow: 0 0 0 1px var(--line); }
.viewbar-spacer { flex: 1; }
.density-toggle { min-height: 30px; color: var(--muted); font-size: 11px; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(20px, 2.3vw, 34px);
  align-items: start;
  margin-top: 24px;
}
.workspace-main { min-width: 0; }
.workspace-rail { min-width: 0; }

.brief-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.brief-cell { min-width: 0; padding: 15px 17px; border-right: 1px solid var(--line); }
.brief-cell:last-child { border-right: 0; }
.brief-value { display: flex; align-items: baseline; gap: 7px; color: var(--ink); font: 600 23px/1 var(--font-mono); letter-spacing: -.04em; }
.brief-value small { color: var(--muted); font: 500 11px/1 var(--font-ui); letter-spacing: 0; }
.brief-label { margin-top: 6px; color: var(--muted); font-size: 11px; }

.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-heading {
  min-height: 35px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 9px;
  border-bottom: 1px solid var(--line-strong);
}
.section-heading h2 { margin: 0; font-stretch: 108%; font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.section-note { color: var(--muted); font-size: 11px; }

.action-list { border-bottom: 1px solid var(--line-strong); }
.action-row {
  --row-color: var(--line-strong);
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 8px minmax(170px, .9fr) minmax(220px, 1.25fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 8px 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: background var(--ease), transform var(--ease);
}
.action-row:last-child { border-bottom: 0; }
.action-row:hover { background: rgba(255,255,255,.57); }
.action-row.done { opacity: .35; transform: translateX(7px); }
.action-mark { width: 4px; height: 34px; border-radius: 4px; background: var(--row-color); justify-self: center; }
.action-row[data-tone='bad'] { --row-color: var(--danger); }
.action-row[data-tone='warn'] { --row-color: var(--make); }
.action-row[data-tone='info'] { --row-color: var(--ship); }
.action-row[data-tone='good'] { --row-color: var(--success); }
.action-kicker { color: var(--muted); font-size: 11px; }
.action-title { margin-top: 2px; color: var(--ink); font-weight: 620; }
.action-detail { color: var(--ink-soft); }
.action-when { margin-top: 3px; color: var(--muted); font: 500 11px/1.2 var(--font-mono); }
.row-action { justify-self: end; }

.table-shell {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.table-tools {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-quiet);
}
.search-field {
  min-width: 180px;
  flex: 1;
  height: 33px;
  padding: 0 10px 0 31px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371766e' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.6-3.6'/%3E%3C/svg%3E") no-repeat 9px 50%;
  color: var(--ink);
  outline: none;
}
.search-field:focus { border-color: var(--solar); box-shadow: 0 0 0 3px rgba(238,79,43,.13); }
.table-scroll { max-width: 100%; overflow-x: auto; }
.work-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.work-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-quiet);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .075em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.work-table td { height: 53px; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); vertical-align: middle; }
.work-table tbody tr:last-child td { border-bottom: 0; }
.work-table tbody tr { cursor: pointer; transition: background var(--ease); }
.work-table tbody tr:hover, .work-table tbody tr.selected { background: #fff; }
.work-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--room-color, var(--solar)); }
.work-table .primary-cell { color: var(--ink); font-weight: 610; }
.work-table .id-cell { color: var(--muted); font: 500 12px/1 var(--font-mono); }
.work-table .amount-cell { color: var(--ink); font: 500 12px/1 var(--font-mono); text-align: right; white-space: nowrap; }
.work-table .action-cell { text-align: right; }
.compact .work-table td { height: 42px; padding-top: 5px; padding-bottom: 5px; }
.compact .action-row { min-height: 58px; }

.rail-card {
  border-top: 2px solid var(--ink);
  padding: 14px 2px 18px;
}
.rail-card + .rail-card { border-top: 1px solid var(--line-strong); }
.rail-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rail-title h3 { margin: 0; font-size: 13px; font-weight: 650; }
.rail-list { display: grid; gap: 8px; }
.thread-mini {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 7px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
}
.thread-mini:hover, .thread-mini.active { background: var(--surface); }
.thread-mini-copy { min-width: 0; }
.thread-mini-title { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 610; white-space: nowrap; }
.thread-mini-meta { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11px; white-space: nowrap; }
.thread-mini-arrow { color: var(--faint); }
.rail-note { padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-quiet); color: var(--ink-soft); font-size: 12px; }
.rail-note strong { color: var(--ink); }

.thread-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 26px;
  align-items: start;
  margin-bottom: 20px;
}
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--ink); }
.thread-identity { display: flex; align-items: center; gap: 12px; }
.thread-kind-large { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper-deep); color: var(--muted); font: 600 11px/1 var(--font-mono); }
.thread-title h1 { margin: 0; font-stretch: 108%; font-size: 30px; line-height: 1.08; letter-spacing: -.035em; }
.thread-title p { margin: 5px 0 0; color: var(--muted); }
.thread-actions { display: flex; gap: 8px; align-items: center; }

.thread-line {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 0;
  margin: 0 0 25px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow-x: auto;
}
.thread-stage {
  --stage-color: var(--muted);
  position: relative;
  min-height: 98px;
  padding: 15px 15px 13px 18px;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.thread-stage:last-child { border-right: 0; }
.thread-stage:hover { background: #fff; }
.thread-stage[data-room='sell'] { --stage-color: var(--sell); }
.thread-stage[data-room='make'] { --stage-color: var(--make); }
.thread-stage[data-room='ship'] { --stage-color: var(--ship); }
.thread-stage[data-room='money'] { --stage-color: var(--money); }
.thread-stage::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.thread-stage.current::before, .thread-stage.blocked::before { background: var(--stage-color); }
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--stage-color); }
.stage-state { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stage-glyph { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 9px; }
.thread-stage.done .stage-glyph { background: var(--stage-color); color: white; }
.thread-stage.future { opacity: .58; }
.thread-stage.restricted { opacity: .36; cursor: not-allowed; }
.thread-stage.restricted:hover { background: transparent; }
.stage-entity { margin-top: 10px; color: var(--ink); font: 600 12px/1.2 var(--font-mono); }
.stage-fact { margin-top: 4px; color: var(--muted); font-size: 11px; }

.thread-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: clamp(24px, 3vw, 44px);
  align-items: start;
}
.thread-summary {
  border-top: 2px solid var(--ink);
}
.next-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-strong);
}
.next-label { color: var(--muted); }
.next-title { margin-top: 3px; color: var(--ink); font-size: 18px; font-weight: 630; letter-spacing: -.02em; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fact-row { min-height: 64px; padding: 12px 12px 11px 0; border-bottom: 1px solid var(--line); }
.fact-row:nth-child(odd) { border-right: 1px solid var(--line); }
.fact-row:nth-child(even) { padding-left: 16px; }
.fact-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.fact-value { margin-top: 4px; color: var(--ink); font-weight: 560; }
.timeline { border-top: 2px solid var(--ink); }
.timeline-row { display: grid; grid-template-columns: 64px 54px minmax(0, 1fr); gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.timeline-time { color: var(--muted); font: 500 10px/1.45 var(--font-mono); }
.timeline-room { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.timeline-copy { color: var(--ink-soft); font-size: 12px; }

.inspector {
  margin-top: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.inspector-head { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: var(--surface-quiet); }
.inspector-head h3 { margin: 0; font-size: 13px; }
.inspector-body { padding: 18px; }
.inspector-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 11px; padding: 12px; border: 1px solid #e3aaa2; border-radius: var(--radius-sm); background: var(--danger-soft); }
.inspector-alert strong { color: var(--danger); }
.field-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.field-row label { color: var(--muted); font-size: 12px; }
.field-control { width: 100%; min-height: 37px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); outline: none; }
.field-control:focus { border-color: var(--solar); box-shadow: 0 0 0 3px rgba(238,79,43,.13); }
.inspector-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 15px; }
.evidence-line { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 15px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.evidence-label { color: var(--muted); font-size: 11px; }
.evidence-value { color: var(--ink); font-weight: 550; }

.settings-groups { display: grid; gap: 12px; }
.settings-group { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 18px; min-height: 60px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.settings-owner { color: var(--ship); }
.settings-group.highlight-ship { border-color: #b9d0da; background: #f4f9fa; }
.settings-path { color: var(--ink); font-weight: 600; }
.settings-desc { color: var(--muted); font-size: 12px; }

.empty-state { padding: 56px 28px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: rgba(255,255,255,.3); text-align: center; }
.empty-mark { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 12px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { max-width: 420px; margin: 6px auto 0; color: var(--muted); }

.palette-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: 11vh 20px 30px;
  background: rgba(16, 24, 32, .32);
}
.palette {
  width: min(660px, 100%);
  max-height: 70vh;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: 0 24px 70px rgba(16,24,32,.24);
  overflow: hidden;
}
.palette-input-wrap { display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input { min-width: 0; flex: 1; height: 42px; border: 0; background: transparent; color: var(--ink); font-size: 17px; outline: 0; }
.palette-results { max-height: calc(70vh - 58px); padding: 8px; overflow-y: auto; }
.palette-result { width: 100%; min-height: 49px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; text-align: left; }
.palette-result:hover, .palette-result.active { background: var(--surface-quiet); }
.palette-result-main { color: var(--ink); font-weight: 590; }
.palette-result-sub { color: var(--muted); font-size: 11px; }
.palette-shortcut { color: var(--faint); font: 500 10px/1 var(--font-mono); }

.toast {
  position: fixed;
  z-index: 110;
  left: 50%;
  bottom: 25px;
  min-width: 280px;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 12px 11px 15px;
  border: 1px solid #0b1117;
  border-radius: 9px;
  background: #101820;
  color: #ffffff;
  box-shadow: var(--shadow-menu);
  transform: translateX(-50%);
}
.toast button { min-height: 29px; padding: 0 8px; border-radius: 5px; background: rgba(255,255,255,.12); color: white; font-weight: 650; }

.prototype-strip {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 5px 18px;
  border-bottom: 1px solid var(--line);
  background: #101820;
  color: #f4f7f9;
  font-size: 11px;
}
.prototype-strip strong { color: #fff; }
.prototype-strip select {
  height: 26px;
  padding: 0 25px 0 8px;
  border: 1px solid #52616d;
  border-radius: 5px;
  background: #202c36;
  color: white;
  font-size: 11px;
}
.prototype-strip a, .prototype-strip .strip-reset { color: #ff8a6c; font-weight: 600; }
.prototype-strip .strip-reset { padding: 3px 5px; border: 0; background: transparent; font-size: 11px; }
.prototype-strip .strip-reset:hover, .prototype-strip a:hover { color: #fff; }
.prototype-strip .strip-spacer { flex: 1; }

@media (max-width: 1280px) {
  .brand { min-width: auto; padding: 0 14px; }
  .brand-copy { display: none; }
  .room-link { min-width: 62px; padding: 0 9px; }
  .tool-button kbd, .thread-button .thread-label { display: none; }
  .thread-button { width: 42px; padding: 0; justify-content: center; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 280px; }
}

@media (max-width: 1180px) {
  .workspace-grid, .thread-layout { grid-template-columns: 1fr; }
  .workspace-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .workspace-rail .rail-card + .rail-card { border-top: 2px solid var(--ink); }
}

@media (max-width: 1050px) {
  .topbar { grid-template-columns: max-content minmax(0, 1fr) max-content; }
  .solar-mark { width: 26px; height: 26px; }
  .room-link { min-width: 56px; font-size: 10px; letter-spacing: .045em; }
  .room-link::before { display: none; }
  .global-tools { padding: 0 8px; }
  .workspace-grid, .thread-layout { grid-template-columns: 1fr; }
  .workspace-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .workspace-rail .rail-card + .rail-card { border-top: 2px solid var(--ink); }
  .brief-strip { grid-template-columns: repeat(2, 1fr); }
  .brief-cell:nth-child(2) { border-right: 0; }
  .brief-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .thread-line { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
}

@media (max-width: 780px) {
  :root { --bar-h: 56px; }
  .prototype-strip { justify-content: flex-start; overflow-x: auto; }
  .prototype-strip .strip-note, .prototype-strip .strip-spacer { display: none; }
  .brand { padding: 0 10px; }
  .room-link { min-width: 50px; padding: 0 8px; }
  .global-tools { gap: 1px; padding: 0 5px; }
  .tool-button { width: 36px; padding: 0; justify-content: center; }
  .tool-button .tool-label { display: none; }
  .user-name { display: none; }
  .page-frame { padding: 23px 16px 42px; }
  .room-heading, .thread-header { grid-template-columns: 1fr; align-items: start; gap: 15px; }
  .heading-actions, .thread-actions { justify-content: flex-start; }
  .room-title { font-size: 28px; }
  .workspace-rail { grid-template-columns: 1fr; }
  .action-row { grid-template-columns: 7px minmax(0, 1fr) auto; gap: 10px; }
  .action-detail { grid-column: 2 / -1; padding-bottom: 6px; }
  .row-action { grid-column: 3; grid-row: 1; }
  .brief-strip { grid-template-columns: 1fr 1fr; }
  .fact-grid { grid-template-columns: 1fr; }
  .fact-row:nth-child(odd) { border-right: 0; }
  .fact-row:nth-child(even) { padding-left: 0; }
  .next-action { grid-template-columns: 1fr; }
  .field-row, .settings-group { grid-template-columns: 1fr; gap: 6px; }
  .settings-group { padding: 13px; }
  .thread-menu { right: 8px; width: calc(100vw - 16px); }
}

@media (max-width: 560px) {
  .room-link { min-width: 45px; font-size: 0; }
  .room-link::before { display: block; width: 8px; height: 8px; opacity: .9; }
  .room-link::after { left: 8px; right: 8px; }
  .brand { display: none; }
  .topbar { grid-template-columns: minmax(0, 1fr) max-content; }
  .room-nav { grid-column: 1; }
  .global-tools { grid-column: 2; }
  .global-tools .thread-button { display: none; }
  .brief-strip { grid-template-columns: 1fr; }
  .brief-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .brief-cell:last-child { border-bottom: 0; }
  .brief-cell:nth-child(2) { border-bottom: 1px solid var(--line); }
  .thread-identity { align-items: flex-start; }
  .thread-title h1 { font-size: 25px; }
  .timeline-row { grid-template-columns: 54px minmax(0, 1fr); }
  .timeline-room { grid-column: 2; grid-row: 1; }
  .timeline-copy { grid-column: 2; }
}
