:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef3f8;
  --text: #18202a;
  --muted: #647183;
  --line: #dce3eb;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff4f1;
  --warn: #a16207;
  --violet: #6852c8;
  --shadow: 0 16px 36px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
}

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

.brand-title {
  font-size: 16px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.division-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item strong {
  color: inherit;
  font-size: 12px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.workspace {
  min-width: 0;
  padding: 18px 24px 24px;
}

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

.search-wrap {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-wrap svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.search-wrap input {
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.toolbar {
  display: flex;
  gap: 8px;
}

.model-select {
  min-width: 250px;
  max-width: 360px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  border-color: #b9c7d8;
  box-shadow: var(--shadow);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  gap: 8px;
  justify-content: end;
  margin: -4px 0 14px;
}

.auth-panel input {
  min-height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  outline: none;
}

.auth-panel button,
.send-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.auth-panel button:hover,
.send-button:hover {
  background: var(--accent-strong);
}

.send-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.summary-row {
  display: grid;
  grid-template-columns: 150px 150px minmax(190px, 1fr) minmax(180px, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
  line-height: 1;
}

.metric.wide strong {
  font-size: 15px;
  line-height: 1.25;
}

.recommendation-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
}

.recommendation-head,
.recommendation-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.recommendation-head {
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px 16px;
}

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

.recommendation-head strong {
  font-size: 15px;
  line-height: 1.25;
}

.recommendation-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
}

.recommendation-item {
  min-width: 0;
  padding: 11px 12px;
}

.recommendation-item strong {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.automation-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 12px;
  padding: 14px;
}

.automation-grid.live-grid {
  grid-template-columns: 1fr;
}

.automation-output.wide {
  min-width: 0;
}

.live-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  white-space: normal;
}

.live-head strong {
  font-size: 15px;
}

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

.live-dashboard {
  max-height: 620px;
  background: #f8fafc;
}

.live-actions {
  margin-top: 10px;
}

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

.automation-actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.automation-result {
  min-height: 238px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ops-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  white-space: normal;
}

.ops-counter {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.ops-counter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.ops-counter strong {
  font-size: 18px;
}

.ops-counter.warn strong { color: #b45309; }
.ops-counter.danger strong { color: #b91c1c; }
.ops-counter.info strong { color: #0369a1; }
.ops-counter.ok strong { color: #047857; }

.next-actions {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  margin-bottom: 12px;
  white-space: normal;
}

.next-actions ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.stage-rail {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 12px;
}

.stage-rail span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 4px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  overflow-wrap: anywhere;
}

.progress-event-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  margin-bottom: 12px;
}

.progress-event-panel header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.progress-event-panel header span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tool-chips span {
  border: 1px solid #ccfbf1;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 12px;
}

.tool-chips b {
  margin-right: 5px;
}

.progress-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.progress-summary-grid > div {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  min-width: 0;
}

.progress-summary-grid b {
  display: block;
  margin-bottom: 6px;
}

.progress-summary-grid ul {
  margin: 0;
  padding-left: 18px;
}

.progress-summary-grid li,
.progress-summary-grid p {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  overflow-wrap: anywhere;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  white-space: normal;
}

.board-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.board-column header {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  margin-bottom: 8px;
}

.board-card {
  border-left: 4px solid #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px;
  margin-bottom: 8px;
}

.board-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
}

.board-card-head strong {
  min-width: 0;
}

.board-card-head em {
  flex: 0 0 auto;
  max-width: 112px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 7px;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

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

.board-card span,
.board-card small,
.board-empty {
  color: var(--muted);
  font-size: 12px;
}

.board-card small b {
  display: inline-block;
  margin-right: 5px;
  color: #334155;
}

.danger-text {
  color: #b91c1c !important;
}

.capability-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.capability-pills span {
  border: 1px solid #ccfbf1;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
}

.board-card.warn { border-left-color: #f59e0b; }
.board-card.danger { border-left-color: #dc2626; }
.board-card.info { border-left-color: #0284c7; }
.board-card.ok { border-left-color: #059669; }

.integration-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(420px, 1.28fr);
  gap: 12px;
  white-space: normal;
}

.integration-map,
.integration-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.integration-map {
  padding: 12px 14px;
}

.integration-map strong {
  display: block;
  margin-bottom: 8px;
}

.integration-map ol,
.integration-map ul,
.integration-next ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.integration-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.integration-card {
  border-left: 4px solid #94a3b8;
  padding: 12px;
}

.integration-card.ok { border-left-color: #059669; }
.integration-card.warn { border-left-color: #f59e0b; }
.integration-card.danger { border-left-color: #dc2626; }

.integration-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.integration-card header strong,
.integration-card header span {
  display: block;
}

.integration-card header span,
.integration-note,
.integration-missing,
.integration-docs,
.integration-card dd {
  color: var(--muted);
  font-size: 12px;
}

.integration-card em {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f7;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

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

.integration-card dt {
  color: var(--muted);
  font-size: 12px;
}

.integration-card dd {
  margin: 2px 0 0;
}

.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.field-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.field-pill.ok {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.field-pill.missing {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.integration-missing {
  margin-bottom: 8px;
}

.integration-missing.ok {
  color: #047857;
}

.integration-next {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.integration-next strong {
  display: block;
  margin-bottom: 5px;
}

.integration-note {
  margin: 8px 0 0;
}

.integration-docs {
  margin-top: 8px;
}

.integration-docs a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.platform-auth-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.live-head.compact {
  margin-bottom: 0;
}

.platform-auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.platform-auth-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.platform-auth-card header strong,
.platform-auth-card header span {
  display: block;
}

.platform-auth-card header span,
.platform-auth-meta {
  color: var(--muted);
  font-size: 13px;
}

.platform-auth-card header em {
  font-style: normal;
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.platform-auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.platform-auth-card label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.platform-auth-card input,
.platform-auth-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.platform-auth-card textarea {
  min-height: 84px;
  resize: vertical;
}

.platform-auth-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.platform-auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.platform-auth-actions button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.platform-auth-actions button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.wecom-bridge-panel {
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wecom-bridge-panel.warn {
  border-color: rgba(217, 119, 6, 0.35);
  background: #fffbeb;
}

.wecom-bridge-panel.danger {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fff7f7;
}

.wecom-bridge-panel > div,
.wecom-bridge-panel li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.wecom-bridge-panel p,
.wecom-bridge-panel span {
  color: var(--muted);
}

.wecom-bridge-panel ul {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.wecom-bridge-panel li {
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(241, 245, 249, 0.9);
}

.wecom-bridge-panel button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.runtime-policy {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--muted);
  white-space: normal;
}

.runtime-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  white-space: normal;
}

.runtime-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.runtime-card.ok { border-left-color: #059669; }
.runtime-card.info { border-left-color: #0284c7; }
.runtime-card.warn { border-left-color: #f59e0b; }
.runtime-card.danger { border-left-color: #dc2626; }

.runtime-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.runtime-card header strong,
.runtime-card header span {
  display: block;
}

.runtime-card header span,
.runtime-meta {
  color: var(--muted);
  font-size: 12px;
}

.runtime-card em {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f7;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

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

.runtime-grid div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #f8fafc;
}

.runtime-grid span,
.runtime-grid strong {
  display: block;
  min-width: 0;
}

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

.runtime-grid strong {
  margin-top: 3px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.runtime-meta {
  margin: 8px 0;
}

.runtime-card pre {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #111827;
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(380px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.agent-list-panel,
.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.panel-head h1 {
  margin: 0;
  font-size: 18px;
}

.panel-head span {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  max-height: calc(100vh - 206px);
  padding: 12px;
  overflow: auto;
}

.agent-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 9px;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.agent-card:hover,
.agent-card.active {
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.12);
}

.agent-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.division-pill {
  max-width: 150px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-card h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.agent-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.term-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.term {
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-panel {
  position: sticky;
  top: 18px;
  min-height: calc(100vh - 42px);
  overflow: hidden;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: calc(100vh - 44px);
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 42px;
  height: 42px;
  color: var(--accent);
}

.empty-state h2 {
  margin: 14px 0 5px;
  color: var(--text);
  font-size: 20px;
}

.empty-state p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.agent-detail {
  max-height: calc(100vh - 42px);
  overflow: auto;
}

.detail-header {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfb 100%);
}

.detail-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.detail-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.detail-header p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
}

.prompt-box {
  padding: 18px 22px 22px;
}

.prompt-box h3,
.chat-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.prompt-box pre {
  margin: 0;
  max-height: 260px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-box {
  padding: 0 22px 22px;
}

.conversation {
  display: grid;
  gap: 10px;
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.message {
  display: grid;
  gap: 5px;
  max-width: 92%;
}

.message.user {
  justify-self: end;
}

.message.assistant {
  justify-self: start;
}

.message-role {
  color: var(--muted);
  font-size: 11px;
}

.message-body {
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user .message-body {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.message.error .message-body {
  border-color: #fecaca;
  background: #fff1f2;
  color: #9f1239;
}

.message.pending .message-body {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

.message.pending .message-role {
  color: #0369a1;
}

.reasoning {
  padding: 9px 10px;
  border-left: 3px solid #94a3b8;
  background: #eef2f7;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

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

.chat-form textarea {
  min-height: 82px;
  max-height: 180px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  line-height: 1.45;
}

.chat-form textarea:focus,
.auth-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .integration-layout,
  .integration-list,
  .runtime-list {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    min-height: 520px;
  }

  .agent-detail,
  .prompt-box pre {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .division-list {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .toolbar {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .model-select {
    width: 100%;
    max-width: none;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }

  .recommendation-row {
    grid-template-columns: 1fr;
  }

  .recommendation-list {
    grid-template-columns: 1fr;
  }

  .automation-grid {
    grid-template-columns: 1fr;
  }

  .ops-overview,
  .board-grid,
  .progress-summary-grid,
  .stage-rail,
  .integration-layout,
  .integration-list,
  .runtime-list {
    grid-template-columns: 1fr;
  }

  .integration-card dl,
  .runtime-grid,
  .platform-auth-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    grid-template-columns: 1fr;
    max-height: none;
  }
}
