:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #68746f;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --panel-2: #eef5f1;
  --line: #d9e2dc;
  --accent: #116b5b;
  --accent-2: #b7415b;
  --accent-3: #2f68a2;
  --warn: #b88719;
  --bad: #b43b3b;
  --good: #18724f;
  --shadow: 0 22px 60px rgba(28, 41, 35, 0.12);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.plan-automation-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.plan-settings {
  margin-bottom: 12px;
}

.plan-toggle-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.plan-toggle-card.enabled {
  border-color: rgba(28, 119, 95, 0.42);
  background: rgba(232, 247, 240, 0.88);
}

.plan-toggle-card.risk {
  border-color: rgba(205, 90, 48, 0.45);
  background: rgba(255, 245, 238, 0.9);
}

.plan-toggle-card strong,
.plan-toggle-card span,
.plan-toggle-card small {
  display: block;
}

.plan-toggle-card strong {
  color: var(--ink);
}

.plan-toggle-card span,
.plan-toggle-card small {
  color: var(--muted);
  line-height: 1.55;
}

.plan-toggle-card button {
  min-width: 72px;
}

@media (max-width: 760px) {
  .plan-automation-controls {
    grid-template-columns: 1fr;
  }

  .plan-toggle-card {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(17, 107, 91, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(183, 65, 91, 0.08), transparent 30%),
    var(--paper);
  font-family: var(--sans);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 32px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.14;
}

.muted {
  color: var(--muted);
}

.login-form,
.stack-form {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 700;
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 107, 91, 0.12);
}

textarea {
  resize: vertical;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.text-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}

.primary-btn {
  background: var(--accent);
  color: white;
}

.ghost-btn {
  background: #edf3ef;
  color: var(--ink);
  text-decoration: none;
}

.danger-btn {
  background: var(--bad);
  color: #fff;
}

.text-btn {
  background: transparent;
  color: var(--accent);
  padding: 0 4px;
  min-height: 34px;
}

.icon-btn {
  width: 44px;
  padding: 0;
  background: #edf3ef;
  color: var(--ink);
  font-size: 20px;
}

.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.error-line {
  min-height: 20px;
  color: var(--bad);
  margin: 12px 0 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rail-brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.rail-brand[data-open-view] {
  cursor: pointer;
  border-radius: 8px;
}

.rail-brand[data-open-view]:hover {
  background: #eef5f1;
}

.rail-nav {
  display: grid;
  gap: 8px;
}

.rail-nav button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
  text-align: left;
}

.rail-nav button.active,
.rail-nav button:hover {
  color: var(--ink);
  background: #eef5f1;
  border-color: var(--line);
}

.nav-icon {
  width: 24px;
  text-align: center;
  color: var(--accent);
}

.rail-logout {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 42px) 42px;
}

.topbar,
.section-head,
.panel-head,
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar h1 {
  margin-bottom: 0;
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.agent-status-lights {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.agent-light {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  padding: 4px 8px;
  display: inline-grid;
  grid-template-columns: 9px auto;
  grid-template-rows: auto auto;
  column-gap: 6px;
  align-items: center;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.agent-light span {
  grid-row: 1 / 3;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(24, 114, 79, 0.12);
}

.agent-light strong {
  font-size: 12px;
  line-height: 1;
}

.agent-light em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.1;
}

.agent-light.busy span {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(177, 95, 31, 0.12);
}

.agent-light.error span {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(180, 59, 59, 0.12);
}

.agent-light:hover {
  background: #eef5f1;
}

.repo-switcher {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.repo-switcher span {
  padding-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.repo-switcher select {
  max-width: 260px;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 850;
}

.top-scope-context {
  min-height: 38px;
  max-width: 300px;
  display: grid;
  gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 20px rgba(23, 32, 29, 0.06);
}

.top-scope-context b {
  color: var(--accent);
  font-size: 11px;
}

.top-scope-context span,
.top-scope-context small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-scope-context span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.top-scope-context small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.top-scope-context.repository {
  border-color: rgba(17, 107, 91, 0.28);
  background: rgba(238, 245, 241, 0.92);
}

.scope-banner {
  margin: -8px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  background: rgba(238, 245, 241, 0.76);
}

.scope-banner strong {
  color: var(--accent);
}

.scope-banner span,
.scope-banner em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.scope-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f6f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.scope-badge.repository {
  border-color: rgba(17, 107, 91, 0.36);
  background: #dff0ea;
  color: var(--accent);
}

.scope-badge.memory {
  border-color: rgba(47, 104, 162, 0.28);
  background: #e5eff8;
  color: var(--accent-3);
}

.scope-badge.other {
  border-color: rgba(184, 135, 25, 0.32);
  background: #fbf0d1;
  color: #86610f;
}

.scope-badge.system,
.scope-badge.agent {
  border-color: rgba(104, 116, 111, 0.24);
}

.segmented-control,
.live-filter-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.segmented-control button,
.live-filter-bar button {
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
  cursor: pointer;
}

.segmented-control button.active,
.live-filter-bar button.active {
  color: #fff;
  background: var(--accent);
}

.live-filter-bar {
  margin: 10px 0 0;
}

.live-filter-bar span {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.connection-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(24, 114, 79, 0.25);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--good);
  background: rgba(24, 114, 79, 0.1);
  font-size: 13px;
  font-weight: 800;
}

.connection-pill.offline {
  color: var(--bad);
  border-color: rgba(180, 59, 59, 0.28);
  background: rgba(180, 59, 59, 0.1);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

body:has(#view-plan.active) {
  overflow-x: hidden;
  overflow-y: auto;
}

body:has(#view-plan.active) .workspace {
  min-height: 200vh;
  overflow: visible;
  padding-bottom: 42px;
}

#view-plan.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: max(980px, calc((100vh - 172px) * 2));
  min-height: max(980px, calc((100vh - 172px) * 2));
  overflow: visible;
}

.hero-panel,
.panel,
.health-card,
.agent-card,
.chat-shell {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(32, 45, 39, 0.08);
}

.hero-panel {
  min-height: 240px;
  padding: clamp(20px, 3vw, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 22px;
  align-items: center;
  overflow: hidden;
}

.hero-panel p {
  max-width: 680px;
  color: var(--muted);
}

.relationship-panel {
  margin-bottom: 16px;
}

.relationship-graph {
  display: grid;
  gap: 12px;
}

.relationship-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.relationship-arrow {
  display: none;
}

.relationship-node {
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 248, 244, 0.9));
  display: grid;
  align-content: start;
  gap: 8px;
}

.relationship-node strong {
  color: var(--ink);
  font-size: 15px;
}

.relationship-node span,
.relationship-node small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.relationship-node small {
  font-family: var(--mono);
}

.relationship-node.agent {
  border-color: rgba(47, 104, 162, 0.22);
}

.relationship-node.repository,
.relationship-node.memory {
  border-color: rgba(17, 107, 91, 0.24);
}

.relationship-node.claudeCode {
  border-color: rgba(183, 65, 91, 0.22);
}

.relationship-node.review {
  border-color: rgba(184, 135, 25, 0.24);
}

.relationship-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.relationship-notes span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.scope-note {
  border-color: rgba(17, 107, 91, 0.22);
  background: rgba(238, 245, 241, 0.72);
}

.topology {
  min-height: 210px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  position: relative;
}

.topology::before {
  content: "";
  position: absolute;
  inset: 20% 16%;
  border: 1px dashed rgba(17, 107, 91, 0.35);
  border-radius: 8px;
}

.node {
  position: relative;
  z-index: 1;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 850;
  box-shadow: 0 12px 24px rgba(23, 32, 29, 0.08);
}

.node[data-open-view] {
  cursor: pointer;
}

.node[data-open-view]:hover {
  border-color: rgba(17, 107, 91, 0.38);
  background: #eef5f1;
}

.node span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.node.hermes {
  grid-column: 1 / 3;
  color: var(--accent);
}

.node.claudeCode {
  color: var(--accent-3);
}

.node.codexReview {
  color: var(--accent-2);
}

.card-grid,
.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.health-card,
.agent-card,
.panel {
  padding: 18px;
}

.health-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

button.health-card-link {
  width: 100%;
  font: inherit;
  text-align: left;
}

.health-card-link:hover {
  border-color: rgba(17, 107, 91, 0.35);
  background: #eef5f1;
}

.health-card h3,
.agent-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.health-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.gpt-image-status {
  margin: 18px 0;
}

.agent-child-panel {
  display: grid;
  gap: 14px;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.agent-child-create {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 244, 0.86);
}

.agent-child-create-guide {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(17, 107, 91, 0.1);
  border: 1px solid rgba(17, 107, 91, 0.22);
}

.agent-child-create-guide strong {
  color: var(--ink);
  font-size: 14px;
}

.agent-child-create-guide span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.focus-pulse {
  animation: focusPulse 1.1s ease-in-out 2;
}

@keyframes focusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(17, 107, 91, 0); }
  50% { box-shadow: 0 0 0 5px rgba(17, 107, 91, 0.22); }
}

.agent-child-create label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.agent-child-create select,
.agent-child-create input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.agent-assignment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.agent-assignment-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agent-assignment-card.bound {
  border-color: rgba(17, 107, 91, 0.34);
  background: #eef8f4;
}

.agent-assignment-card.missing {
  border-color: rgba(184, 135, 25, 0.34);
  background: #fff8e6;
}

.agent-assignment-card h3 {
  margin: 0;
  font-size: 15px;
}

.agent-assignment-card p,
.agent-assignment-card small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.agent-profile-summary {
  color: var(--ink) !important;
  word-break: normal !important;
}

.agent-profile-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(17, 107, 91, 0.22);
  border-radius: 8px;
  background: rgba(238, 248, 244, 0.72);
}

