/* aiw.css — AI Workspace styles. Dark-first, animated cards; reuses the console's CSS variables so it
   inherits the active theme. Scoped under .aiw-* to avoid collisions with the rest of the console. */

/* ---- Dashboard ---- */
.aiw-dash { display: flex; flex-direction: column; gap: 16px; }

.aiw-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.aiw-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.aiw-tile:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.aiw-tile.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.aiw-tile.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.aiw-tile.danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.aiw-tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.aiw-tile-value { font-size: 20px; font-weight: 650; margin-top: 4px; }
.aiw-tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.aiw-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 820px) { .aiw-cols { grid-template-columns: 1fr; } }

.aiw-usage { display: flex; flex-direction: column; gap: 12px; }
.aiw-usage-nums { display: flex; gap: 24px; flex-wrap: wrap; }
.aiw-metric { display: flex; flex-direction: column; }
.aiw-metric .n { font-size: 22px; font-weight: 700; }
.aiw-metric .l { font-size: 12px; color: var(--muted); }
.aiw-metric.accent .n { color: var(--accent); }
.aiw-usage-foot { font-size: 12px; color: var(--muted); }

.aiw-ratios { display: flex; gap: 20px; justify-content: space-around; align-items: center; }
.aiw-cta { font-size: 13px; color: var(--muted); padding: 8px 2px; }
.aiw-cta a { color: var(--accent); }

/* ---- Charts ---- */
.aiw-spark { width: 100%; height: 52px; display: block; overflow: visible; }
.aiw-spark-line { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.aiw-spark-area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.aiw-donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.aiw-donut-track { stroke: var(--border); stroke-width: 8; }
.aiw-donut-arc { stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.aiw-donut-text { fill: var(--text); font-size: 18px; font-weight: 700; font-family: var(--sans); }
.aiw-donut-label { font-size: 12px; color: var(--muted); }

/* ---- Providers ---- */
.aiw-prov-list { display: flex; flex-direction: column; gap: 14px; }
.aiw-prov-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.aiw-prov-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.aiw-prov-card.off { opacity: .6; }
.aiw-prov-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aiw-prov-name { font-weight: 650; font-size: 15px; }
.aiw-prov-url { font-size: 12px; color: var(--muted); font-family: var(--mono); }

.aiw-accts { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.aiw-accts-empty { font-size: 12px; color: var(--muted); margin: 10px 0; }
.aiw-acct {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
}
.aiw-acct-label { font-weight: 550; }
.aiw-acct-key { color: var(--muted); }
.aiw-acct-model { font-size: 12px; color: var(--accent); }

.aiw-prov-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aiw-test-msg { font-size: 12px; color: var(--muted); }
.aiw-test-msg.ok { color: var(--ok); }
.aiw-test-msg.bad { color: var(--danger); }

/* ---- Optimizers ---- */
.aiw-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.aiw-chip {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; transition: all .12s ease;
}
.aiw-chip:hover { border-color: var(--border-strong); color: var(--text); }
.aiw-chip.on { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }

.aiw-opt-grid-inner {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.aiw-opt-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.aiw-opt-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.aiw-opt-card.off { opacity: .55; }
.aiw-opt-head { display: flex; align-items: center; gap: 8px; }
.aiw-opt-name { font-weight: 650; }
.aiw-opt-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; min-height: 34px; }
.aiw-opt-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.aiw-opt-stats b { color: var(--text); font-weight: 600; }
.aiw-opt-actions { display: flex; gap: 8px; margin-top: 4px; }

.aiw-switch-wrap { display: inline-flex; }
.aiw-switch { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.aiw-cfg-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.aiw-try-out { margin-top: 12px; }
.aiw-try-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.aiw-try-stats .accent { color: var(--accent); font-weight: 600; }
.aiw-try-stats .muted { color: var(--muted); }
.aiw-try-notes { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.aiw-try-pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; max-height: 300px; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
}

/* ---- Usage / hbars ---- */
.aiw-hbars { display: flex; flex-direction: column; gap: 8px; }
.aiw-hbars-empty { font-size: 13px; color: var(--muted); }
.aiw-hbar { display: grid; grid-template-columns: 120px 1fr 64px; align-items: center; gap: 10px; font-size: 12.5px; }
.aiw-hbar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aiw-hbar-track { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; height: 10px; overflow: hidden; }
.aiw-hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.aiw-hbar-val { text-align: right; color: var(--muted); font-family: var(--mono); }

/* ---- Cache ---- */
.aiw-cache-stats { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.aiw-donut-hold { flex: 0 0 auto; }

/* ---- Workspaces / Context / Knowledge ---- */
.aiw-opt-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 12px; margin: 6px 0; }

/* ---- Settings / Plugins ---- */
.aiw-set-grid { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.aiw-set-status { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; font-size: 13px; }
.aiw-set-status .muted { color: var(--muted); }
.aiw-plugin-list { display: flex; flex-direction: column; gap: 8px; }
.aiw-plugin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.aiw-plugin-name { font-weight: 600; min-width: 160px; }
.aiw-plugin-desc { color: var(--muted); flex: 1; min-width: 200px; }

/* ---- Scan ---- */
.notice.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); color: var(--text); }
.aiw-scan-controls { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.aiw-scan-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.aiw-scan-types { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.aiw-scan-bar { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.aiw-scan-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.aiw-scan-file {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: 13px; border: 1px solid transparent;
}
.aiw-scan-file:hover { background: var(--surface); border-color: var(--border); }
.aiw-scan-file.dim { opacity: .5; }
.aiw-scan-cb { display: inline-flex; }
.aiw-scan-path { flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aiw-scan-tok { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.aiw-scan-saved { color: var(--accent); min-width: 52px; text-align: right; }
.aiw-scan-actions { display: inline-flex; gap: 6px; }
.aiw-scan-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 720px) { .aiw-scan-diff { grid-template-columns: 1fr; } }
