/* AI-Stack-V3 控制台样式。
   中文维护注释：本文件只负责 P8 Web 展示层，不引入外部 CDN/框架，不表达业务 KPI。 */
:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --sidebar: #ffffff;
  --sidebar-muted: #6b7890;
  --topbar: #ffffff;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #dde6f0;
  --text: #17202a;
  --muted: #5d6a78;
  --blue: #1e63d6;
  --teal: #0f8f86;
  --green: #23845b;
  --yellow: #a16b00;
  --red: #b43a32;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.console-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.console-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: var(--text);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand-mark { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark:hover { text-decoration: none; }
.brand-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #1e63d6;
  color: white;
  font-weight: 800;
}
.brand-mark small { display: block; color: var(--sidebar-muted); margin-top: 2px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a,
.muted-nav {
  color: #334155;
  padding: 10px 12px;
  border-radius: 8px;
  display: block;
}
.side-nav a.active,
.side-nav a:hover { background: #e9f1ff; color: var(--blue); text-decoration: none; }
.muted-nav { color: #718096; border: 1px dashed #c9d5e3; }
.sidebar-boundary {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.console-main { min-width: 0; }
.top-bar {
  min-height: 62px;
  background: var(--topbar);
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.top-bar span,
.top-boundary { color: var(--muted); font-size: 0.95rem; }
.console-content { padding: 24px; }

.command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.kpi-section { margin-bottom: 18px; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin: 0 0 10px; }
.section-heading h2 { margin: 0; font-size: 1.15rem; }
.section-heading p { margin: 0; color: var(--muted); }
.business-kpi-grid,
.status-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}
.status-card-grid { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.status-card,
.card,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.status-card h3,
.card h2,
.card h3 { margin: 0 0 8px; }
.status-count { font-size: 2rem; font-weight: 800; line-height: 1; }
.empty-metric { font-size: 1.6rem; font-weight: 800; color: #718096; }
.status-note,
.muted,
.mock-note { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.tone-action { border-top: 4px solid var(--teal); }
.tone-info { border-top: 4px solid var(--blue); }
.tone-success { border-top: 4px solid var(--green); }
.tone-warning { border-top: 4px solid var(--yellow); }
.tone-neutral { border-top: 4px solid #7b8794; }

.intake-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}
.button-row,
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button,
button {
  border: 1px solid #9db0bf;
  background: #f7fafc;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.button.primary,
button.primary { background: var(--blue); color: white; border-color: var(--blue); }
.button.secondary { background: #fff; }
.button.danger,
button.danger { border-color: var(--red); color: var(--red); background: #fff; }

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.workflow-step {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 92px;
  color: var(--text);
}
.workflow-link { display: block; text-decoration: none; }
.workflow-link:hover { border-color: var(--blue); text-decoration: none; }
.workflow-step.disabled { opacity: 0.62; background: #f8fafc; cursor: not-allowed; }
.workflow-step.active { border-color: var(--teal); box-shadow: inset 0 3px 0 var(--teal); }
.workflow-step strong { display: block; margin-bottom: 6px; }
.step-state { display: inline-flex; margin-top: 8px; color: var(--muted); font-size: 0.82rem; }
.draft-body {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.6;
}

.queue-table { width: 100%; border-collapse: collapse; }
.queue-table th,
.queue-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}
.queue-table th { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.queue-table .ops { min-width: 190px; }
.short-id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.85rem; color: #324252; }
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.8rem;
  background: #e8eef4;
  color: #324252;
  white-space: nowrap;
}
.tag-green { background: #dff4e8; color: #17613f; }
.tag-yellow { background: #fff1cf; color: #785000; }
.tag-red { background: #ffe2df; color: #8d2c26; }
.tag-blue { background: #e0f0fb; color: #175e85; }
.tag-gray { background: #edf0f3; color: #4d5b67; }

.right-rail { display: grid; gap: 14px; }
.rail-list { padding-left: 18px; margin: 8px 0 0; }
.component-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}
.component-card { min-height: 112px; }
.component-card strong { display: block; margin-bottom: 8px; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 700; color: #344352; }
.technical-detail { color: var(--muted); font-size: 0.9rem; }
.legacy-warning { border-left: 4px solid var(--yellow); }

@media (max-width: 1100px) {
  .business-kpi-grid,
  .status-card-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .command-grid { grid-template-columns: 1fr; }
  .workflow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .component-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .console-shell { display: block; }
  .console-sidebar { position: static; height: auto; width: 100%; padding: 12px; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-bar { display: block; padding: 12px; }
  .console-content { padding: 12px; }
  .business-kpi-grid,
  .status-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intake-card { grid-template-columns: 1fr; }
  .queue-table { display: block; overflow-x: auto; }
}

.form-error { color: var(--red); background: #fff1f0; border: 1px solid #ffd4d0; border-radius: 8px; padding: 8px 10px; }

/* G4 业务决策提案 UI。
   中文维护注释：这些样式只服务状态机提案展示，不表达真实业务动作已执行。 */
.proposal-page,
.proposal-detail { display: grid; gap: 16px; }
.proposal-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.proposal-filter label { font-weight: 700; }
.proposal-filter select,
.proposal-action-form textarea {
  border: 1px solid #9db0bf;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: white;
}
.proposal-section h2 { margin-top: 0; }
.proposal-table td:last-child { white-space: nowrap; }
.proposal-module-warning { border-left: 4px solid var(--yellow); }
.proposal-hero h1 { margin: 0 0 8px; }
.proposal-confidence {
  min-width: 180px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
/* 提案置信度进度条 */
.confidence-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.confidence-fill { height: 100%; border-radius: 3px; background: var(--blue); }

/* 推荐选项高亮 */
.option-row.recommended { border-left: 3px solid var(--blue); padding-left: 8px; }

/* 待决策角标 */
.pending-badge {
  background: #ef4444;
  color: white;
  border-radius: 9999px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
}

/* 风险颜色 */
.risk-green { color: #16a34a; }
.risk-yellow { color: #ca8a04; }
.risk-red { color: #dc2626; }

.proposal-actions-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
  gap: 14px;
}
.proposal-action-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.proposal-action-form fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 10px;
}
.radio-row { display: block; margin: 8px 0; line-height: 1.45; }
.proposal-flash { border-left: 4px solid var(--green); }
.proposal-timeline { display: grid; gap: 10px; padding-left: 20px; }
.proposal-timeline li { padding-left: 4px; }
.proposal-timeline span { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

@media (max-width: 900px) {
  .proposal-actions-panel { grid-template-columns: 1fr; }
  .proposal-confidence { min-width: 0; }
}


/* P9-B 对话式入口样式。
   中文维护注释：这些样式只让 fallback 追问看起来像对话，不代表真实 provider 已接入。 */
.conversation-panel { border-left: 4px solid var(--teal); }
.conversation-thread { display: grid; gap: 10px; margin-top: 12px; }
.chat-message {
  max-width: 820px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.55;
}
.chat-message p { margin: 6px 0 0; }
.user-message {
  justify-self: end;
  background: #e9f1ff;
  border-color: #bfd3f6;
}
.assistant-message {
  justify-self: start;
  background: #f5fbf9;
  border-color: #bde0dc;
}
.assistant-question-box {
  margin-top: 16px;
  border: 1px solid #bde0dc;
  border-radius: 8px;
  background: #fbfefd;
  padding: 14px;
}
.assistant-question-box h3 { margin-top: 0; }

.chat-compose { margin-top: 14px; }
.chat-compose textarea,
.assistant-question-box textarea {
  width: 100%;
  border: 1px solid #b9c7d6;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  line-height: 1.6;
  background: #fff;
}
.compact-chat { margin-bottom: 12px; }