.agent-profile-editor.empty {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.agent-profile-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(200px, 0.9fr) minmax(180px, 0.7fr);
  gap: 10px;
  align-items: start;
}

.agent-profile-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.agent-profile-grid label:nth-of-type(n+4) {
  grid-column: span 3;
}

.agent-profile-grid select,
.agent-profile-grid input,
.agent-profile-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.agent-profile-grid textarea {
  resize: vertical;
  min-height: 76px;
}

.agent-profile-toggle {
  min-height: 38px;
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.agent-profile-toggle input {
  width: auto;
}

.agent-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.agent-route-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
}

.agent-route-detail summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--accent);
}

.agent-route-detail pre {
  white-space: pre-wrap;
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 12px;
}

.agent-child-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-child-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.agent-child-table th,
.agent-child-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.agent-child-table th {
  position: sticky;
  top: 0;
  background: #f7f8f4;
  color: var(--muted);
  z-index: 1;
}

.agent-child-table code {
  white-space: normal;
  word-break: break-all;
}

.gpt-image-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(32, 45, 39, 0.08);
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.gpt-image-panel.good {
  border-color: rgba(24, 114, 79, 0.26);
  background: linear-gradient(135deg, rgba(24, 114, 79, 0.08), rgba(255, 255, 255, 0.9) 42%);
}

.gpt-image-panel.bad {
  border-color: rgba(180, 59, 59, 0.24);
  background: linear-gradient(135deg, rgba(180, 59, 59, 0.08), rgba(255, 255, 255, 0.92) 42%);
}

.gpt-image-panel.warn {
  border-color: rgba(184, 135, 25, 0.3);
  background: linear-gradient(135deg, rgba(184, 135, 25, 0.11), rgba(255, 255, 255, 0.92) 42%);
}

.gpt-image-main h2 {
  margin-bottom: 10px;
}

.gpt-image-main p,
.gpt-image-error {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.gpt-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.gpt-image-facts {
  display: grid;
  gap: 12px;
}

.gpt-image-facts dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gpt-image-facts div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(247, 248, 244, 0.72);
}

.gpt-image-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 4px;
}

.gpt-image-facts dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.gpt-image-error {
  border-left: 3px solid rgba(180, 59, 59, 0.42);
  padding-left: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.pill.good {
  color: var(--good);
  background: rgba(24, 114, 79, 0.12);
}

.pill.warn {
  color: var(--warn);
  background: rgba(184, 135, 25, 0.12);
}

.pill.bad {
  color: var(--bad);
  background: rgba(180, 59, 59, 0.12);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.service-list,
.result-list,
.blueprint,
.activity-list,
.process-list {
  display: grid;
  gap: 10px;
}

.service-item,
.result-item,
.file-item,
.activity-item,
.process-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 248, 244, 0.66);
}

.service-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.service-item strong,
.file-item strong {
  display: block;
}

.service-item span,
.file-item span,
.activity-item span,
.process-item span {
  color: var(--muted);
  font-size: 13px;
}

.upgrade-panel {
  margin-top: 16px;
}

.cleanup-panel {
  margin-top: 16px;
}

.cleanup-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.cleanup-stat {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 248, 244, 0.66);
}

.cleanup-stat span,
.cleanup-stat strong,
.cleanup-stat small {
  display: block;
}

.cleanup-stat span,
.cleanup-stat small {
  color: var(--muted);
  font-size: 12px;
}

.cleanup-stat strong {
  margin: 6px 0 4px;
  color: var(--ink);
  font-size: 20px;
}

.upgrade-list {
  display: grid;
  gap: 10px;
}

.upgrade-item {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 248, 244, 0.66);
}

.upgrade-item input {
  width: 18px;
  height: 18px;
}

.upgrade-item-main strong,
.upgrade-item-main small,
.upgrade-version em,
.upgrade-version code {
  display: block;
}

.upgrade-item-main small,
.upgrade-version em {
  color: var(--muted);
  font-size: 12px;
}

.upgrade-version code {
  margin-top: 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.upgrade-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: rgba(247, 248, 244, 0.48);
}

.cleanup-output,
.upgrade-output {
  min-height: 180px;
  max-height: 360px;
  margin: 12px 0 0;
}

.archive-window {
  margin-top: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(238, 245, 241, 0.78), rgba(255, 255, 255, 0.92)),
    var(--panel);
}

.window-titlebar {
  min-height: 64px;
  margin: -18px -18px 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(17, 107, 91, 0.1), transparent 44%),
    linear-gradient(270deg, rgba(47, 104, 162, 0.09), transparent 38%),
    #fbfcf8;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.window-titlebar h2 {
  margin: 0;
}

.activity-board {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  gap: 14px;
}

.activity-board > div {
  min-width: 0;
}

.activity-board h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.activity-item strong,
.process-item strong {
  display: block;
  margin-bottom: 4px;
}

.activity-item code,
.process-item code {
  display: block;
  overflow-wrap: anywhere;
  color: #31443d;
  font-family: var(--mono);
  font-size: 12px;
}

.activity-item.danger {
  border-color: rgba(184, 58, 45, 0.58);
  background: linear-gradient(180deg, rgba(255, 241, 237, 0.96), rgba(255, 248, 245, 0.9));
  box-shadow: inset 4px 0 0 rgba(184, 58, 45, 0.72);
}

.activity-item.danger code {
  color: #872419;
  font-weight: 800;
}

.quick-entry {
  width: 100%;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.quick-entry:hover {
  border-color: rgba(17, 107, 91, 0.35);
  background: #eef5f1;
}

.compact-list {
  max-height: 360px;
  overflow: auto;
}

.process-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fixed-panel-list {
  height: 300px;
  overflow: auto;
  align-content: start;
  padding-right: 2px;
}

.overview-fixed-list {
  height: 260px;
}

.fixed-panel-list .activity-item,
.fixed-panel-list .process-item {
  min-height: 78px;
}

.monitor-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  margin-top: 16px;
}

.monitor-visual,
.monitor-map,
.monitor-ledger,
.task-detail,
.conversation-rail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 36px rgba(32, 45, 39, 0.08);
}

.monitor-visual {
  padding: 14px;
}

.monitor-map {
  min-height: 430px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(217, 226, 220, 0.38) 1px, transparent 1px),
    linear-gradient(180deg, rgba(217, 226, 220, 0.38) 1px, transparent 1px),
    linear-gradient(180deg, rgba(247, 248, 244, 0.96), rgba(238, 245, 241, 0.92));
  background-size: 28px 28px, 28px 28px, auto;
}

.room-grid {
  position: absolute;
  inset: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(86px, 1fr));
  gap: 12px;
}

.state-room {
  min-width: 0;
  border: 1px solid rgba(23, 32, 29, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(23, 32, 29, 0.06);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.state-room strong,
.state-room span {
  display: block;
}

.state-room strong {
  margin-bottom: 6px;
  font-size: 15px;
}

.state-room span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.state-room small {
  display: block;
  margin-top: 10px;
  color: #40534c;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.state-room.active {
  border-color: rgba(17, 107, 91, 0.55);
  background: #eef5f1;
  transform: translateY(-2px);
}

.state-room:focus-visible {
  outline: 3px solid rgba(17, 107, 91, 0.28);
  outline-offset: 2px;
}

.agent-cursor {
  position: absolute;
  z-index: 5;
  left: 11%;
  top: 16%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px;
  border: 1px solid #1b2a25;
  border-radius: 8px;
  background: #fbfcf8;
  box-shadow: 5px 5px 0 rgba(23, 32, 29, 0.13);
  transform: translate(-50%, -50%);
  transition: left 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.agent-cursor b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
}

.agent-cursor em {
  display: none;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.cursor-claudeCode b {
  background: var(--accent-3);
}

.cursor-codexReview b {
  background: var(--accent-2);
}

.state-caption {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.state-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.9);
}

.state-line strong,
.state-line span,
.state-line em,
.state-line code {
  display: block;
}

.state-line span {
  color: var(--accent);
  font-weight: 850;
  font-size: 13px;
}

.state-line em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.state-line code {
  margin-top: 6px;
  color: #31443d;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.phase-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.phase-step {
  position: relative;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 10px 10px 42px;
  background: rgba(255, 255, 255, 0.78);
  color: #4d5e56;
}

.phase-step::after {
  content: "";
  position: absolute;
  top: 22px;
  right: -8px;
  width: 8px;
  height: 2px;
  background: rgba(28, 85, 73, 0.28);
}

.phase-step:last-child::after {
  display: none;
}

.phase-step span {
  position: absolute;
  left: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(28, 85, 73, 0.2);
  background: rgba(236, 242, 239, 0.92);
  font-size: 12px;
  font-weight: 850;
}

.phase-step strong,
.phase-step em,
.phase-step small {
  display: block;
}

.phase-step strong {
  color: var(--ink);
  font-size: 13px;
}

.phase-step em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.phase-step small {
  margin-top: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
}

.phase-step.seen {
  border-color: rgba(17, 107, 91, 0.35);
  background: rgba(235, 248, 243, 0.95);
}

.phase-step.current {
  box-shadow: inset 0 0 0 2px rgba(17, 107, 91, 0.28);
}

.state-trail {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.86);
}

.state-trail > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
}

.state-trail > div {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 2px;
}

.trail-dot {
  position: relative;
  flex: 0 0 auto;
  min-width: 92px;
  padding-top: 18px;
  color: #4d5e56;
}

.trail-dot::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(17, 107, 91, 0.12);
}

.trail-claudeCode::before {
  background: var(--accent-3);
}

.trail-codexReview::before {
  background: var(--accent-2);
}

