/* ===== 昇腾算子工作平台 - 主题变量 ===== */
:root,
body.theme-dark {
  --surface: 15 23 42;
  --surface-100: 30 41 59;
  --surface-200: 51 65 85;
  --surface-300: 71 85 105;
  --accent: 59 130 246;
  --accent-light: 96 165 250;
  --accent-dark: 37 99 235;
  --gray-200: 226 232 240;
  --gray-300: 203 213 225;
  --gray-400: 148 163 184;
  --gray-500: 100 116 139;
  --gray-600: 71 85 105;
  --gray-700: 51 65 85;
  --blue-300: 147 197 253;
  --blue-400: 96 165 250;
  --blue-500: 59 130 246;
  --blue-800: 30 64 175;
  --blue-900: 30 58 138;
  --yellow-400: 250 204 21;
  --yellow-500: 234 179 8;
  --green-300: 134 239 172;
  --green-400: 74 222 128;
  --green-500: 34 197 94;
  --red-400: 248 113 113;
  --red-500: 239 68 68;
  --white: 255 255 255;
  --shadow-color: 2 6 23;
  --scrollbar-thumb: 71 85 105;
  --scrollbar-track: 30 41 59;
  --chart-grid: 51 65 85;
  --chart-axis: 148 163 184;
  --chart-axis-subtle: 100 116 139;
  --chart-tooltip-bg: 30 41 59;
  --chart-tooltip-border: 51 65 85;
}

body.theme-light {
  --surface: 248 250 252;
  --surface-100: 255 255 255;
  --surface-200: 226 232 240;
  --surface-300: 203 213 225;
  --accent: 37 99 235;
  --accent-light: 29 78 216;
  --accent-dark: 30 64 175;
  --gray-200: 15 23 42;
  --gray-300: 30 41 59;
  --gray-400: 51 65 85;
  --gray-500: 71 85 105;
  --gray-600: 100 116 139;
  --gray-700: 148 163 184;
  --blue-300: 59 130 246;
  --blue-400: 37 99 235;
  --blue-500: 29 78 216;
  --blue-800: 30 64 175;
  --blue-900: 30 58 138;
  --yellow-400: 202 138 4;
  --yellow-500: 161 98 7;
  --green-300: 34 197 94;
  --green-400: 22 163 74;
  --green-500: 21 128 61;
  --red-400: 239 68 68;
  --red-500: 220 38 38;
  --white: 255 255 255;
  --shadow-color: 15 23 42;
  --scrollbar-thumb: 148 163 184;
  --scrollbar-track: 226 232 240;
  --chart-grid: 203 213 225;
  --chart-axis: 71 85 105;
  --chart-axis-subtle: 100 116 139;
  --chart-tooltip-bg: 255 255 255;
  --chart-tooltip-border: 203 213 225;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: rgb(var(--surface));
  color: rgb(var(--gray-200));
  transition: background-color 0.2s ease, color 0.2s ease;
}

button,
select,
input,
textarea {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgb(var(--scrollbar-track)); }
::-webkit-scrollbar-thumb { background: rgb(var(--scrollbar-thumb)); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--gray-500)); }

/* Table */
.op-table { border-collapse: separate; border-spacing: 0; }
.op-table th, .op-table td {
  padding: 6px 10px;
  border: 1px solid rgb(var(--surface-200));
  white-space: nowrap;
  font-size: 13px;
  vertical-align: middle;
}
.op-table th {
  background: rgb(var(--surface-200));
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
}
.op-table tr:hover td { background: rgb(var(--accent) / 0.08); }

/* Util color cells */
.util-green {
  background: rgb(var(--green-500) / 0.12);
  color: rgb(var(--green-400));
  font-weight: 600;
}
.util-yellow {
  background: rgb(var(--yellow-500) / 0.12);
  color: rgb(var(--yellow-400));
  font-weight: 600;
}
.util-red {
  background: rgb(var(--red-500) / 0.12);
  color: rgb(var(--red-400));
  font-weight: 600;
}

/* Category badges */
.cat-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* Sidebar */
.sidebar-item { transition: all 0.15s ease; }
.sidebar-item:hover { background: rgb(var(--accent) / 0.12); }
.sidebar-item.active { background: rgb(var(--accent) / 0.18); border-right: 3px solid rgb(var(--accent)); }

/* Agent panel */
.agent-msg { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.typing-dot { animation: blink 1.4s infinite both; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.2; } 40% { opacity: 1; } }

/* Card hover */
.model-card { transition: transform 0.2s, box-shadow 0.2s; }
.model-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgb(var(--shadow-color) / 0.18);
}

/* Drawer */
.drawer-overlay { animation: fadeIn 0.2s ease; }
.drawer-panel { animation: slideIn 0.25s ease; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Phase toggle */
.phase-btn { transition: all 0.15s; }
.phase-btn.active { background: rgb(var(--accent)); color: rgb(var(--white)); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgb(var(--surface-200));
  border: 1px solid rgb(var(--surface-300));
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: rgb(var(--gray-400));
}

.theme-toggle-btn.active {
  background: rgb(var(--accent));
  color: rgb(var(--white));
  box-shadow: 0 4px 12px rgb(var(--shadow-color) / 0.15);
}

.theme-toggle-btn:not(.active):hover {
  background: rgb(var(--surface-300));
  color: rgb(var(--gray-200));
}

/* Responsive table container */
.table-scroll { overflow: auto; max-height: calc(100vh - 220px); }
