.mimir-chat-runtime{width:min(920px,100%);margin:18px auto 0;display:grid;gap:12px}

.runtime-toolbar{display:grid;grid-template-columns:minmax(220px,1fr) minmax(210px,280px) repeat(4,auto);gap:8px;align-items:center;padding:8px 10px;border:1px solid rgba(148,163,184,.18);background:rgba(255,255,255,.72);border-radius:22px;box-shadow:0 10px 28px rgba(17,24,39,.05)}

.runtime-toolbar span{font-size:.9rem;color:#334155}

.runtime-toolbar span[data-state="ready"] { color: #047857; }
.runtime-toolbar span[data-state="error"] { color: #b91c1c; }
.runtime-toolbar span[data-state="loading"] { color: #1d4ed8; }

.runtime-toolbar label{display:grid;gap:4px;font-size:.76rem;color:#64748b}

.runtime-toolbar select,
.runtime-toolbar button{min-height:36px;border:1px solid rgba(100,116,139,.34);border-radius:999px;background:#fff;color:#0f172a}

.runtime-toolbar button{padding:0 13px;cursor:pointer;white-space:nowrap}

.runtime-toolbar button:hover:not(:disabled){border-color:rgba(15,23,42,.46)}

.runtime-toolbar select:focus-visible,
.runtime-toolbar button:focus-visible,
.runtime-message-actions button:focus-visible,
.runtime-code-header button:focus-visible{outline: 3px solid rgba(16,163,127,.28);outline-offset: 2px;border-color:rgba(16,163,127,.72)}

.runtime-toolbar button:disabled{cursor:not-allowed;opacity:.48}

.runtime-context-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center;color:#64748b;font-size:.8rem}

.runtime-context-controls label{display:inline-flex;gap:5px;align-items:center;font-weight:750}

.runtime-context-controls input:focus-visible{outline:3px solid rgba(16,163,127,.28);outline-offset:2px}

.runtime-answer-context-receipt{margin:6px 0 0;color:#4b5563;font-size:.78rem}

.runtime-answer-context-receipt summary{cursor:pointer}

.runtime-answer-context-receipt dl{display:grid;grid-template-columns:max-content 1fr;gap:2px 8px;margin:5px 0}

.runtime-answer-context-actions{display:flex;flex-wrap:wrap;gap:5px;margin:5px 0}

.runtime-answer-context-actions button{padding:4px 8px;border-radius:999px;font-size:.76rem}

.context-correction-retry-badge{color:#1d4ed8;font-weight:700}

.runtime-live-proof{display:grid;gap:8px;padding:10px 12px;border:1px solid rgba(148,163,184,.24);border-radius:18px;background:rgba(255,255,255,.78)}

.mimir-chat-first:not(.mimir-has-chat) .runtime-toolbar,
.mimir-chat-first:not(.mimir-has-chat) .runtime-live-proof[data-state="idle"],
.mimir-chat-first:not(.mimir-has-chat) .runtime-transcript[data-empty="true"] {
  display: none;
}

.runtime-activation-replay {
  align-items: center;
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.runtime-activation-replay[hidden] {
  display: none;
}

.runtime-activation-replay strong {
  color: #1e3a8a;
}

.runtime-activation-replay p,
.runtime-activation-replay small {
  color: #475569;
  font-size: 0.84rem;
  margin: 2px 0 0;
}

.runtime-activation-replay a {
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 999px;
  color: #1d4ed8 !important;
  font-size: 0.82rem;
  font-weight: 750;
  padding: 7px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.runtime-live-proof strong {
  color: #0f172a;
}

.runtime-live-proof p {
  margin: 2px 0 0;
  color: #475569;
  font-size: 0.86rem;
  line-height: 1.4;
}

.runtime-proof-rail,
.runtime-proof-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.runtime-proof-rail span {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  padding: 0.26rem 0.52rem;
  font-size: 0.76rem;
}

.runtime-proof-rail span[data-state="ready"] {
  border-color: rgba(4, 120, 87, 0.24);
  background: #ecfdf5;
  color: #047857;
}

.runtime-proof-rail span[data-state="loading"] {
  border-color: rgba(29, 78, 216, 0.24);
  background: #eff6ff;
  color: #1d4ed8;
}

.runtime-proof-rail span[data-state="error"],
.runtime-proof-rail span[data-state="blocked"] {
  border-color: rgba(185, 28, 28, 0.22);
  background: #fff1f2;
  color: #991b1b;
}

.runtime-proof-actions button {
  min-height: 32px;
  border: 1px solid rgba(100, 116, 139, 0.34);
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  padding: 0 12px;
}

.runtime-helper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-mode-dock{align-items:center;border-top:1px solid rgba(148,163,184,.18);display:grid;gap:10px;grid-template-areas:"tools live" "feedback feedback";grid-template-columns:minmax(0,1fr) auto;justify-content:space-between;min-width:0;padding:7px 6px 9px}

.composer-action-feedback{color:#64748b;font-size:.78rem;grid-area:feedback;line-height:1.35;min-width:0;padding:0 4px;width:100%}

.composer-action-feedback[data-state="ready"] {
  color: #047857;
}

.composer-action-feedback[data-state="error"] {
  color: #b91c1c;
}

.composer-tool-cluster,.composer-live-cluster{align-items:center;display:flex;flex-wrap:wrap;gap:6px;min-width:0}
.composer-tool-cluster{grid-area:tools;justify-content:flex-start}
.composer-live-cluster{grid-area:live;justify-content:flex-end}
.composer-icon-button,.composer-mode-button,.composer-live-chip{background:rgba(255,255,255,.82);border:1px solid rgba(100,116,139,.24);border-radius:999px;color:#475569;flex:0 0 auto;font-size:.82rem;font-weight:650;line-height:1;min-height:32px;transition:border-color 120ms ease,background 120ms ease,color 120ms ease;white-space:nowrap}

.composer-icon-button,
.composer-mode-button {
  cursor: pointer;
}

.composer-icon-button{align-items:center;display:inline-flex;justify-content:center;min-width:32px;padding:0 10px}
.composer-mode-button{align-items:center;display:inline-flex;justify-content:center;padding:0 10px}
.composer-mode-button[data-chat-mode="private"]{border-color:rgba(37,99,235,.34);color:#1d4ed8}
.composer-mode-button[data-chat-mode="boost"]{background:transparent;border-color:transparent;color:#334155}

.composer-new-chat-button {
  color: #0f172a;
}

.composer-mode-button.is-active {
  border-color: rgba(16, 163, 127, 0.42);
  background: #ecfdf5;
  color: #047857;
}

.composer-mode-button[data-chat-mode="private"].is-active {
  border-color: rgba(37, 99, 235, 0.32);
  background: #eff6ff;
  color: #1d4ed8;
}

.composer-mode-button[data-chat-mode="boost"].is-active {
  border-color: rgba(100, 116, 139, 0.18);
  background: #f8fafc;
  color: #334155;
}

.composer-live-chip{align-items:center;background:rgba(248,250,252,.86);display:inline-flex;justify-content:flex-start;max-width:min(360px,90vw);min-width:0;overflow:hidden;padding:0 11px;text-align:left;text-overflow:ellipsis}

.composer-chip-button{cursor:pointer}

#runtime-model-chip{color:#0f172a;max-width:min(360px,90vw)}
#runtime-resource-chip{justify-content:flex-start;max-width:240px}

#primary-chat-link.btn-primary,
.composer-actions #new-backend {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.55rem;
  line-height: 1;
}

#primary-chat-link.is-stopping {
  background: #991b1b;
  border-color: #991b1b;
  color: #fff;
  font-size: 1.05rem;
}

body.mimir-composer-dock-ready .composer-actions #new-backend {
  display: none;
}

#runtime-clear {
  color: #475569;
}

#runtime-stop:not(:disabled) {
  border-color: rgba(185, 28, 28, 0.36);
  color: #b91c1c;
}

#runtime-delete-model:not(:disabled) {
  border-color: rgba(185, 28, 28, 0.36);
  color: #b91c1c;
}

.runtime-transcript {
  display: grid;
  gap: 10px;
  max-height: 460px;
  overflow: auto;
  padding: 6px;
  scrollbar-gutter: stable;
}

.runtime-transcript[data-empty="true"] {
  min-height: 0;
  padding-block: 0;
}

.mimir-has-chat .runtime-transcript {
  min-height: min(46vh, 420px);
  max-height: min(62vh, 640px);
  padding: 10px 6px 4px;
}

.runtime-scroll-latest {
  justify-self: center;
  margin-top: -2px;
  min-height: 32px;
  border: 1px solid rgba(16, 163, 127, 0.28);
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 0 11px;
}

.runtime-scroll-latest[hidden] {
  display: none;
}

.mimir-has-chat .runtime-live-proof {
  padding: 8px 10px;
}

.mimir-has-chat .runtime-live-proof p {
  font-size: 0.8rem;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] {
  align-items: center;
  border-radius: 999px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 6px 8px 6px 12px;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] > div:first-child {
  min-width: 0;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] strong {
  display: inline;
  font-size: 0.78rem;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] p {
  display: inline;
  margin-left: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] .runtime-proof-rail {
  display: none;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] .runtime-proof-actions {
  flex-wrap: nowrap;
  gap: 4px;
}

.mimir-has-chat .runtime-live-proof[data-state="ready"] .runtime-proof-actions button {
  font-size: 0.74rem;
  min-height: 28px;
  padding: 0 9px;
}

.runtime-message {
  display: grid;
  gap: 6px;
  max-width: min(760px, 92%);
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  overflow-wrap: anywhere;
}

.runtime-message-user {
  justify-self: end;
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.runtime-message-assistant {
  justify-self: start;
  background: #fff;
}

.runtime-message-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.72;
}

.runtime-message-body {
  display: grid;
  gap: 8px;
}

.runtime-message-body p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.runtime-code-block {
  display: grid;
  gap: 0;
  overflow: hidden;
  max-width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #0f172a;
}

.runtime-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.75rem;
}

.runtime-code-header button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(203, 213, 225, 0.3);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.4);
  color: #f8fafc;
  cursor: pointer;
}

.runtime-code-block pre{margin:0;max-width:100%;overflow:auto;padding:10px}

.runtime-code-block code {
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre;
}

.runtime-message small {
  color: inherit;
  opacity: 0.58;
}

.runtime-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.runtime-message-actions button {
  flex: 0 1 auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(100, 116, 139, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
  cursor: pointer;
}

.runtime-message-actions button:hover {
  border-color: rgba(15, 23, 42, 0.42);
}

.runtime-message-actions button[data-message-action="next-step"] {
  border-color: rgba(16, 163, 127, 0.38);
  color: #047857;
}

.runtime-message-action-status {
  color: #475569;
  display: block;
  font-size: 0.76rem;
  line-height: 1.35;
}

.runtime-message-action-status[data-state="ready"] {
  color: #047857;
}

.runtime-message-action-status[data-state="error"] {
  color: #b91c1c;
}

.runtime-message-action-status[data-state="loading"] {
  color: #92400e;
}

@media (max-width:720px){
  .composer-mode-dock{align-items:stretch;gap:6px;grid-template-areas:"tools" "live" "feedback";grid-template-columns:1fr}
  .composer-tool-cluster,.composer-live-cluster{flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;scrollbar-width:none;width:100%}
  .composer-tool-cluster::-webkit-scrollbar,.composer-live-cluster::-webkit-scrollbar{display:none}
  .composer-mode-button,.composer-live-chip{flex:0 0 auto}
  .composer-action-feedback{font-size:.74rem;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .runtime-message-actions button{flex:1 1 92px}
  .composer-live-chip{max-width:100%}
  .mimir-has-chat .runtime-live-proof[data-state="ready"]{border-radius:18px;grid-template-columns:1fr}
  .mimir-has-chat .runtime-live-proof[data-state="ready"] .runtime-proof-actions{overflow-x:auto;scrollbar-width:none}
  .mimir-has-chat .runtime-live-proof[data-state="ready"] .runtime-proof-actions::-webkit-scrollbar{display:none}
  .runtime-activation-replay{align-items:stretch;display:grid}
  .runtime-toolbar{grid-template-columns:1fr}
  .runtime-toolbar button,.runtime-toolbar select{width:100%}
  .runtime-message{max-width:100%}
}

.mimir-public-chat .mimir-chat-runtime{order:3;width:min(820px,100%);margin:.2rem auto 0}
.mimir-public-chat :is(.runtime-toolbar,.runtime-live-proof,.runtime-proof-rail,.runtime-proof-actions,.runtime-message-actions,.runtime-answer-context-receipt,.runtime-message-action-status),.mimir-chat-first :is(#runtime-context-controls,.runtime-model-helper){display:none!important}
.mimir-public-chat:not(.mimir-has-chat) #mmir-quick-suggestions{display:none!important}
.mimir-public-chat .mimir-topbar nav a:not([href="#mimir-prompt"]){display:none!important}
.mimir-public-chat:not(.mimir-local-return) :is(#mimir-instant-start,#local-connector,#node-dashboard,#pwa-install,#platform-status,#backend-settings){display:none!important}