.trail-dot::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 20px;
  width: calc(100% - 18px);
  height: 2px;
  background: rgba(28, 85, 73, 0.2);
}

.trail-dot:last-child::after {
  display: none;
}

.trail-dot b,
.trail-dot small {
  display: block;
}

.trail-dot b {
  color: var(--ink);
  font-size: 12px;
}

.trail-dot small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.monitor-ledger {
  padding: 18px;
  min-height: 470px;
}

.monitor-ledger h3 {
  margin-top: 0;
}

.plain-note {
  margin: 0 0 12px;
  border-left: 4px solid rgba(17, 107, 91, 0.5);
  border-radius: 6px;
  padding: 9px 10px;
  color: #40534c;
  background: rgba(238, 245, 241, 0.76);
  font-size: 13px;
  line-height: 1.45;
}

.task-note,
.editor-note {
  margin: 12px 18px;
}

.monitor-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.monitor-stats div,
.monitor-agent-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 244, 0.76);
  padding: 10px;
}

.monitor-stats strong,
.monitor-agent-detail strong {
  display: block;
  color: var(--accent);
  font-size: 20px;
}

.monitor-stats span,
.monitor-stats em,
.monitor-agent-detail span,
.monitor-agent-detail em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.monitor-stats em {
  margin-top: 4px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.monitor-stats div.receipt-missing,
.monitor-stats div.receipt-garbled,
.monitor-stats div.receipt-failed {
  grid-column: 1 / -1;
  border-color: rgba(180, 59, 59, 0.42);
  background: rgba(180, 59, 59, 0.1);
}

.monitor-stats div.receipt-missing strong,
.monitor-stats div.receipt-missing em,
.monitor-stats div.receipt-garbled strong,
.monitor-stats div.receipt-garbled em,
.monitor-stats div.receipt-failed strong,
.monitor-stats div.receipt-failed em {
  color: var(--bad);
}

.monitor-stats div.receipt-pending {
  grid-column: 1 / -1;
  border-color: rgba(183, 133, 26, 0.38);
  background: rgba(183, 133, 26, 0.1);
}

.monitor-stats div.receipt-pending strong,
.monitor-stats div.receipt-pending em {
  color: #8a5f0d;
}

.monitor-stats div.receipt-ok {
  border-color: rgba(24, 114, 79, 0.26);
  background: rgba(24, 114, 79, 0.08);
}

.monitor-agent-detail {
  margin-bottom: 12px;
}

.monitor-agent-detail code {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: #31443d;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}

.flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 8px;
}

.flow-head strong,
.flow-head span {
  display: block;
}

.flow-head strong {
  color: var(--ink);
  font-size: 14px;
}

.flow-head span {
  color: var(--muted);
  font-size: 12px;
}

.flow-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.flow-actions select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 8px;
  color: var(--ink);
  background: #fbfcf8;
  font-size: 12px;
  font-weight: 800;
}

.flow-actions .text-btn {
  min-height: 30px;
  padding: 0 8px;
}

.compact-setting {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-setting select {
  min-height: 30px;
}

.flow-replay-status {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.agent-flow-filter {
  margin: 0 0 8px;
  max-width: 100%;
  flex-wrap: wrap;
}

.agent-flow-screen {
  height: 290px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(251, 252, 248, 0.95), rgba(238, 245, 241, 0.88));
}

.agent-flow-section {
  display: grid;
  gap: 6px;
}

.agent-flow-section + .agent-flow-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(23, 32, 29, 0.16);
}

.agent-flow-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.agent-flow-section-title strong {
  color: var(--ink);
  font-size: 13px;
}

.agent-flow-section-title span {
  text-align: right;
  overflow-wrap: anywhere;
}

.agent-flow-item {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(23, 32, 29, 0.12);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.agent-flow-item:hover {
  border-color: rgba(17, 107, 91, 0.35);
  background: #eef5f1;
}

.agent-flow-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.agent-flow-item strong {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.agent-flow-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.agent-flow-item.compact-flow-item {
  min-height: 46px;
}

.agent-flow-item.compact-flow-item .agent-flow-copy {
  gap: 0;
}

.timeline-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(23, 32, 29, 0.12);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.timeline-tag-live {
  border-color: rgba(17, 107, 91, 0.24);
  background: #e8f5ef;
  color: #116b5b;
}

.timeline-tag-history {
  border-color: rgba(72, 79, 75, 0.18);
  background: #f4f5f2;
  color: #5d665f;
}

.timeline-tag-health {
  border-color: rgba(166, 116, 22, 0.24);
  background: #fff6df;
  color: #8c6010;
}

.agent-flow-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.live-feed {
  max-height: 400px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.timeline-feed {
  max-height: none;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 248, 244, 0.72);
}

.monitor-timeline-panel {
  margin-top: 16px;
}

.timeline-track {
  display: grid;
  gap: 10px;
}

.timeline-item,
.diff-row,
.memory-history-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 244, 0.72);
  color: var(--ink);
  text-align: left;
}

.timeline-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 12px;
}

.timeline-dot {
  grid-row: span 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  font-weight: 900;
}

.timeline-claudeCode {
  background: var(--accent-3);
}

.timeline-codexReview {
  background: var(--accent-2);
}

.agent-timeline-item {
  cursor: pointer;
}

.timeline-item strong,
.memory-history-item strong {
  overflow-wrap: anywhere;
}

.timeline-item em,
.timeline-item small,
.memory-history-item span,
.memory-history-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.image-job-audit {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.image-audit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 244, 0.72);
  padding: 10px;
}

.image-audit-item summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
  list-style: none;
}

.image-audit-item summary::-webkit-details-marker {
  display: none;
}

.image-audit-item summary span,
.image-audit-item summary small,
.image-audit-meta {
  color: var(--muted);
  font-size: 12px;
}

.prompt-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.prompt-compare-block {
  display: grid;
  gap: 5px;
  border: 1px dashed rgba(17, 107, 91, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 8px;
}

.prompt-compare-block b {
  font-size: 12px;
  color: var(--ink);
}

.prompt-compare-block code {
  min-height: 52px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #31443d;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
}

.diff-viz {
  display: grid;
  gap: 10px;
  min-height: 260px;
  align-content: start;
}

.diff-refresh-note {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 2px;
}

.diff-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(180px, 1fr) 44px minmax(92px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.diff-row span {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.diff-row strong {
  color: var(--accent);
  text-align: right;
}

.diff-row small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.diff-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce5df;
}

.diff-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2));
}

.task-layout,
.chat-console {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.chat-console {
  height: clamp(640px, calc(100vh - 165px), 1040px);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.worktree-cleanup-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: 0 14px 34px rgba(32, 45, 39, 0.07);
}

.cleanup-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.cleanup-summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(235, 248, 243, 0.72);
  padding: 10px;
  min-height: 66px;
}

.cleanup-summary-grid strong {
  display: block;
  color: var(--accent);
  font-size: 22px;
}

.cleanup-summary-grid span,
.cleanup-explain,
.cleanup-row span,
.cleanup-history-item span {
  color: var(--muted);
  font-size: 13px;
}

.cleanup-explain {
  margin: 10px 2px;
  line-height: 1.6;
}

.cleanup-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 8px;
}

.cleanup-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}

.cleanup-list,
.cleanup-history-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
}

.cleanup-row,
.cleanup-history-item {
  display: grid;
  gap: 5px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
}

.cleanup-history-item {
  cursor: pointer;
}

.cleanup-history-item:hover {
  border-color: var(--accent);
  background: rgba(235, 248, 243, 0.72);
}

.cleanup-report {
  margin-top: 10px;
  max-height: 420px;
  overflow: auto;
}

.task-list,
.conversation-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.conversation-list {
  height: clamp(560px, calc(100vh - 185px), 980px);
  overflow: auto;
  padding-right: 4px;
}

.task-list {
  height: clamp(520px, calc(100vh - 205px), 920px);
  overflow: auto;
  padding-right: 4px;
}

.task-item,
.conversation-item {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 7px solid var(--accent);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  text-align: left;
}

.task-item.active,
.conversation-item.active {
  border-color: var(--accent);
  background: #eef5f1;
}

.task-item strong,
.conversation-item strong {
  display: block;
  margin-bottom: 6px;
}

.task-item span,
.conversation-item span,
.task-meta span {
  color: var(--muted);
  font-size: 13px;
}

.task-meta .context-signature {
  flex-basis: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(17, 107, 91, 0.08);
  color: #116b5b;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.task-item p,
.conversation-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.conversation-item.channel-fixed {
  border-left-color: var(--accent-3);
  background: rgba(232, 240, 248, 0.75);
}

.task-detail {
  overflow: hidden;
}

.schedule-summary,
.skill-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
}

.summary-chip strong {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 24px;
}

.summary-chip span {
  color: var(--muted);
  font-size: 13px;
}

.summary-chip.warn strong {
  color: var(--warn);
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.schedule-editor-panel {
  margin-bottom: 16px;
}

.schedule-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.schedule-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.schedule-form-grid label {
  display: grid;
  gap: 7px;
}

.schedule-form-grid label span {
  font-weight: 800;
}

.schedule-command-field {
  grid-column: 1 / -1;
}

.schedule-enabled-row {
  align-self: end;
}

.schedule-edit-actions {
  margin-top: 12px;
}

.cron-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  background: rgba(238, 245, 241, 0.78);
}

.cron-preview.warn {
  border-color: rgba(177, 95, 31, 0.35);
  background: rgba(255, 247, 232, 0.9);
}

.cron-preview strong,
.cron-preview span {
  display: block;
}

.cron-preview span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.cron-preview ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

.cron-preview li {
  margin: 3px 0;
}

