/* ===== 锂电池顶盖安全库存管理平台 - 专业级样式 ===== */
:root {
  --primary: #1a56db;
  --primary-light: #e8f0fe;
  --primary-dark: #1240a8;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --agent-rail-w: 260px;
  --sidebar-w: 240px;
  --agent-action-w: 320px;
  --topbar-h: 56px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--gray-800); background: var(--gray-50); }
[hidden] { display: none !important; }

/* ===== 整体布局 ===== */
.platform-shell { display: flex; height: 100vh; overflow: hidden; }
.resize-handle {
  width: 6px; flex: 0 0 6px; cursor: col-resize;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.16), transparent);
  position: relative; z-index: 150;
}
.resize-handle::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 2px; height: 42px; border-radius: 999px;
  background: rgba(99,102,241,0.28);
  transform: translate(-50%, -50%); opacity: 0;
  transition: opacity 0.15s;
}
.resize-handle:hover,
.resize-handle.dragging { background: rgba(99,102,241,0.14); }
.resize-handle:hover::after,
.resize-handle.dragging::after { opacity: 1; }
body.resizing-panels { cursor: col-resize; user-select: none; }

/* ===== 智能体演示列（最左侧） ===== */
.agent-rail {
  width: var(--agent-rail-w); background: #1e1b4b; color: #e0e7ff;
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 110; position: relative;
}
.agent-rail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 12px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.agent-avatar { flex-shrink: 0; }
.agent-rail-title { font-size: 14px; font-weight: 600; color: #fff; }
.section-toggle {
  margin-left: auto; width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08); color: #c7d2fe;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; transition: all 0.15s;
}
.section-toggle:hover { background: rgba(99,102,241,0.25); color: #fff; }
.agent-rail-desc {
  padding: 10px 14px; font-size: 11px; color: #a5b4fc; line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.agent-demo-buttons {
  flex: 0 0 auto; padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06); overflow-y: auto; max-height: 340px;
}
.agent-demo-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
  background: rgba(255,255,255,0.04); color: #c7d2fe; font-size: 12px;
  cursor: pointer; transition: all 0.15s; text-align: left; width: 100%;
}
.agent-demo-btn:hover { background: rgba(99,102,241,0.25); border-color: #6366f1; color: #fff; }
.agent-demo-btn.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.agent-demo-btn.full-demo { margin-top: 4px; border-color: #6366f1; color: #a5b4fc; font-weight: 600; }
.agent-demo-btn.full-demo:hover { background: #6366f1; color: #fff; }
.adb-icon { font-size: 12px; width: 16px; text-align: center; opacity: 0.8; }
.adb-text { flex: 1; }

.agent-rail-chat {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}
.agent-chat-log {
  flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
  font-size: 12px; line-height: 1.5;
}
.agent-log-msg {
  padding: 8px 10px; background: rgba(255,255,255,0.06); border-radius: 8px;
  color: #e0e7ff; animation: fadeIn 0.3s ease;
}
.agent-log-time {
  display: block; margin-bottom: 3px; color: #a5b4fc;
  font-family: 'SF Mono', Consolas, monospace; font-size: 10px; opacity: 0.86;
}
.agent-log-msg.step {
  border-left: 3px solid #6366f1; background: rgba(99,102,241,0.12);
}
.agent-log-msg.done {
  border-left: 3px solid #34d399; background: rgba(52,211,153,0.1); color: #a7f3d0;
}
.agent-log-msg.highlight {
  border-left: 3px solid #fbbf24; background: rgba(251,191,36,0.1); color: #fde68a;
}
.agent-input-row {
  display: flex; gap: 4px; padding: 8px 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.agent-input-row input {
  flex: 1; padding: 7px 10px; border: 1px solid rgba(255,255,255,0.15); border-radius: 4px;
  background: rgba(255,255,255,0.06); color: #e0e7ff; font-size: 12px; outline: none;
}
.agent-input-row input::placeholder { color: #6b7280; }
.agent-input-row input:focus { border-color: #6366f1; }
.agent-send {
  padding: 6px 10px; border: none; border-radius: 4px;
  background: #6366f1; color: #fff; cursor: pointer; font-size: 14px;
}
.agent-send:hover { background: #4f46e5; }

.agent-rail-footer {
  padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.08);
}
.agent-external-link {
  display: block; text-align: center; padding: 8px; border-radius: 6px;
  background: rgba(255,255,255,0.06); color: #a5b4fc; font-size: 12px;
  text-decoration: none; transition: all 0.15s;
}
.agent-external-link:hover { background: rgba(99,102,241,0.2); color: #fff; }

.agent-rail.collapsed { width: 58px; }
.agent-rail.collapsed .agent-rail-header { padding: 14px 10px; justify-content: center; }
.agent-rail.collapsed .agent-rail-title,
.agent-rail.collapsed .agent-rail-desc,
.agent-rail.collapsed .agent-demo-buttons,
.agent-rail.collapsed .agent-rail-chat,
.agent-rail.collapsed .agent-rail-footer { display: none; }
.agent-rail.collapsed .section-toggle {
  position: absolute; top: 56px; left: 14px; margin: 0;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w); background: var(--gray-900); color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 100; position: relative;
}
.sidebar-header { padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 8px; }
.logo-area { display: flex; align-items: center; gap: 10px; }
.logo-icon { flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 14px; font-weight: 600; color: #fff; }
.logo-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.sidebar-toggle-btn { color: #cbd5e1; }

.nav-section { padding: 12px 0; }
.nav-label { padding: 4px 16px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); }
.nav-list { list-style: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; cursor: pointer; transition: all 0.15s;
  color: var(--gray-300); font-size: 13px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; border-radius: 0; }
.nav-icon { font-size: 14px; width: 18px; text-align: center; opacity: 0.8; }

.sidebar-footer { margin-top: auto; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.system-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-400); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 4px var(--success); }
.last-sync { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

.sidebar.collapsed { width: 66px; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding-left: 10px; padding-right: 10px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-footer { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-icon { width: auto; }
.sidebar.collapsed .section-toggle {
  position: absolute; left: 18px; top: 58px; margin: 0;
}

/* ===== 主内容区 ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== 顶部栏 ===== */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-600); }
.page-title { font-size: 18px; font-weight: 600; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.sync-indicator { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--success); }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.alert-badge { position: relative; display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--danger-light); border-radius: 12px; cursor: pointer; font-size: 12px; color: var(--danger); }
.alert-count { font-weight: 600; }
.user-info { font-size: 12px; color: var(--gray-600); padding: 4px 10px; background: var(--gray-100); border-radius: 4px; }

/* ===== 内容区域 ===== */
.content-area { flex: 1; overflow-y: auto; padding: 24px; }
.page-panel { display: none; }
.page-panel.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== KPI 卡片 ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm);
}
.kpi-card.warning { border-color: var(--warning); background: var(--warning-light); }
.kpi-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kpi-label { font-size: 13px; color: var(--gray-500); }
.kpi-trend { font-size: 12px; font-weight: 500; padding: 2px 6px; border-radius: 4px; }
.kpi-trend.up { color: var(--success); background: var(--success-light); }
.kpi-trend.down { color: var(--danger); background: var(--danger-light); }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--gray-900); font-family: var(--mono); }
.kpi-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ===== 图表卡片 ===== */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; }
.chart-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.chart-actions { display: flex; gap: 8px; }
.chart-body { padding: 0 20px 20px; height: 240px; position: relative; }
.chart-body canvas { width: 100% !important; height: 100% !important; }

/* ===== 工具栏 ===== */
.panel-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding: 12px 16px; background: #fff;
  border-radius: var(--radius); border: 1px solid var(--gray-200);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-select, .toolbar-input {
  padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: 4px;
  font-size: 13px; color: var(--gray-700); background: #fff;
}
.toolbar-select:focus, .toolbar-input:focus { outline: none; border-color: var(--primary); }
.toolbar-sep { color: var(--gray-400); font-size: 12px; }
.toolbar-label { font-size: 13px; color: var(--gray-600); font-weight: 500; }
.mini-select { padding: 4px 8px; font-size: 12px; border: 1px solid var(--gray-300); border-radius: 4px; }

/* ===== 按钮 ===== */
.action-btn {
  padding: 7px 14px; border: 1px solid var(--gray-300); border-radius: 4px;
  font-size: 13px; cursor: pointer; background: #fff; color: var(--gray-700);
  transition: all 0.15s; font-weight: 500;
}
.action-btn:hover { background: var(--gray-50); border-color: var(--gray-400); }
.action-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn.primary:hover { background: var(--primary-dark); }
.action-btn.secondary { color: var(--gray-500); }
.text-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; }
.text-btn:hover { text-decoration: underline; }