.timer-list,
.cron-list {
  display: grid;
  gap: 12px;
  height: clamp(500px, calc(100vh - 260px), 860px);
  overflow: auto;
  align-content: start;
  padding-right: 4px;
}

.timer-card,
.cron-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.cron-card-managed {
  border-color: rgba(17, 107, 91, 0.28);
  background: rgba(238, 245, 241, 0.82);
}

.timer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.timer-main strong,
.cron-card strong {
  display: block;
  margin-bottom: 5px;
}

.timer-main span,
.cron-card span,
.timer-card p,
.cron-card p {
  color: var(--muted);
  font-size: 13px;
}

.timer-badges,
.timer-times {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timer-times {
  margin: 12px 0;
}

.timer-times span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #f8faf7;
  color: var(--muted);
  font-size: 12px;
}

.cron-card code {
  display: block;
  margin: 10px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.skill-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 0;
}

.skill-filters {
  margin: -4px 0 16px;
}

.skill-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 0.8fr) repeat(6, auto);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.skill-filter-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.skill-filter-panel label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.skill-filter-panel input[type="search"],
.skill-filter-panel select {
  min-width: 0;
  height: 38px;
}

.skill-filter-check {
  grid-auto-flow: column;
  grid-template-columns: auto max-content;
  align-items: center;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  white-space: nowrap;
}

.skill-filter-check input {
  margin: 0;
}

.skill-filter-panel em {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.skill-list {
  display: grid;
  gap: 12px;
  height: clamp(320px, calc(100vh - 360px), 680px);
  overflow: auto;
  align-content: start;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.skill-group {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.skill-group summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.skill-group summary span {
  font-size: 13px;
  font-weight: 900;
}

.skill-group summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.skill-group-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
  max-height: clamp(180px, calc(100vh - 470px), 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
}

.skill-list::-webkit-scrollbar,
.skill-group-body::-webkit-scrollbar {
  width: 10px;
}

.skill-list::-webkit-scrollbar-track,
.skill-group-body::-webkit-scrollbar-track {
  background: rgba(31, 58, 72, 0.06);
  border-radius: 999px;
}

.skill-list::-webkit-scrollbar-thumb,
.skill-group-body::-webkit-scrollbar-thumb {
  background: rgba(33, 117, 95, 0.42);
  border: 2px solid rgba(248, 253, 250, 0.92);
  border-radius: 999px;
}

.skill-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.skill-auto-cell {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid rgba(33, 117, 95, 0.18);
  border-radius: 8px;
  background: rgba(236, 248, 242, 0.72);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.skill-auto-cell b {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.skill-auto-cell span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.skill-call-cell {
  background: rgba(255, 255, 255, 0.72);
}

.skill-detail {
  overflow: hidden;
}

.skill-compare {
  min-height: 560px;
}

.skill-terminal,
.skill-preview {
  height: clamp(460px, calc(100vh - 360px), 680px);
  overflow: auto;
}

.skill-preview {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  color: var(--ink);
}

.task-detail-head {
  min-height: 76px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.task-detail-head h2 {
  margin: 0;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.code-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.code-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  font-weight: 800;
}

.code-tabs button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.governance-panel {
  margin-bottom: 16px;
}

.memory-job-panel {
  margin-bottom: 16px;
}

.memory-job-active,
.memory-job-history {
  display: grid;
  gap: 10px;
}

.memory-job-history {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
  align-content: start;
}

.memory-job-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(238, 245, 241, 0.76);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.5fr) auto;
  align-items: center;
  gap: 12px;
}

.memory-job-card strong {
  display: block;
}

.memory-job-card span,
.memory-job-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce5df;
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

.memory-history-item {
  padding: 12px;
}

.memory-history-item span {
  margin-bottom: 4px;
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(18, 27, 24, 0.42);
}

.modal-panel {
  width: min(1120px, 100%);
  max-height: min(94vh, 1040px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.modal-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0 0 6px;
}

.repository-wizard-modal {
  width: min(1180px, 100%);
}

.repository-wizard-body {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: 16px;
  padding: 16px 18px 18px;
  overflow: auto;
}

.repository-wizard-form {
  display: grid;
  align-content: start;
  gap: 12px;
}

.repository-wizard-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.repository-wizard-form input,
.repository-wizard-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffdf8;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.template-option-list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.template-option {
  display: grid;
  grid-template-columns: 28px 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
  cursor: pointer;
}

.template-option.selected {
  border-color: rgba(17, 107, 91, 0.45);
  background: #e8f4ef;
}

.template-option input {
  margin-top: 5px;
}

.template-rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.template-option strong,
.template-option em,
.template-option small {
  display: block;
}

.template-option em {
  margin: 2px 0 6px;
  color: var(--muted);
  font-style: normal;
}

.template-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.template-raw-output {
  margin-top: 12px;
}

.template-raw-output pre {
  max-height: 180px;
  overflow: auto;
}

.report-terminal {
  min-height: 0;
  height: min(72vh, 720px);
  margin: 0;
  border: 0;
  border-radius: 0;
}

.evidence-modal {
  width: min(980px, 100%);
}

.evidence-list {
  min-height: 0;
  max-height: min(72vh, 720px);
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 10px;
  background: #f7f8f4;
}

.evidence-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.evidence-item > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.evidence-item.active {
  border-color: rgba(17, 107, 91, 0.45);
  background: #eef5f1;
}

.evidence-item.active > span {
  background: var(--accent);
}

.evidence-item strong,
.evidence-item code,
.evidence-empty strong,
.evidence-empty span {
  display: block;
}

.evidence-item code {
  margin-top: 6px;
  color: #24352f;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.repair-warning-card {
  border: 1px solid rgba(180, 47, 57, 0.42);
  border-left: 5px solid #b42f39;
  border-radius: 8px;
  padding: 14px;
  background: #fff3f2;
  color: #3d1f20;
}

.repair-warning-card > strong {
  display: block;
  margin-bottom: 6px;
  color: #8f1f2a;
  font-size: 15px;
}

.repair-warning-card p {
  margin: 0 0 10px;
  line-height: 1.6;
}

.repair-warning-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.repair-warning-card dl > div {
  min-width: 0;
  border: 1px solid rgba(180, 47, 57, 0.2);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.repair-warning-card dt {
  margin-bottom: 4px;
  color: #8f1f2a;
  font-size: 12px;
  font-weight: 900;
}

.repair-warning-card dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #392725;
  line-height: 1.45;
}

.receipt-candidate-list {
  display: grid;
  gap: 8px;
}

.receipt-candidate {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid rgba(180, 47, 57, 0.25);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: #24352f;
  cursor: pointer;
}

.receipt-candidate:hover {
  border-color: rgba(17, 107, 91, 0.55);
  background: #f5fbf8;
}

.receipt-candidate:disabled {
  cursor: progress;
  opacity: 0.64;
}

.receipt-candidate strong,
.receipt-candidate span,
.receipt-candidate small {
  display: block;
  overflow-wrap: anywhere;
}

.receipt-candidate span {
  color: var(--muted);
  font-size: 12px;
}

.receipt-candidate small {
  color: #4d625b;
  font-size: 12px;
  line-height: 1.45;
}

.receipt-candidate.empty {
  cursor: default;
  background: rgba(255, 255, 255, 0.65);
  color: #8f1f2a;
}

.evidence-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

@media (max-width: 760px) {
  .repair-warning-card dl {
    grid-template-columns: 1fr;
  }
}

.governance-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.governance-step {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.governance-step strong {
  display: block;
  margin-bottom: 8px;
}

.governance-step span {
  color: var(--muted);
  font-size: 13px;
}

.governance-step.ok {
  border-color: rgba(24, 114, 79, 0.38);
}

.governance-step.warn {
  border-color: rgba(184, 135, 25, 0.55);
  background: rgba(184, 135, 25, 0.08);
}

.governance-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.chat-console {
  min-height: 0;
  height: clamp(640px, calc(100vh - 165px), 1040px);
}

.conversation-rail {
  padding: 16px;
  align-self: start;
  max-height: calc(100vh - 166px);
  overflow: auto;
}

.terminal {
  width: 100%;
  min-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid #23302c;
  border-radius: 8px;
  padding: 14px;
  color: #dff7ec;
  background: #121b18;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.terminal.tall {
  min-height: 600px;
}

.terminal-console-panel {
  display: grid;
  gap: 14px;
}

.terminal-command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.terminal-command-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.terminal-command-form span {
  font-weight: 800;
}

.terminal-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.terminal-preset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-align: left;
}

.terminal-preset:hover {
  border-color: rgba(17, 107, 91, 0.36);
  background: #eef5f1;
}

.terminal-preset strong,
.terminal-preset span,
.terminal-preset code {
  display: block;
}

.terminal-preset span {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.terminal-preset code {
  overflow-wrap: anywhere;
  color: #31443d;
  font-family: var(--mono);
  font-size: 12px;
}

.terminal-preset.bad {
  color: var(--bad);
  border-color: rgba(180, 59, 59, 0.42);
  background: rgba(180, 59, 59, 0.08);
}

.task-live-stream {
  height: 620px;
  overflow: auto;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(247, 248, 244, 0.92), rgba(238, 245, 241, 0.7)),
    #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.live-message {
  max-width: min(860px, 94%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 32, 29, 0.06);
}

.live-message.status,
.live-message.file,
.live-message.tail {
  align-self: flex-start;
}

.live-message.process,
.live-message.journal {
  align-self: flex-end;
  border-color: rgba(47, 104, 162, 0.28);
  background: rgba(47, 104, 162, 0.08);
}

.live-message.system,
.live-message.idle {
  align-self: center;
  background: rgba(238, 245, 241, 0.9);
}

.live-message > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.live-message strong {
  color: var(--accent);
}

.live-message span {
  color: var(--muted);
  font-size: 12px;
}

.live-message pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #24352f;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.score-line {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

.score-value {
  color: var(--accent);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.score-progress {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce5df;
  border: 1px solid var(--line);
}

.score-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 220ms ease, background 220ms ease;
}

.memory-source-panel,
.config-form-panel {
  margin-bottom: 16px;
}

.runtime-settings-config {
  margin: 12px 0;
}

.runtime-settings-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(238, 245, 241, 0.82);
}

.runtime-settings-card h3 {
  margin: 2px 0 6px;
}

.runtime-settings-card span {
  display: block;
  color: var(--muted);
  line-height: 1.5;
}

.runtime-settings-card--wide {
  grid-template-columns: 1fr;
}

.risk-ladder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.risk-ladder-card {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 148px;
  padding: 10px;
  border: 1px solid rgba(17, 111, 91, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.risk-ladder-card strong {
  color: var(--accent);
}

.risk-ladder-card p,
.risk-ladder-card small {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.risk-ladder-card em {
  align-self: end;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.model-routing-table {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.model-routing-table .mini-table-row {
  display: grid;
  grid-template-columns: minmax(80px, 0.65fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(220px, 1.45fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.model-routing-table .model-routing-head {
  background: rgba(17, 111, 91, 0.08);
  color: var(--ink);
}

.model-routing-table .mini-table-row span,
.model-routing-table .mini-table-row small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.model-last-used {
  font-weight: 700;
  color: var(--accent);
}

.runtime-refresh-note {
  margin-top: 8px;
  font-size: 12px;
}

@media (max-width: 980px) {
  .model-routing-table .mini-table-row {
    grid-template-columns: 1fr;
  }
}

.memory-source-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}

.memory-source-list {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.memory-source-editor {
  width: 100%;
  min-height: 260px;
  margin-bottom: 12px;
  font-family: var(--mono);
  resize: vertical;
}

.memory-source-content {
  height: 600px;
  margin: 0;
  overflow: auto;
}

.file-manager-panel {
  display: grid;
  gap: 14px;
}

.file-manager-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(220px, 1fr) minmax(120px, 0.4fr);
  gap: 12px;
  align-items: end;
}

.file-manager-toolbar label {
  display: grid;
  gap: 7px;
}

.file-manager-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-chip.highlight {
  border-color: rgba(17, 107, 91, 0.32);
  background: #e3f3ed;
}

.file-manager-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  min-height: 560px;
}

.file-manager-list {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.file-entry {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 7px solid #b8c5be;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.file-entry > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.file-entry strong {
  overflow-wrap: anywhere;
}

.file-entry span,
.file-entry p {
  color: var(--muted);
  font-size: 13px;
}

.file-entry p {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
}

.file-entry.active {
  border-color: var(--accent);
  background: #eef5f1;
}

.file-entry.scope-repository {
  border-left-color: var(--accent);
}

.file-entry.scope-agent_memory {
  border-left-color: var(--accent-3);
}

.file-entry.scope-other_repository {
  border-left-color: var(--warn);
}

.file-entry.emphasis {
  box-shadow: inset 0 0 0 1px rgba(17, 107, 91, 0.2);
}

.file-manager-viewer {
  min-width: 0;
}

.file-manager-content {
  height: 560px;
  margin: 12px 0 0;
  overflow: auto;
}

.config-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-flow: dense;
  align-items: start;
  gap: 12px;
}

.config-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 248, 244, 0.72);
  min-width: 0;
}

.config-group h3 {
  margin: 0 0 10px;
  line-height: 1.25;
}

.config-group--wide {
  grid-column: span 2;
}

.config-group--compact {
  padding: 10px 12px;
}

.config-group--compact h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.config-group--compact .config-field {
  margin-bottom: 0;
}

.config-group--dense .config-field:last-child {
  margin-bottom: 0;
}

.config-field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  min-width: 0;
}

.config-field span {
  font-weight: 800;
}

.config-field small {
  color: var(--muted);
  line-height: 1.45;
}

.config-field input,
.config-field select,
.config-field textarea {
  width: 100%;
}

@media (min-width: 900px) {
  .config-group--compact .config-field:not(.config-field--long) {
    grid-template-columns: minmax(108px, 0.7fr) minmax(150px, 1.3fr);
    align-items: center;
    column-gap: 12px;
  }

  .config-group--compact .config-field:not(.config-field--long) small {
    grid-column: 1 / -1;
  }
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.task-review-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.task-review-badge.good {
  color: var(--good);
  background: rgba(24, 114, 79, 0.12);
}

.task-review-badge.warn {
  color: var(--warn);
  background: rgba(184, 135, 25, 0.12);
}

.task-review-badge.bad,
.task-item.review-failed {
  color: var(--bad);
  border-color: rgba(180, 59, 59, 0.48);
  background: rgba(180, 59, 59, 0.08);
}

.editor-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}

.file-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.file-item {
  text-align: left;
  cursor: pointer;
}

.file-item.active {
  border-color: var(--accent);
  background: #eef5f1;
}

.editor-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.editor-meta {
  min-height: 54px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-meta span {
  color: var(--muted);
  font-size: 13px;
}

#file-editor {
  min-height: 620px;
  border: 0;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}

.editor-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.editor-source,
.editor-preview {
  min-width: 0;
}

.editor-source {
  border-right: 1px solid var(--line);
}

.compare-head,
.editor-preview > div {
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compare-head span,
.editor-preview span {
  color: var(--muted);
  font-size: 13px;
}

.editor-preview {
  background: rgba(247, 248, 244, 0.74);
}

#file-preview {
  height: 620px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  color: #24352f;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.chat-shell {
  position: relative;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto auto;
  overflow: hidden;
}

.chat-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.chat-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.chat-option-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.chat-option-control select {
  min-width: 102px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.chat-search-toggle input {
  width: auto;
}

.chat-plan-progress {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #eef5f1;
  max-height: min(46vh, 420px);
  overflow: auto;
  align-content: start;
}

.plan-workspace-shell {
  padding: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.plan-workspace {
  max-height: none;
  height: 100%;
  min-height: 0;
  border-bottom: 0;
  padding: 14px 14px clamp(86px, 12vh, 148px);
  background: #f7faf7;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.plan-workspace::-webkit-scrollbar {
  width: 12px;
}

.plan-workspace::-webkit-scrollbar-track {
  background: rgba(31, 58, 72, 0.06);
  border-radius: 999px;
}

.plan-workspace::-webkit-scrollbar-thumb {
  background: rgba(33, 117, 95, 0.48);
  border: 2px solid rgba(247, 250, 247, 0.96);
  border-radius: 999px;
}

.chat-plan-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.chat-plan-progress strong {
  color: var(--ink);
}

.plan-phase-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plan-phase-actions button {
  min-height: 30px;
}

.plan-env-status,
.plan-detail-section {
  border: 1px solid rgba(31, 58, 72, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.plan-env-status {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 4px solid rgba(47, 104, 162, 0.5);
}

.plan-env-status.ready {
  border-left-color: #2f8f6b;
  background: rgba(235, 248, 243, 0.94);
}

.plan-env-status.pass {
  border-left-color: #c58a1b;
  background: rgba(255, 248, 225, 0.92);
}

.plan-env-status.running {
  border-left-color: #2f68a2;
  background: rgba(235, 244, 255, 0.94);
}

.plan-env-status span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-detail-section {
  overflow: hidden;
}

.plan-detail-section[open] {
  overflow: visible;
}

.plan-detail-section > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.plan-detail-section > summary::-webkit-details-marker {
  display: none;
}

.plan-detail-section > summary::after {
  content: "展开";
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.plan-detail-section[open] > summary::after {
  content: "收起";
}

.plan-detail-section > summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-detail-section-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  min-width: 0;
}

.plan-history-archive-detail[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(82vh, 900px);
  overflow: hidden;
}

.plan-history-archive-detail[open] > summary {
  position: sticky;
  top: 0;
  z-index: 6;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(31, 58, 72, 0.1);
}

.plan-history-archive-detail > .plan-detail-section-body {
  padding: 0 12px 12px;
  min-height: 0;
  overflow: hidden;
}

.plan-history-archive {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
}

.plan-history-jump {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(31, 58, 72, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(31, 58, 72, 0.08);
}

.plan-history-jump span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.plan-history-jump select {
  min-width: min(100%, 260px);
  flex: 0 1 340px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 34px 6px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.plan-history-archive-body {
  display: grid;
  gap: 10px;
  height: min(68vh, 740px);
  max-height: min(68vh, 740px);
  min-height: min(360px, 52vh);
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 0 8px 12px 0;
  scrollbar-gutter: stable;
}

.plan-history-archive-body::-webkit-scrollbar {
  width: 10px;
}

.plan-history-archive-body::-webkit-scrollbar-track {
  background: rgba(31, 58, 72, 0.06);
  border-radius: 999px;
}

.plan-history-archive-body::-webkit-scrollbar-thumb {
  background: rgba(33, 117, 95, 0.42);
  border: 2px solid rgba(248, 253, 250, 0.92);
  border-radius: 999px;
}

.plan-history-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  scroll-margin-top: 76px;
}

.plan-history-section[hidden] {
  display: none !important;
}

.plan-history-section-title {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(31, 58, 72, 0.1);
  border-radius: 8px;
  background: rgba(248, 253, 250, 0.9);
}

.plan-history-section-title strong {
  color: var(--ink);
  font-size: 13px;
}

.plan-history-section-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .plan-history-jump {
    align-items: stretch;
    flex-direction: column;
  }

  .plan-history-jump select {
    width: 100%;
    flex: 1 1 auto;
  }

  .plan-history-archive-body {
    height: min(62vh, 640px);
    max-height: min(62vh, 640px);
    min-height: 260px;
  }
}

.plan-flow-order {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(31, 58, 72, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.plan-flow-order article {
  display: grid;
  grid-template-columns: minmax(128px, 0.32fr) 1fr minmax(118px, 0.22fr);
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  border-left: 4px solid rgba(31, 58, 72, 0.16);
  border-radius: 6px;
  background: rgba(247, 250, 247, 0.82);
}

.plan-flow-order article.done {
  border-left-color: #2f8f6b;
  background: rgba(235, 248, 243, 0.9);
}

.plan-flow-order article.current {
  border-left-color: #2f68a2;
  background: rgba(235, 244, 255, 0.94);
}

.plan-flow-order article.locked {
  opacity: 0.78;
}

.plan-flow-order span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-env-process {
  display: grid;
  gap: 8px;
}

.plan-env-process article {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid rgba(31, 58, 72, 0.1);
  border-radius: 8px;
  background: rgba(247, 250, 247, 0.86);
}

.plan-env-process article.done {
  background: rgba(235, 248, 243, 0.9);
}

.plan-env-process b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: #9aa8a3;
  font-size: 12px;
}

.plan-env-process article.done b {
  background: #2f8f6b;
}

.plan-env-process div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.plan-env-process span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.plan-item-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-width: 116px;
}

.plan-item-progress::before {
  content: "";
  display: block;
  grid-column: 1;
  grid-row: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(31, 58, 72, 0.11);
  box-shadow: inset 0 0 0 1px rgba(31, 58, 72, 0.05);
}

.plan-item-progress i {
  display: block;
  grid-column: 1;
  grid-row: 1;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f8f6b, #4c9ec4);
}

.plan-item-progress span {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.plan-implementation-progress {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(47, 104, 162, 0.2);
  border-radius: 8px;
  padding: 12px;
  background: rgba(239, 246, 255, 0.88);
}

.plan-project-dashboard {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(24, 114, 79, 0.2);
  border-radius: 8px;
  padding: 12px;
  background: rgba(236, 248, 242, 0.9);
}

.plan-project-dashboard > div:first-child {
  display: grid;
  gap: 3px;
}

.plan-project-dashboard strong {
  color: var(--ink);
  font-size: 15px;
}

.plan-project-dashboard span,
.plan-project-dashboard em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.plan-project-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.plan-project-kpis span {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px;
  border: 1px solid rgba(24, 114, 79, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.plan-project-kpis b {
  overflow: hidden;
  color: #18724f;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-project-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.plan-smart-next-advanced {
  border: 1px dashed rgba(24, 114, 79, 0.24);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.55);
}

.plan-smart-next-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.plan-smart-next-advanced .plan-phase-actions {
  margin-top: 8px;
}

.plan-slice-outcomes {
  display: grid;
  gap: 10px;
}

.plan-slice-outcome-head {
  display: grid;
  gap: 3px;
}

.plan-slice-outcome-head strong {
  color: var(--ink);
  font-size: 14px;
}

.plan-slice-outcome-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-slice-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.plan-slice-card {
  display: grid;
  gap: 10px;
  min-height: 250px;
  padding: 12px;
  border: 1px solid rgba(47, 104, 162, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.plan-slice-card.done {
  border-color: rgba(24, 114, 79, 0.24);
  background: rgba(248, 253, 250, 0.94);
}

.plan-slice-card.running {
  border-style: dashed;
}

.plan-slice-card.planned {
  border-color: rgba(75, 88, 105, 0.22);
  background: rgba(247, 249, 250, 0.84);
}

.plan-slice-card.worktree_running {
  border-color: rgba(211, 129, 40, 0.42);
  background: rgba(255, 247, 235, 0.86);
}

.plan-slice-card.pending_review {
  border-color: rgba(69, 130, 184, 0.38);
  background: rgba(238, 246, 255, 0.86);
}

.plan-slice-card.pending_merge {
  border-color: rgba(154, 107, 24, 0.48);
  background: rgba(255, 250, 229, 0.9);
}

.plan-slice-card.next_slice {
  border-color: rgba(64, 136, 101, 0.45);
  background: rgba(239, 249, 243, 0.9);
}

.plan-chat-archive-note {
  border: 1px solid rgba(23, 32, 29, 0.12);
  background: rgba(247, 249, 250, 0.92);
}

.plan-chat-archive-note small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.plan-slice-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-slice-card-head strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.plan-slice-card-head b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(24, 114, 79, 0.1);
  color: #18724f;
  font-size: 11px;
}

.plan-slice-card dl {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px 8px;
  margin: 0;
}

.plan-slice-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.plan-slice-card dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.plan-slice-card dd a {
  color: var(--accent);
  font-weight: 800;
}

.plan-slice-card-actions {
  display: flex;
  justify-content: flex-end;
}

.plan-release-pipeline {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(24, 114, 79, 0.16);
  border-radius: 8px;
  background: rgba(248, 253, 250, 0.88);
}

.plan-release-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-release-head div {
  display: grid;
  gap: 3px;
}

.plan-release-head strong {
  color: var(--ink);
  font-size: 14px;
}

.plan-release-head span,
.plan-release-next {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-release-head b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(24, 114, 79, 0.12);
  color: #18724f;
  font-size: 12px;
}

.plan-release-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.plan-release-task {
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 10px;
  border: 1px solid rgba(47, 104, 162, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.plan-release-task.done {
  border-color: rgba(24, 114, 79, 0.28);
  background: rgba(235, 248, 243, 0.9);
}

.plan-release-task.next {
  border-color: rgba(211, 129, 40, 0.38);
  background: rgba(255, 248, 236, 0.9);
}

.plan-release-task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.plan-release-task-head strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.plan-release-task-head b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(24, 114, 79, 0.1);
  color: #18724f;
  font-size: 11px;
}

.plan-release-task p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.plan-release-task dl {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 5px 8px;
  margin: 0;
}

.plan-release-task dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.plan-release-task dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.plan-release-next {
  margin: 0;
}

.plan-release-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding-top: 2px;
}

.plan-release-actions span {
  min-width: min(100%, 280px);
  flex: 1 1 280px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-implementation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-implementation-head div {
  display: grid;
  gap: 3px;
}

.plan-implementation-head strong {
  color: var(--ink);
  font-size: 14px;
}

.plan-implementation-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-implementation-head b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(47, 104, 162, 0.12);
  color: #2f68a2;
  font-size: 12px;
}

.plan-implementation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.plan-implementation-grid article {
  display: grid;
  gap: 6px;
  min-height: 102px;
  padding: 10px;
  border: 1px solid rgba(47, 104, 162, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.plan-implementation-grid article.done {
  border-color: rgba(24, 114, 79, 0.24);
  background: rgba(235, 248, 243, 0.88);
}

.plan-implementation-grid article.running {
  border-color: rgba(47, 104, 162, 0.28);
}

.plan-implementation-grid article strong {
  color: var(--ink);
  font-size: 12px;
}

.plan-implementation-grid article span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.plan-gate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.plan-gate-chip {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 8px;
  border: 1px solid rgba(31, 58, 72, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.plan-gate-chip.done {
  border-color: rgba(24, 114, 79, 0.22);
  background: rgba(235, 248, 243, 0.88);
}

.plan-gate-chip.pending {
  border-color: rgba(184, 135, 25, 0.24);
  background: rgba(255, 247, 221, 0.78);
}

.plan-gate-chip strong {
  color: var(--ink);
  font-size: 12px;
}

.plan-gate-chip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-approval-gate {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(184, 135, 25, 0.28);
  border-radius: 8px;
  background: rgba(255, 247, 221, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.plan-approval-gate.ready {
  border-color: rgba(24, 114, 79, 0.24);
  background: rgba(235, 248, 243, 0.85);
}

.plan-approval-gate.started {
  border-color: rgba(47, 104, 162, 0.28);
  background: rgba(239, 246, 255, 0.9);
}

.plan-approval-gate strong {
  color: var(--ink);
}

.plan-approval-gate span,
.plan-approval-gate li,
.plan-approval-gate em {
  color: var(--muted);
}

.plan-approval-gate ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.plan-approval-gate em {
  font-style: normal;
}

.plan-context-audit {
  border: 1px solid rgba(17, 107, 91, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.plan-context-audit summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.plan-context-audit summary strong {
  color: var(--ink);
}

.plan-context-audit-card {
  display: grid;
  gap: 7px;
  margin: 0 10px 10px;
  padding: 10px;
  border: 1px solid rgba(17, 107, 91, 0.14);
  border-radius: 8px;
  background: #f8fbf7;
}

.plan-context-audit-card.bad {
  border-color: rgba(176, 48, 48, 0.34);
  background: #fff4f2;
}

.plan-context-audit-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-context-audit-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.plan-context-audit-card code {
  white-space: normal;
  overflow-wrap: anywhere;
  color: #116b5b;
  background: rgba(17, 107, 91, 0.08);
}

.plan-context-audit-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-context-audit-card li {
  display: grid;
  grid-template-columns: 44px minmax(80px, 0.4fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 12px;
}

.plan-context-audit-card li span {
  color: #116b5b;
  font-weight: 900;
}

.plan-context-audit-card li.bad span {
  color: #b03030;
}

.plan-context-audit-card li em {
  font-style: normal;
  overflow-wrap: anywhere;
}

.plan-art-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(83, 120, 76, 0.24);
  border-radius: 8px;
  background: rgba(250, 252, 246, 0.92);
  overflow: hidden;
}

.plan-art-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.plan-art-head::-webkit-details-marker {
  display: none;
}

.plan-art-head div {
  display: grid;
  gap: 3px;
}

.plan-art-head span,
.plan-art-head em,
.art-style-tools span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-style: normal;
}

.plan-art-head b {
  color: #116b5b;
  white-space: nowrap;
  font-size: 12px;
}

.art-style-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.art-style-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  padding: 0 10px;
}

.art-style-preset {
  display: grid;
  gap: 7px;
  text-align: left;
  border: 1px solid rgba(23, 32, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 9px;
  cursor: pointer;
}

.art-style-preset:hover,
.art-style-preset.selected {
  border-color: rgba(17, 107, 91, 0.38);
  background: #eef5f1;
}

.art-style-preset span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.art-style-swatches {
  display: flex;
  gap: 4px;
}

.art-style-swatches i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(23, 32, 29, 0.16);
}

.art-preview-memory {
  display: grid;
  gap: 8px;
  padding: 0 10px;
}

.art-preview-memory-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.art-preview-memory-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.art-selected-preview {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 10px;
  border: 1px solid rgba(23, 32, 29, 0.12);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.art-selected-preview.empty {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.art-selected-preview img,
.art-preview-history img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 6px;
  object-fit: cover;
  background: #f2f4ef;
}

.art-selected-preview-image {
  display: block;
  min-width: 0;
}

.art-preview-open {
  justify-self: start;
  margin-top: 2px;
}

.art-selected-preview div {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}

.art-selected-preview span,
.art-selected-preview em,
.art-selected-preview small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.art-preview-history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.art-preview-history a {
  display: grid;
  gap: 4px;
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
}

.art-design-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 0 10px 10px;
}

.art-design-form label {
  display: grid;
  gap: 6px;
}

.art-design-form label.wide {
  grid-column: 1 / -1;
}

.art-design-form label span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.art-design-form textarea {
  min-height: 74px;
  resize: vertical;
}

.plan-choice-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(47, 104, 162, 0.24);
  border-radius: 8px;
  padding: 10px;
  background: rgba(246, 251, 255, 0.88);
}

.plan-choice-panel.waiting {
  border-style: dashed;
  background: rgba(247, 248, 244, 0.9);
}

.plan-choice-panel.waiting.slow {
  border-color: rgba(196, 139, 18, 0.56);
  background: rgba(255, 247, 219, 0.96);
}

.plan-choice-panel.waiting.slow b {
  color: #9a6500;
}

.plan-choice-panel.waiting.blocked {
  border-color: rgba(176, 48, 48, 0.44);
  background: rgba(255, 244, 226, 0.98);
}

.plan-choice-panel.waiting.blocked b {
  color: #b03030;
}

.plan-choice-panel.error {
  border-color: rgba(176, 48, 48, 0.42);
  background: rgba(255, 244, 242, 0.94);
}

.plan-choice-panel.error b {
  color: #b03030;
}

.plan-choice-panel.closed {
  border-color: rgba(24, 114, 79, 0.28);
  background: rgba(235, 248, 243, 0.92);
}

.plan-choice-panel.closed b {
  color: #18724f;
}

.plan-choice-panel > div:first-child,
.plan-choice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-choice-head div,
.plan-choice-panel > div:first-child div {
  display: grid;
  gap: 3px;
}

.plan-choice-panel strong {
  color: var(--ink);
}

.plan-choice-panel span,
.plan-choice-panel small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-choice-panel b {
  white-space: nowrap;
  color: var(--accent);
  font-size: 12px;
}

.plan-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.plan-choice-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.plan-workspace .plan-choice-card {
  min-height: auto;
}

.plan-workspace .plan-choice-grid {
  grid-template-columns: 1fr;
}

.plan-choice-card summary {
  display: grid;
  gap: 6px;
  list-style: none;
  cursor: pointer;
}

.plan-choice-card summary::-webkit-details-marker {
  display: none;
}

.plan-choice-card span {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--accent);
  background: rgba(17, 107, 91, 0.1);
  font-weight: 850;
}

.plan-choice-card strong {
  font-size: 14px;
}

.plan-choice-card small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.plan-art-choice-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 1px solid rgba(23, 32, 29, 0.1);
  border-radius: 7px;
  background: #f6f7f2;
  object-fit: cover;
}

.plan-art-choice-preview.missing {
  display: grid;
  place-items: center;
  padding: 10px;
  color: var(--muted);
  text-align: center;
}

.plan-art-choice-preview.missing strong,
.plan-art-choice-preview.missing span {
  width: auto;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.plan-art-choice-preview.missing strong {
  color: var(--ink);
  font-size: 13px;
}

.plan-choice-card em {
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.plan-choice-full-text {
  max-height: min(56vh, 520px);
  overflow: auto;
  border-top: 1px dashed rgba(17, 107, 91, 0.24);
  padding-top: 9px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.62;
}

.plan-workspace .plan-choice-full-text {
  max-height: min(64vh, 640px);
}

.plan-choice-card.selected {
  border-color: rgba(17, 107, 91, 0.56);
  background: rgba(238, 245, 241, 0.94);
  box-shadow: inset 0 0 0 1px rgba(17, 107, 91, 0.14);
}

.plan-choice-card:hover {
  border-color: rgba(47, 104, 162, 0.45);
}

.plan-choice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.plan-completeness-panel {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(17, 107, 91, 0.22);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.plan-completeness-panel:not([open]) {
  padding: 8px 10px;
}

.plan-completeness-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  list-style: none;
}

.plan-completeness-head::-webkit-details-marker {
  display: none;
}

.plan-completeness-head div {
  display: grid;
  gap: 3px;
}

.plan-completeness-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.plan-completeness-head em {
  color: #8a5a13;
  font-size: 12px;
  line-height: 1.4;
  font-style: normal;
}

.plan-completeness-head b {
  color: #116b5b;
  font-size: 18px;
  white-space: nowrap;
}

.plan-completeness-meter {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(17, 107, 91, 0.12);
}

.plan-completeness-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #116b5b, #d29b2d);
}

.plan-completeness-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 7px;
}

.plan-completeness-item {
  display: grid;
  gap: 3px;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 253, 248, 0.86);
}

.plan-completeness-item summary {
  display: grid;
  gap: 3px;
  cursor: pointer;
  list-style: none;
}

.plan-completeness-item summary::-webkit-details-marker {
  display: none;
}

.plan-completeness-item span {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
}

.plan-completeness-item.done {
  border-color: rgba(17, 107, 91, 0.24);
  background: rgba(238, 245, 241, 0.92);
}

.plan-completeness-item.done span {
  color: #116b5b;
  background: rgba(17, 107, 91, 0.11);
}

.plan-completeness-item.manual-confirmed {
  border-color: rgba(17, 107, 91, 0.42);
  box-shadow: inset 0 0 0 1px rgba(17, 107, 91, 0.12);
}

.plan-completeness-item.manual-unsure {
  border-color: rgba(180, 59, 59, 0.38);
  background: rgba(255, 244, 241, 0.92);
}

.plan-completeness-item.manual-unsure span {
  color: var(--bad);
  background: rgba(180, 59, 59, 0.12);
}

.plan-completeness-item.missing {
  border-color: rgba(177, 95, 31, 0.24);
  background: rgba(255, 247, 232, 0.9);
}

.plan-completeness-item.missing span {
  color: #9b4f12;
  background: rgba(177, 95, 31, 0.12);
}

.plan-completeness-item strong {
  color: var(--ink);
  font-size: 13px;
}

.plan-completeness-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.plan-completeness-detail {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed rgba(17, 107, 91, 0.22);
}

.plan-completeness-detail b {
  color: var(--ink);
  font-size: 11px;
}

.plan-completeness-detail p,
.plan-completeness-detail em {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-style: normal;
}

.plan-completeness-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.plan-completeness-actions .active {
  border-color: rgba(17, 107, 91, 0.38);
  background: rgba(17, 107, 91, 0.1);
  color: var(--accent);
}

.resource-match-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 253, 248, 0.82);
}

.resource-match-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.resource-match-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.resource-match-table-wrap {
  overflow: auto;
}

.resource-match-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.resource-match-table th,
.resource-match-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.resource-match-table th {
  color: var(--muted);
  font-weight: 850;
  background: rgba(238, 245, 241, 0.7);
}

.resource-match-table td {
  color: #2f433b;
}

.plan-env-resource-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(17, 107, 91, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: #f7fbf7;
}

.plan-env-resource-card.warn {
  border-color: rgba(184, 135, 25, 0.32);
  background: #fffaf0;
}

.plan-env-resource-head,
.plan-env-resource-paths {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-env-resource-head div {
  display: grid;
  gap: 3px;
}

.plan-env-resource-head strong {
  color: var(--ink);
  font-size: 14px;
}

.plan-env-resource-head span,
.plan-env-resource-paths span,
.plan-env-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.plan-env-resource-head b {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(17, 107, 91, 0.12);
  color: var(--accent);
  font-size: 12px;
}

.plan-env-resource-paths {
  flex-wrap: wrap;
}

.plan-env-resource-paths span {
  min-width: min(100%, 280px);
  overflow-wrap: anywhere;
}

.plan-env-resource-candidates,
.plan-env-checklist,
.plan-env-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.plan-env-resource-candidates a,
.plan-env-checklist article,
.plan-env-options div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 9px;
  border: 1px solid rgba(17, 107, 91, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  text-decoration: none;
}

.plan-env-resource-candidates a:hover {
  border-color: rgba(17, 107, 91, 0.36);
}

.plan-env-resource-candidates strong,
.plan-env-checklist b,
.plan-env-options b {
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.plan-env-resource-candidates span,
.plan-env-checklist span,
.plan-env-options span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.plan-env-checklist article.warning {
  border-color: rgba(184, 135, 25, 0.28);
}

.plan-env-checklist article.optional {
  opacity: 0.82;
}

.plan-env-options {
  grid-template-columns: 1fr;
}

.plan-env-options > strong {
  color: var(--ink);
  font-size: 13px;
}

.plan-env-options div.selected {
  border-color: rgba(17, 107, 91, 0.46);
  background: rgba(224, 242, 234, 0.86);
}

.chat-messages {
  min-height: 0;
  padding: 10px 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-drop-hint {
  min-height: 28px;
  padding: 6px 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(238, 245, 241, 0.72);
  font-size: 12px;
}

.chat-upload-progress {
  display: grid;
  gap: 6px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.chat-upload-progress span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chat-destination-preview {
  display: grid;
  gap: 4px;
  min-height: 42px;
  padding: 8px 14px;
  border-top: 1px solid rgba(17, 107, 91, 0.12);
  background: rgba(238, 245, 241, 0.86);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chat-destination-preview strong {
  color: var(--accent);
}

.chat-destination-preview b {
  color: var(--ink);
}

.chat-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-preview-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-preview-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.chat-preview-detail span {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(23, 32, 29, 0.08);
}

.chat-preview-detail em {
  font-style: normal;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.chat-destination-preview.warn {
  border-top-color: rgba(184, 135, 25, 0.35);
  background: rgba(255, 247, 219, 0.94);
}

.chat-destination-preview.bad {
  border-top-color: rgba(180, 59, 59, 0.3);
  background: rgba(255, 244, 242, 0.94);
  color: #8c3b31;
}

.chat-shell.drag-over {
  outline: 3px solid rgba(17, 107, 91, 0.22);
  outline-offset: -4px;
}

.chat-shell.drag-over .chat-drop-hint {
  color: var(--accent);
  background: #e3f3ed;
  font-weight: 850;
}

.message {
  max-width: min(760px, 88%);
  border: 0;
  border-radius: 0;
  padding: 4px 2px;
  background: transparent;
  white-space: pre-wrap;
  line-height: 1.42;
  font-size: 14px;
}

.message.imported {
  background: transparent;
}

.message.pending {
  color: var(--muted);
}

.message-time {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.message-link {
  color: var(--accent-3);
  font-weight: 800;
}

.message.user .message-link {
  color: var(--accent-3);
  text-decoration: underline;
}

.message-flag {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(47, 104, 162, 0.12);
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 850;
}

.message-flag-pending {
  background: rgba(183, 133, 26, 0.14);
  color: #8a5f0d;
}

.message-context-signature {
  display: grid;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 5px 8px;
  border: 1px solid rgba(17, 107, 91, 0.18);
  border-radius: 8px;
  background: rgba(238, 245, 241, 0.84);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.message-context-signature strong {
  color: var(--accent);
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-file-wrap {
  display: flex;
  align-items: start;
  gap: 8px;
}

.message-file {
  display: grid;
  gap: 4px;
  max-width: 320px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 244, 0.9);
  color: var(--ink);
  text-decoration: none;
}

.attachment-delete {
  border: 0;
  border-radius: 8px;
  min-height: 30px;
  padding: 0 9px;
  background: rgba(180, 59, 59, 0.1);
  color: var(--bad);
  font-size: 12px;
  font-weight: 850;
}

.message-file span {
  color: var(--muted);
  font-size: 12px;
}

.message-file.image img {
  width: min(280px, 100%);
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.message.user .message-file {
  background: rgba(247, 248, 244, 0.9);
  border-color: var(--line);
  color: var(--ink);
}

.message.user .message-file span {
  color: var(--muted);
}

.message.user {
  align-self: flex-end;
  color: var(--ink);
  text-align: right;
  background: transparent;
  border-color: transparent;
}

.message.assistant {
  align-self: flex-start;
  color: var(--ink);
}

.message-recall {
  display: grid;
  justify-items: end;
  gap: 4px;
  margin-top: 8px;
}

.message-recall small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.chat-form {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(247, 248, 244, 0.86);
}

.chat-form button:disabled,
.chat-form textarea:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.chat-form textarea {
  min-height: 60px;
  max-height: 190px;
}

.mobile-nav {
  display: none;
}

.channel-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.channel-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.channel-summary-grid > div,
.channel-detail-grid section,
.channel-directory-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 14px;
}

.channel-summary-grid strong {
  display: block;
  color: var(--accent);
  font-size: 24px;
  line-height: 1.1;
}

.channel-summary-grid span,
.channel-card span,
.channel-card small,
.channel-config-form small,
.kv-list dt {
  color: var(--muted);
}

.channel-grid {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.channel-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
}

.channel-card.active {
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(13, 103, 82, 0.12);
  background: #f7fbf8;
}

.channel-card strong,
.channel-card span,
.channel-card small {
  display: block;
}

.channel-detail {
  min-height: 520px;
}

.channel-detail-head,
.channel-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.channel-detail-grid {
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1.25fr);
  margin-top: 16px;
}

.kv-list,
.channel-config-form {
  display: grid;
  gap: 10px;
  margin: 0;
}

.kv-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
}

.kv-list dd {
  margin: 0;
  word-break: break-all;
}

.channel-config-form {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.channel-config-form label {
  display: grid;
  gap: 5px;
}

.channel-config-form input {
  min-width: 0;
}

.channel-config-form button {
  align-self: end;
}

.channel-directory-panel {
  margin-top: 16px;
}

.channel-directory-panel pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #0d1b15;
  color: #d9f5e7;
  white-space: pre-wrap;
}

@media (max-width: 1080px) {
  .card-grid,
  .agent-grid,
  .agent-assignment-grid,
  .schedule-summary,
  .skill-summary,
  .file-manager-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-panel,
  .split-grid,
  .agent-child-create,
  .agent-profile-grid,
  .monitor-stage,
  .task-layout,
  .schedule-layout,
  .schedule-form-grid,
  .skill-layout,
  .chat-console,
  .governance-columns,
  .memory-source-layout,
  .file-manager-layout,
  .file-manager-toolbar,
  .channel-workspace,
  .channel-detail-head,
  .channel-detail-grid,
  .config-form-grid {
    grid-template-columns: 1fr;
  }

  .config-group--wide {
    grid-column: auto;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .skill-filter-panel {
    grid-template-columns: 1fr 1fr;
  }

  .cleanup-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-compare {
    grid-template-columns: 1fr;
  }

  .editor-source {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .activity-board,
  .process-list,
  .governance-flow,
  .relationship-rail {
    grid-template-columns: 1fr;
  }

  .memory-job-card,
  .diff-row {
    grid-template-columns: 1fr;
  }

  .plan-completeness-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plan-workspace .plan-choice-grid {
    grid-template-columns: 1fr;
  }

  .room-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(112px, 1fr));
    inset: 14px;
  }

  .monitor-map {
    min-height: 520px;
  }

  .agent-cursor em {
    display: none;
  }

  .state-caption {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .diff-row strong {
    text-align: left;
  }

  .conversation-rail {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .repository-wizard-body {
    grid-template-columns: 1fr;
  }

  body {
    background: var(--paper);
  }

  .app-shell {
    display: block;
    padding-bottom: 76px;
  }

  .side-rail {
    display: none;
  }

  .workspace {
    padding: 100px 14px 30px;
  }

  .topbar,
  .section-head,
  .panel-head,
  .chat-head,
  .window-titlebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .inline-actions,
  .button-row {
    width: 100%;
  }

  .top-actions > *,
  .inline-actions > *,
  .button-row > * {
    flex: 1;
  }

  .cleanup-summary-grid {
    grid-template-columns: 1fr;
  }

  .repo-switcher {
    width: 100%;
  }

  .top-scope-context {
    max-width: none;
    width: 100%;
  }

  .repo-switcher select {
    max-width: none;
    flex: 1;
  }

  .hero-panel {
    min-height: auto;
    padding: 18px;
  }

  .topology {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .node.hermes {
    grid-column: auto;
  }

  .card-grid,
  .agent-grid,
  .agent-assignment-grid,
  .agent-profile-grid,
  .schedule-summary,
  .skill-summary,
  .file-manager-summary {
    grid-template-columns: 1fr;
  }

  .service-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .upgrade-item {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .upgrade-version {
    grid-column: 2;
  }

  .terminal.tall {
    min-height: 460px;
  }

  .task-live-stream {
    height: 500px;
  }

  #file-editor {
    min-height: 480px;
  }

  #file-preview {
    height: 480px;
  }

  .chat-shell {
    height: calc(100vh - 145px);
    min-height: 500px;
  }

  .plan-workspace-shell {
    min-height: 0;
    height: 100%;
  }

  .plan-workspace {
    height: 100%;
  }

  .monitor-map {
    min-height: 620px;
  }

  .task-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-actions,
  .task-actions > * {
    width: 100%;
  }

  .editor-preview > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-tabs {
    padding: 12px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .terminal-command-form {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .chat-plan-progress > div:first-child,
  .resource-match-panel > div:first-child,
  .plan-completeness-head,
  .plan-choice-head,
  .plan-choice-panel > div:first-child {
    flex-direction: column;
  }

  .plan-choice-grid {
    grid-template-columns: 1fr;
  }

  .skill-filter-panel {
    grid-template-columns: 1fr;
  }

  .runtime-settings-card {
    grid-template-columns: 1fr;
  }

  .plan-flow-order article {
    grid-template-columns: 1fr;
  }

  .plan-completeness-grid {
    grid-template-columns: 1fr;
  }

  .channel-summary-grid,
  .channel-config-form,
  .kv-list div {
    grid-template-columns: 1fr;
  }

  .prompt-compare-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 10px;
    bottom: auto;
    z-index: 20;
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    min-width: 70px;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-nav button.active {
    color: var(--accent);
    background: #eef5f1;
  }
}