/* ===== 数据卡片行 ===== */
.data-cards-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.data-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.dc-label { font-size: 12px; color: var(--gray-500); }
.dc-value { font-size: 22px; font-weight: 700; color: var(--gray-900); font-family: var(--mono); }
.dc-value.status-ok { color: var(--success); }
.dc-sub { font-size: 11px; color: var(--gray-400); }

/* ===== 表格 ===== */
.table-container { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: auto; margin-bottom: 20px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--gray-50); padding: 10px 12px; text-align: left;
  font-weight: 600; color: var(--gray-600); border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.data-table tr:hover td { background: var(--gray-50); }
.data-table .status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500;
}
.status-badge.ok { background: var(--success-light); color: var(--success); }
.status-badge.warning { background: var(--warning-light); color: var(--warning); }
.status-badge.danger { background: var(--danger-light); color: var(--danger); }
.status-badge.locked { background: var(--primary-light); color: var(--primary); }
.status-badge.pending { background: var(--gray-100); color: var(--gray-600); }

/* ===== 同步配置面板 ===== */
.sync-config-panel, .lock-notification-config, .forecast-version-panel, .permission-panel, .replenish-panel {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; margin-top: 16px;
}
.sync-config-panel h4, .lock-notification-config h4, .forecast-version-panel h4, .permission-panel h4, .replenish-panel h4 {
  font-size: 14px; color: var(--gray-700); margin-bottom: 12px;
}
.config-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.config-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--gray-50); border-radius: 6px;
}
.ci-label { font-size: 12px; color: var(--gray-500); min-width: 80px; }
.ci-value { font-size: 13px; color: var(--gray-700); flex: 1; }
.ci-status { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.ci-status.ok { background: var(--success-light); color: var(--success); }

/* ===== 订单摘要条 ===== */
.order-summary-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
.os-item { background: #fff; border: 1px solid var(--gray-200); border-radius: 6px; padding: 12px 16px; text-align: center; }
.os-label { display: block; font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.os-value { font-size: 20px; font-weight: 700; font-family: var(--mono); color: var(--gray-900); }
.os-value.locked { color: var(--primary); }
.os-value.pending { color: var(--warning); }
.os-value.exception { color: var(--danger); }

/* ===== 通知配置 ===== */
.notif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.notif-item { display: flex; align-items: center; gap: 8px; padding: 10px; background: var(--gray-50); border-radius: 6px; }
.ni-icon { font-size: 18px; }
.ni-label { font-size: 13px; color: var(--gray-700); flex: 1; }
.ni-status { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.ni-status.active { background: var(--success-light); color: var(--success); }

/* ===== 产能信息条 ===== */
.capacity-info-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
.ci-item { background: #fff; border: 1px solid var(--gray-200); border-radius: 6px; padding: 12px 16px; }
.ci-item .ci-label { display: block; font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.ci-item .ci-val { font-size: 18px; font-weight: 700; color: var(--gray-900); font-family: var(--mono); }

.agent-main-placeholder {
  min-height: calc(100vh - var(--topbar-h) - 48px);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--gray-500); text-align: left;
}
.amp-mark {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
  font-weight: 800; letter-spacing: 0.5px;
}
.agent-main-placeholder h3 {
  margin: 0 0 6px; font-size: 16px; color: var(--gray-700);
}
.agent-main-placeholder p {
  margin: 0; max-width: 420px; font-size: 12px; line-height: 1.6;
}

.production-output {
  display: grid; gap: 16px;
}
.prod-hero {
  background: #0f172a; color: #e5e7eb;
  border-radius: 8px; padding: 18px 20px;
  border: 1px solid #1e293b;
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}
.prod-hero h3 { margin: 0 0 8px; font-size: 18px; color: #fff; }
.prod-hero p { margin: 0; color: #cbd5e1; font-size: 12px; line-height: 1.6; max-width: 620px; }
.prod-risk {
  flex-shrink: 0; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.prod-risk.low { background: #dcfce7; color: #047857; }
.prod-risk.medium { background: #fef3c7; color: #92400e; }
.prod-risk.high { background: #fee2e2; color: #991b1b; }
.prod-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.prod-export-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 7px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.prod-export-btn:hover { background: rgba(255,255,255,0.18); }
.prod-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.prod-metric {
  background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.prod-metric span { display: block; color: var(--gray-500); font-size: 12px; margin-bottom: 6px; }
.prod-metric strong { display: block; color: var(--gray-900); font-family: var(--mono); font-size: 22px; }
.prod-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px;
}
.prod-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.prod-card-head {
  padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-50);
}
.prod-card-head h4 { margin: 0; font-size: 14px; color: var(--gray-700); }
.prod-card-head span { font-size: 11px; color: var(--gray-500); }
.prod-table-wrap { overflow: auto; max-height: calc(100vh - 360px); }
.prod-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.prod-table th {
  position: sticky; top: 0; z-index: 1;
  background: #f8fafc; color: #475569; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.prod-table td {
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9;
  color: #334155; vertical-align: top;
}
.prod-table tr:hover td { background: #f8fafc; }
.prod-line-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 72px; padding: 3px 8px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; font-weight: 700;
}
.prod-status-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 54px; padding: 3px 8px; border-radius: 999px;
  background: #f0fdf4; color: #047857; font-weight: 700; white-space: nowrap;
}
.prod-qty { font-family: var(--mono); font-weight: 700; color: #111827; }
.prod-reason { color: #64748b; line-height: 1.5; min-width: 180px; }
.prod-lines {
  padding: 14px; display: grid; gap: 10px;
}
.prod-line-card {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px;
  background: #f8fafc;
}
.prod-line-title {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; color: #334155; margin-bottom: 8px;
}
.prod-bar {
  height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden;
}
.prod-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
}
.prod-checks { padding: 14px; display: grid; gap: 8px; }
.prod-check {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; line-height: 1.5; color: #475569;
}
.prod-check::before {
  content: "✓"; width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #dcfce7; color: #047857;
  font-size: 11px; font-weight: 800;
}

/* ===== 甘特图 ===== */
.gantt-container { padding: 16px 20px; min-height: 200px; overflow-x: auto; }
.gantt-row { display: flex; align-items: center; margin-bottom: 6px; }
.gantt-label { width: 80px; font-size: 12px; color: var(--gray-600); flex-shrink: 0; }
.gantt-track { flex: 1; height: 28px; background: var(--gray-100); border-radius: 4px; position: relative; display: flex; }
.gantt-bar {
  height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; font-weight: 500; min-width: 20px;
}
.gantt-bar.maintenance { background: var(--gray-400); }

/* ===== 安全库存仪表 ===== */
.safety-gauge-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
.safety-gauge {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; text-align: center;
}
.gauge-title { font-size: 13px; color: var(--gray-600); margin-bottom: 8px; }
.gauge-bar-container { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.gauge-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.gauge-bar.ok { background: var(--success); }
.gauge-bar.warning { background: var(--warning); }
.gauge-bar.danger { background: var(--danger); }
.gauge-value { font-size: 20px; font-weight: 700; font-family: var(--mono); }
.gauge-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ===== 预警面板 ===== */
.alert-panel { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px 20px; }
.alert-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.alert-panel-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.alert-list { max-height: 200px; overflow-y: auto; }
.alert-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--gray-100); font-size: 13px;
}
.alert-item:last-child { border-bottom: none; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-dot.high { background: var(--danger); }
.alert-dot.medium { background: var(--warning); }
.alert-dot.low { background: var(--primary); }
.alert-time { font-size: 11px; color: var(--gray-400); margin-left: auto; white-space: nowrap; }

/* ===== 版本时间线 ===== */
.version-timeline { padding: 8px 0; }
.vt-item { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.vt-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 4px; flex-shrink: 0; }
.vt-content { flex: 1; }
.vt-title { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.vt-desc { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ===== 协同面板 ===== */
.dept-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.dept-tab {
  padding: 8px 16px; border: 1px solid var(--gray-300); border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 13px; color: var(--gray-600);
}
.dept-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.collab-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.collab-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.cc-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.cc-header h4 { font-size: 14px; color: var(--gray-700); }
.cc-badge { font-size: 11px; padding: 2px 6px; background: var(--success-light); color: var(--success); border-radius: 4px; }
.cc-body { padding: 16px; display: grid; gap: 12px; }
.cc-metric { display: flex; justify-content: space-between; align-items: center; }
.cc-metric span { font-size: 13px; color: var(--gray-500); }
.cc-metric strong { font-size: 16px; font-weight: 700; color: var(--gray-900); font-family: var(--mono); }

/* ===== 预测对比 ===== */
.forecast-comparison { margin-bottom: 20px; }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none;
  align-items: center; justify-content: center; z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-dialog {
  background: #fff; border-radius: var(--radius); width: 480px; max-width: 90vw;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: 16px; color: var(--gray-800); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-400); }
.modal-body { padding: 20px; font-size: 14px; color: var(--gray-700); line-height: 1.6; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  padding: 12px 16px; background: var(--gray-800); color: #fff; border-radius: 6px;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-item.success { background: var(--success); }
.toast-item.warning { background: var(--warning); }
.toast-item.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .data-cards-row { grid-template-columns: repeat(2, 1fr); }
  .collab-grid { grid-template-columns: 1fr; }
  .safety-gauge-row { grid-template-columns: repeat(2, 1fr); }
  .agent-action-rail { width: var(--agent-action-w); }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .kpi-grid { grid-template-columns: 1fr; }
  .order-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .capacity-info-strip { grid-template-columns: repeat(2, 1fr); }
  .config-grid { grid-template-columns: 1fr; }
  .notif-grid { grid-template-columns: 1fr; }
}

/* ===== Agent 嵌入式面板 ===== */
.agent-trigger-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff; font-size: 12px; font-weight: 500;
  border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
}
.agent-trigger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.agent-trigger-btn:active { transform: translateY(0); }
.agent-trigger-btn .ai-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center;
  font-size: 9px;
}
.agent-trigger-btn.analyzing {
  opacity: 0.7; pointer-events: none;
  animation: agentPulse 1.5s infinite;
}
@keyframes agentPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.agent-panel {
  display: none; margin-top: 16px; border-radius: var(--radius);
  border: 1px solid #e0e7ff; background: #f5f3ff;
  overflow: hidden; animation: agentSlideDown 0.3s ease;
}
.agent-panel.active { display: block; }
@keyframes agentSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.agent-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  color: #fff;
}
.agent-panel-header .aph-left {
  display: flex; align-items: center; gap: 8px;
}
.agent-panel-header .aph-title { font-size: 13px; font-weight: 600; }
.agent-panel-header .aph-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.2);
}
.agent-panel-header .aph-close {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 18px; cursor: pointer; line-height: 1;
}
.agent-panel-header .aph-close:hover { color: #fff; }

.agent-panel-body {
  padding: 16px; max-height: 400px; overflow-y: auto;
}
.agent-panel-body .apb-thinking {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; font-size: 13px; color: #6366f1;
}
.agent-panel-body .apb-thinking .dots {
  display: inline-flex; gap: 3px;
}
.agent-panel-body .apb-thinking .dots span {
  width: 5px; height: 5px; border-radius: 50%; background: #6366f1;
  animation: dotBounce 1.2s infinite;
}
.agent-panel-body .apb-thinking .dots span:nth-child(2) { animation-delay: 0.2s; }
.agent-panel-body .apb-thinking .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.agent-panel-body .apb-result {
  font-size: 13px; line-height: 1.7; color: var(--gray-700);
  white-space: pre-wrap; font-family: var(--font);
}
.agent-panel-body .apb-result .risk-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600; margin-left: 6px;
}
.agent-panel-body .apb-result .risk-badge.high { background: #fef2f2; color: #dc2626; }
.agent-panel-body .apb-result .risk-badge.medium { background: #fffbeb; color: #d97706; }
.agent-panel-body .apb-result .risk-badge.low { background: #ecfdf5; color: #059669; }

.agent-panel-footer {
  padding: 10px 16px; border-top: 1px solid #e0e7ff;
  display: flex; gap: 8px; align-items: center;
}
.agent-panel-footer .apf-time {
  font-size: 11px; color: var(--gray-400); margin-left: auto;
}
.agent-panel-footer .apf-btn {
  font-size: 11px; padding: 4px 10px; border-radius: 4px;
  border: 1px solid #c7d2fe; background: #fff; color: #6366f1;
  cursor: pointer; transition: all 0.15s;
}
.agent-panel-footer .apf-btn:hover { background: #eef2ff; }

/* ===== 右侧 Agent 操作列 ===== */
.agent-action-rail {
  width: var(--agent-action-w); background: #faf9ff; border-left: 1px solid #e0e7ff;
  display: flex; flex-direction: column; flex-shrink: 0;
  z-index: 100; overflow: hidden; position: relative;
}
.aar-header {
  padding: 16px 16px 12px; background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  color: #fff; flex-shrink: 0;
}
.aar-title-row { display: flex; align-items: center; gap: 8px; }
.aar-icon { color: #a5b4fc; font-size: 10px; }
.aar-title { font-size: 15px; font-weight: 700; }
.aar-icon-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; transition: all 0.15s;
}
.aar-title + .aar-icon-btn { margin-left: auto; }
.aar-icon-btn:hover { background: rgba(255,255,255,0.24); border-color: rgba(255,255,255,0.42); }
.aar-status {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.2); color: #e0e7ff;
}
.aar-status.active { background: rgba(52,211,153,0.3); color: #d1fae5; }
.aar-subtitle { font-size: 11px; color: #c4b5fd; margin-top: 4px; }

.aar-content {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.aar-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: #9ca3af; padding: 40px 20px;
}
.aar-empty-icon { font-size: 32px; color: #c4b5fd; margin-bottom: 12px; }
.aar-empty p { font-size: 12px; line-height: 1.6; margin: 2px 0; }

/* Agent 分析卡片 */
.aar-card {
  background: #fff; border-radius: 8px; border: 1px solid #e5e7eb;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.aar-card-header {
  padding: 10px 14px; background: #f9fafb; border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
}
.aar-card-header .ach-title { font-size: 12px; font-weight: 600; color: #374151; }
.aar-card-header .ach-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 500;
}
.aar-card-header .ach-badge.high { background: #fef2f2; color: #dc2626; }
.aar-card-header .ach-badge.medium { background: #fffbeb; color: #d97706; }
.aar-card-header .ach-badge.low { background: #ecfdf5; color: #059669; }
.aar-card-header .ach-badge.normal { background: #ecfdf5; color: #059669; }

.aar-card-body {
  padding: 12px 14px; font-size: 12px; line-height: 1.7; color: #4b5563;
  max-height: 200px; overflow-y: auto; white-space: pre-wrap;
}
/* 智能分析结果窗口向下扩充 */
.aar-card-analysis { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 340px; }
.aar-card-analysis .aar-card-header { flex-shrink: 0; }
.aar-card-body-expanded {
  max-height: none; flex: 1 1 auto; min-height: 300px;
  overflow-y: auto;
}
/* Agent 执行过程 */
.aar-process {
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.aar-process-step {
  display: grid; grid-template-columns: 24px 1fr; gap: 8px;
  padding: 9px 10px; border: 1px solid #e0e7ff; border-radius: 8px;
  background: #f8f7ff;
}
.aps-dot {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #ede9fe; color: #5b21b6; font-size: 11px; font-weight: 700;
}
.aar-process-step.running .aps-dot {
  background: #6366f1; color: #fff; animation: pulse 1.2s infinite;
}
.aar-process-step.done .aps-dot { background: #d1fae5; color: #047857; }
.aar-process-step.pending .aps-dot { background: #f3f4f6; color: #9ca3af; }
.aps-main { min-width: 0; }
.aps-title { font-size: 12px; font-weight: 700; color: #374151; line-height: 1.4; }
.aps-desc { margin-top: 2px; font-size: 11px; line-height: 1.5; color: #6b7280; }
.aps-result {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed #ddd6fe;
  font-size: 11px; line-height: 1.5; color: #047857;
}
.aar-process-note {
  padding: 8px 10px; border-radius: 8px;
  background: #eff6ff; color: #1d4ed8; font-size: 11px; line-height: 1.5;
}

/* Agent 执行日志 */
.aar-log {
  background: #fff; border-radius: 8px; border: 1px solid #e5e7eb; overflow: hidden;
}
.aar-log-header {
  padding: 8px 14px; background: #f9fafb; border-bottom: 1px solid #f3f4f6;
  font-size: 11px; font-weight: 600; color: #6b7280;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.aar-log-body {
  padding: 10px 14px; max-height: 260px; overflow-y: auto;
}
.aar-log.execution-log .aar-log-body { max-height: none; }
.aar-log-item {
  font-size: 11px; line-height: 1.6; color: #6b7280;
  padding: 3px 0; border-bottom: 1px solid #f9fafb;
}
.aar-log-item .log-time {
  color: #9ca3af; margin-right: 6px; font-family: 'SF Mono', Consolas, monospace;
  font-size: 10px; white-space: nowrap;
}
.aar-log-item .log-action { color: #6366f1; font-weight: 500; }
.aar-log-item .log-result { color: #059669; }
.section-card-toggle {
  width: 22px; height: 22px; border: 1px solid #e5e7eb; border-radius: 5px;
  background: #fff; color: #6b7280; cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.section-card-toggle:hover { color: #4338ca; border-color: #c7d2fe; background: #eef2ff; }
.aar-card.section-collapsed > :not(.aar-card-header),
.aar-log.section-collapsed > :not(.aar-log-header) { display: none !important; }

.aar-toolchain-card { flex: 0 0 auto; }
.aar-toolchain {
  padding: 10px 12px;
  display: grid;
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
}
.toolchain-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 9px;
  border: 1px solid #eef2ff;
  border-radius: 7px;
  background: #fbfdff;
}
.toolchain-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  background: #cbd5e1;
}
.toolchain-item.running {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.toolchain-item.running .toolchain-dot {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  animation: pulse 1.2s infinite;
}
.toolchain-item.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.toolchain-item.done .toolchain-dot { background: #16a34a; }
.toolchain-item.error {
  border-color: #fecaca;
  background: #fef2f2;
}
.toolchain-item.error .toolchain-dot { background: #dc2626; }
.toolchain-main { min-width: 0; }
.toolchain-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}
.toolchain-title code {
  font-size: 10px;
  color: #64748b;
  background: transparent;
  white-space: nowrap;
}
.toolchain-desc {
  margin-top: 3px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.45;
  word-break: break-word;
}

/* 思考动画 */
.aar-thinking {
  display: flex; align-items: center; gap: 10px; padding: 16px;
  background: #fff; border-radius: 8px; border: 1px solid #e0e7ff;
}
.aar-thinking .think-dots { display: flex; gap: 4px; }
.aar-thinking .think-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #6366f1;
  animation: dotBounce 1.2s infinite;
}
.aar-thinking .think-dots span:nth-child(2) { animation-delay: 0.2s; }
.aar-thinking .think-dots span:nth-child(3) { animation-delay: 0.4s; }
.aar-thinking .think-text { font-size: 12px; color: #6366f1; }

.aar-footer {
  padding: 10px 16px; border-top: 1px solid #e0e7ff; background: #fff; flex-shrink: 0;
}
.aar-footer-info { display: flex; justify-content: space-between; font-size: 10px; color: #9ca3af; }

.agent-action-rail.collapsed { width: 58px; }
.agent-action-rail.collapsed .aar-header { height: 100%; padding: 14px 10px; }
.agent-action-rail.collapsed .aar-title-row {
  flex-direction: column; align-items: center; gap: 8px;
}
.agent-action-rail.collapsed .aar-title,
.agent-action-rail.collapsed .aar-subtitle,
.agent-action-rail.collapsed .aar-status,
.agent-action-rail.collapsed .aar-content,
.agent-action-rail.collapsed .aar-footer { display: none; }
.agent-action-rail.collapsed .aar-title + .aar-icon-btn { margin-left: 0; }


/* ===== 模型配置页 ===== */
.settings-wrap { max-width: 880px; margin: 0 auto; padding: 8px 0 32px; }
.settings-header { margin-bottom: 18px; }
.settings-header h2 { font-size: 20px; margin: 0 0 6px; color: #1f2937; }
.settings-sub { font-size: 13px; color: #6b7280; line-height: 1.6; margin: 0; }

.settings-card {
  background: #fff; border: 1px solid #e0e7ff; border-radius: 12px;
  padding: 20px 24px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.settings-title { font-size: 15px; margin: 0 0 14px; color: #4338ca; font-weight: 600; }

.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px;
}
.settings-field { display: flex; flex-direction: column; }
.settings-field-full { grid-column: 1 / -1; }
.settings-field label {
  font-size: 12px; color: #6b7280; margin-bottom: 6px; font-weight: 500;
}
.settings-label-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.settings-label-row label { margin-bottom: 0; }
.mini-action-btn {
  border: 1px solid #c7d2fe; background: #eef2ff; color: #4338ca;
  border-radius: 5px; padding: 3px 8px; font-size: 11px;
  cursor: pointer; font-weight: 600;
}
.mini-action-btn:hover { background: #e0e7ff; border-color: #a5b4fc; }
.mini-action-btn:disabled { opacity: 0.55; cursor: wait; }
.settings-field input,
.settings-field select {
  padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 13px; background: #fff; transition: border-color 0.15s;
}
.settings-textarea {
  width: 100%; margin-top: 12px; padding: 10px 12px;
  border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 12px; line-height: 1.6; color: #374151;
  resize: vertical; min-height: 220px; font-family: var(--font);
}
.settings-field input:focus,
.settings-field select:focus,
.settings-textarea:focus {
  outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.settings-hint { font-size: 11px; color: #6366f1; margin-top: 4px; }

.settings-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 18px;
  padding-top: 16px; border-top: 1px dashed #e0e7ff;
}
.btn-primary {
  background: #6366f1; color: #fff; border: none; padding: 8px 18px;
  border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.btn-primary:hover { background: #4f46e5; }
.btn-ghost {
  background: #fff; color: #4b5563; border: 1px solid #d1d5db;
  padding: 8px 18px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: #f9fafb; }
.btn-ghost.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-ghost.btn-danger:hover { background: #fef2f2; }

.settings-result { font-size: 12px; margin-left: 8px; }
.settings-result.ok { color: #059669; }
.settings-result.err { color: #dc2626; }

.settings-tools { margin: 0; padding-left: 20px; font-size: 13px; color: #4b5563; line-height: 1.9; }
.settings-tools li b { color: #4338ca; font-family: monospace; }
.settings-tool-risk {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  margin: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}
.settings-tool-risk.risk-low { background: #ecfdf5; color: #047857; }
.settings-tool-risk.risk-medium { background: #fffbeb; color: #b45309; }
.settings-tool-risk.risk-high { background: #fef2f2; color: #dc2626; }

.settings-flow {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 12px;
}
.flow-step {
  background: #eef2ff; color: #4338ca; padding: 5px 10px; border-radius: 14px; font-weight: 500;
}
.flow-arrow { color: #9ca3af; font-size: 14px; }

/* ===== Agent 实时推理流（结构化卡片） ===== */
.agent-stream { padding: 4px 0; }
.agent-step {
  border-left: 3px solid #c7d2fe; padding: 8px 12px; margin-bottom: 8px;
  background: #fafbff; border-radius: 0 6px 6px 0; font-size: 12px;
}
.agent-step .step-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px;
  font-weight: 600; color: #4338ca; font-size: 11px;
}
.agent-step .step-title {
  min-width: 0; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.agent-step .step-tag {
  background: #e0e7ff; color: #4338ca; padding: 1px 6px; border-radius: 8px;
  font-size: 10px; letter-spacing: 0.3px;
}
.agent-step .step-time {
  flex: 0 0 auto; color: #9ca3af; font-family: 'SF Mono', Consolas, monospace;
  font-size: 10px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.inline-settings-btn { margin-top: 8px; }
.agent-step .step-body {
  color: #374151; line-height: 1.6; word-break: break-word;
  white-space: pre-wrap;
}
.agent-step.step-thought { border-color: #818cf8; }
.agent-step.step-tool    { border-color: #f59e0b; background: #fffbeb; }
.agent-step.step-tool .step-head { color: #b45309; }
.agent-step.step-obs     { border-color: #10b981; background: #f0fdf4; }
.agent-step.step-obs .step-head { color: #047857; }
.agent-step.step-final   { border-color: #6366f1; background: #eef2ff; }
.agent-step.step-final .step-body { font-weight: 500; }
.agent-step.step-error   { border-color: #ef4444; background: #fef2f2; }
.agent-step.step-error .step-head { color: #b91c1c; }

.agent-step pre {
  background: #1f2937; color: #e5e7eb; padding: 8px 10px; border-radius: 4px;
  margin: 4px 0 0; font-size: 11px; overflow-x: auto; max-height: 180px;
}
.agent-step code { font-family: 'SF Mono', Consolas, monospace; }

.agent-meta {
  font-size: 10px; color: #9ca3af; margin-top: 4px;
}

/* ========== 顶栏齿轮按钮 ========== */
.topbar-icon-btn {
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.15s ease;
  margin-right: 8px;
}
.topbar-icon-btn:hover {
  background: #f3f4f6;
  border-color: #1a56db;
  color: #1a56db;
  transform: rotate(60deg);
}

/* ========== 模型配置弹窗 ========== */
.settings-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 16px;
  overflow-y: auto;
}
.settings-modal-overlay.show {
  display: flex;
}
.settings-modal-dialog {
  background: #ffffff;
  border-radius: 10px;
  width: 100%;
  max-width: 760px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  animation: settingsModalIn 0.18s ease-out;
}
@keyframes settingsModalIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.settings-modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: #111827;
}
.settings-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  padding: 0 4px;
}
.settings-modal-close:hover {
  color: #ef4444;
}
.settings-modal-body {
  padding: 20px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

/* ========== 借鉴朋友插件：elapsed ticker / 风险等级 / 审计回放 ========== */
.rt-elapsed {
  display: inline-block;
  font-size: 11px;
  color: #1a56db;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.risk-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  letter-spacing: 0.5px;
}
.risk-pill.risk-low {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.risk-pill.risk-medium {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.risk-pill.risk-high {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.aar-log-replay {
  float: right;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s;
}
.aar-log-replay:hover {
  border-color: #1a56db;
  color: #1a56db;
  background: #eff6ff;
}

.audit-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
}
.audit-row {
  display: grid;
  grid-template-columns: 50px 1fr 60px 80px;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}
.audit-row:last-child { border-bottom: none; }
.audit-row:hover {
  background: #eff6ff;
}
.audit-row > span:first-child {
  color: #1a56db;
  font-weight: 600;
}
.audit-row > span:last-child {
  text-align: right;
  color: #6b7280;
}
