/* ═══════════════════════════════════════════════════════════════
   PyPTO IDE Assistant — Reusable UI Components
   ═══════════════════════════════════════════════════════════════ */

/* ──────────── FORM ELEMENTS ──────────── */
.form-section { margin-bottom: 16px; }
.form-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-input {
  width: 100%;
  background: var(--bg-base);
  border: none;
  border-radius: 5px;
  padding: 6px 9px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
}
.form-input:focus { outline: none; }
.form-input::placeholder { color: var(--text-muted); }

/* ──────────── RADIO GROUP ──────────── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.radio-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  border: none;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.radio-opt:hover { background: var(--bg-hover); color: var(--text-primary); }
.radio-opt.active { background: var(--bg-selected); color: var(--accent-blue); }
.radio-opt input[type="radio"] { accent-color: var(--accent-blue); }

/* ──────────── TENSOR ROW ──────────── */
.tensor-row {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
  align-items: center;
}
.ti-name {
  flex: 1 1 0;
  background: var(--bg-base);
  border: none;
  border-radius: 4px;
  padding: 4px 7px;
  color: var(--text-primary);
  font-size: 11px;
  font-family: inherit;
  min-width: 0;
}
.ti-name:focus { outline: none; }
.ti-dtype {
  flex: 0 0 58px;
  background: var(--bg-base);
  border: none;
  border-radius: 4px;
  padding: 4px 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: inherit;
}
.ti-dtype:focus { outline: none; }
.ti-shape {
  flex: 0 0 78px;
  background: var(--bg-base);
  border: none;
  border-radius: 4px;
  padding: 4px 7px;
  color: var(--text-accent);
  font-size: 11px;
  font-family: inherit;
}
.ti-shape:focus { outline: none; }
.ti-del {
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  transition: background 0.12s, color 0.12s;
  display: flex; align-items: center; justify-content: center;
}
.ti-del:hover { background: rgba(255, 75, 123, 0.12); color: var(--accent-red); }

/* ──────────── KV GRID ──────────── */
.kv-grid { display: flex; flex-direction: column; gap: 5px; }
.kv-row { display: flex; align-items: center; gap: 8px; }
.kv-k {
  flex: 0 0 64px;
  font-size: 11px;
  color: var(--text-muted);
}
.kv-v {
  flex: 1;
  background: var(--bg-base);
  border: none;
  border-radius: 4px;
  padding: 4px 7px;
  color: var(--text-accent);
  font-size: 11px;
  font-family: inherit;
}
.kv-v:focus { outline: none; }

/* ──────────── CHECKBOXES ──────────── */
.check-list { display: flex; flex-direction: column; gap: 5px; }
.ck-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}
.ck-item input[type="checkbox"] { accent-color: var(--accent-blue); }
.ck-item:hover { color: var(--text-primary); }

/* ──────────── BUTTONS ──────────── */
.btn-primary {
  padding: 8px 16px;
  background: var(--accent-blue);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary:hover { background: #2563eb; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.full-width { width: 100%; }

.btn-secondary {
  padding: 6px 12px;
  background: var(--bg-hover);
  border: none;
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-secondary:hover { background: var(--bg-active); color: var(--text-primary); }
.btn-secondary.full-width { width: 100%; }

.btn-add {
  padding: 4px 10px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s;
  margin-top: 4px;
}
.btn-add:hover { background: var(--bg-hover); color: var(--accent-blue); }

.btn-mini {
  padding: 2px 8px;
  background: var(--bg-hover);
  border: none;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-mini:hover { background: var(--bg-active); color: var(--accent-blue); }
.btn-mini.apply-btn:hover { color: var(--accent-green); }

/* ──────────── STAT CARDS ──────────── */
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc-card {
  background: var(--bg-base);
  border: none;
  border-radius: 5px;
  padding: 8px 10px;
  position: relative;
  overflow: hidden;
}
.sc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 100%;
  background: var(--accent-blue);
  opacity: 0.5;
}
.sc-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.sc-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.sc-val.warning { color: var(--accent-yellow); }

/* ──────────── FILE DROP AREA ──────────── */
.file-drop-area {
  border: none;
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-base);
}
.file-drop-area:hover { background: var(--bg-hover); }
.file-drop-area.drag-over { background: var(--bg-selected); }
.fda-icon { font-size: 20px; color: var(--text-muted); margin-bottom: 6px; }
.fda-text { font-size: 11px; color: var(--text-muted); line-height: 1.6; }

/* ──────────── RANGE ROW ──────────── */
.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.rr-label { font-size: 11px; color: var(--text-muted); flex: 0 0 32px; }

/* ──────────── DEBUG SECTIONS ──────────── */
.debug-section {
  background: var(--bg-base);
  border: none;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}
.ds-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}
.ds-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ──────────── RISK MATRIX ──────────── */
.risk-matrix {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rm-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rm-name {
  flex: 0 0 120px;
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rm-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--bg-panel);
  border-radius: 4px;
  overflow: hidden;
}
.rm-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.rm-label {
  flex: 0 0 36px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
}
.risk-high   .rm-bar-fill { background: var(--accent-red); }
.risk-medium .rm-bar-fill { background: var(--accent-orange); }
.risk-low    .rm-bar-fill { background: var(--accent-green); }
.risk-high   .rm-label { color: var(--accent-red); }
.risk-medium .rm-label { color: var(--accent-orange); }
.risk-low    .rm-label { color: var(--accent-green); }

/* ──────────── WORKAROUND LIST ──────────── */
.wa-list { display: flex; flex-direction: column; gap: 8px; }
.wa-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: var(--bg-panel);
  transition: background 0.15s;
}
.wa-item:hover { background: var(--bg-hover); }

.wa-prio {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}
.prio-1 .wa-prio { background: #1e0a0a; color: var(--accent-red); }
.prio-2 .wa-prio { background: #1e110a; color: var(--accent-orange); }
.prio-3 .wa-prio { background: #1a1a0a; color: var(--accent-yellow); }
.prio-4 .wa-prio { background: #0a1a10; color: var(--accent-green); }
.prio-5 .wa-prio { background: #0a1020; color: var(--accent-blue); }
.prio-6 .wa-prio { background: #170a20; color: var(--accent-purple); }

.wa-content { flex: 1; min-width: 0; }
.wa-name { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.wa-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-bottom: 6px; }
.wa-desc code {
  background: var(--bg-base);
  padding: 1px 4px;
  border-radius: 3px;
  color: #93c5fd;
  font-size: 10px;
}
.wa-actions { display: flex; gap: 5px; }

/* ──────────── OPTIMIZATION CARDS ──────────── */
.opt-card {
  border: none;
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--bg-panel);
}

.opt-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-panel);
  cursor: pointer;
}
.opt-impact {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.impact-high   { background: #1e0a0a; color: var(--accent-red); }
.impact-medium { background: #1e110a; color: var(--accent-orange); }
.impact-low    { background: #0a1a10; color: var(--accent-green); }

.opt-title { font-size: 12px; font-weight: 600; color: var(--text-primary); flex: 1; }
.opt-gain  { font-size: 11px; font-weight: 700; color: var(--accent-green); }

.opt-card-body {
  padding: 10px;
  display: none;
  background: var(--bg-base);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.opt-card.expanded .opt-card-body { display: block; }

.opt-code-block {
  background: var(--bg-panel);
  border: none;
  border-radius: 5px;
  padding: 10px;
  margin: 8px 0;
  font-family: inherit;
  font-size: 11px;
  white-space: pre;
  overflow-x: auto;
  color: #c9d1d9;
}
.opt-apply-btn {
  margin-top: 8px;
  padding: 4px 12px;
  background: var(--accent-green);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.opt-apply-btn:hover { background: #059669; }

/* ──────────── CHECKPOINT RESULTS ──────────── */
.ckpt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: none;
  border-radius: 5px;
  margin-bottom: 6px;
  font-size: 11px;
  background: var(--bg-base);
}
.ckpt-name { flex: 0 0 120px; font-weight: 600; color: var(--text-primary); }
.ckpt-diff-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-panel); overflow: hidden; }
.ckpt-diff-fill { height: 100%; border-radius: 3px; }
.ckpt-val { flex: 0 0 64px; text-align: right; font-weight: 700; }
.ckpt-pass { color: var(--accent-green); }
.ckpt-fail { color: var(--accent-red); }
.ckpt-diff-fill.pass { background: var(--accent-green); }
.ckpt-diff-fill.fail { background: var(--accent-red); }

/* ──────────── CONSTRAINT ITEMS ──────────── */
.ct-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 11px;
}
.ct-icon { flex-shrink: 0; font-size: 13px; }
.ct-msg { flex: 1; color: var(--text-secondary); line-height: 1.5; }
.ct-ok   .ct-icon { color: var(--accent-green); }
.ct-warn .ct-icon { color: var(--accent-yellow); }
.ct-err  .ct-icon { color: var(--accent-red); }

/* ──────────── API DOCS LIST ──────────── */
.docs-search { padding: 8px; flex-shrink: 0; }
.docs-list { flex: 1; overflow-y: auto; padding: 6px; }
.doc-item {
  padding: 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  margin-bottom: 4px;
}
.doc-item:hover { background: var(--bg-hover); }
.doc-item-name { font-size: 12px; font-weight: 600; color: var(--accent-blue); margin-bottom: 2px; }
.doc-item-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.doc-item-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  background: var(--bg-base);
  border: none;
  color: var(--text-muted);
  margin-top: 4px;
  margin-right: 3px;
}

/* ──────────── SNIPPET LIST ──────────── */
.snippet-list { padding: 6px; overflow-y: auto; flex: 1; }
.snippet-item {
  padding: 10px;
  border: none;
  border-radius: 5px;
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--bg-base);
  transition: background 0.12s;
}
.snippet-item:hover { background: var(--bg-hover); }
.snippet-name { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.snippet-preview {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-base);
  border-radius: 3px;
  padding: 4px 6px;
  white-space: pre;
  overflow: hidden;
  max-height: 48px;
}

/* ──────────── SELECTED OP PANEL (in precision) ──────────── */
.op-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.od-color-bar { width: 4px; height: 36px; border-radius: 2px; flex-shrink: 0; }
.od-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.od-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.op-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.od-kv { display: flex; flex-direction: column; }
.od-k { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.od-v { font-size: 12px; color: var(--text-primary); font-weight: 500; }

.io-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11px; }
.io-table th {
  text-align: left;
  padding: 4px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.io-table td {
  padding: 5px 6px;
  color: var(--text-secondary);
  vertical-align: middle;
}
.io-dir-in  { color: var(--accent-blue);  font-weight: 700; }

/* ==========================================================================
   Cohere Design.md component overrides
   ========================================================================== */

.form-section {
  margin-bottom: 22px;
}

.form-label,
.ds-title,
.sc-label,
.section-label,
.docs-search-label {
  margin-bottom: 10px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-input,
.ti-name,
.ti-dtype,
.ti-shape,
.kv-v,
.chat-input {
  background: rgba(236, 238, 245, 0.9);
  border: 1px solid rgba(33, 33, 33, 0.12);
  border-radius: 18px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.form-input,
.chat-input {
  padding: 12px 14px;
}

.chat-input {
  height: 56px;
  border-radius: 24px;
}

.form-input::placeholder,
.ti-name::placeholder,
.ti-shape::placeholder,
.chat-input::placeholder {
  color: var(--text-soft);
}

.form-input:focus,
.ti-name:focus,
.ti-dtype:focus,
.ti-shape:focus,
.kv-v:focus,
.chat-input:focus {
  outline: none;
  border-color: rgba(24, 99, 220, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 0 0 4px rgba(24, 99, 220, 0.08);
}

.radio-group,
.check-list,
.kv-grid,
.risk-matrix,
.wa-list,
.snippet-list,
.docs-list {
  gap: 10px;
}

.radio-opt,
.ck-item {
  padding: 12px 14px;
  border: 1px solid rgba(33, 33, 33, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-secondary);
  font-size: 13px;
}

.radio-opt:hover,
.ck-item:hover {
  background: #ffffff;
  border-color: rgba(33, 33, 33, 0.14);
}

.radio-opt.active {
  background: linear-gradient(135deg, rgba(24, 99, 220, 0.1), rgba(155, 96, 170, 0.08));
  border-color: rgba(24, 99, 220, 0.2);
  color: var(--accent);
}

.radio-opt input[type="radio"],
.ck-item input[type="checkbox"] {
  accent-color: var(--accent);
}

.tensor-head {
  display: grid;
  grid-template-columns: 76px 92px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 6px;
}

.tensor-head span {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tensor-row,
.kv-row,
.rm-row,
.ct-item {
  gap: 10px;
}

.tensor-row {
  display: grid;
  grid-template-columns: 76px 92px minmax(0, 1fr) 34px;
  align-items: center;
  margin-bottom: 10px;
}

.ti-name,
.ti-dtype,
.ti-shape,
.kv-v {
  min-height: 42px;
  padding: 10px 12px;
  min-width: 0;
}

.ti-name {
  width: 76px;
}

.ti-dtype {
  width: 92px;
}

.ti-shape {
  width: 100%;
  color: var(--accent-purple);
  font-family: var(--font-mono);
}

.ti-del,
.btn-mini {
  width: auto;
  min-width: 34px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(33, 33, 33, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 11px;
}

.ti-del:hover {
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.18);
  color: var(--accent-red);
}

.kv-k,
.rr-label,
.od-k,
.rm-name,
.doc-item-tag {
  color: var(--text-muted);
  font-size: 11px;
}

.btn-primary,
.btn-add,
.opt-apply-btn,
.nav-cta {
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
}

.btn-primary,
.opt-apply-btn {
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  box-shadow: 0 12px 24px rgba(22, 23, 28, 0.12);
}

.btn-primary:hover,
.opt-apply-btn:hover {
  background: #212121;
  border-color: #212121;
}

.btn-add {
  background: rgba(255, 255, 255, 0.84);
  border: 1px dashed rgba(33, 33, 33, 0.12);
  color: var(--accent);
}

.btn-add:hover {
  background: rgba(24, 99, 220, 0.06);
  border-color: rgba(24, 99, 220, 0.24);
  color: var(--accent);
}

.stat-cards {
  gap: 12px;
}

.sc-card,
.debug-section,
.wa-item,
.opt-card,
.ckpt-item,
.doc-item,
.snippet-item,
.file-drop-area {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(33, 33, 33, 0.1);
  border-radius: 22px;
  box-shadow: 0 14px 28px rgba(22, 23, 28, 0.06);
}

.sc-card {
  padding: 14px 16px;
}

.sc-card::before {
  width: 100%;
  height: 3px;
  top: 0;
  left: 0;
  opacity: 1;
  background: linear-gradient(90deg, rgba(155, 96, 170, 0.7), rgba(24, 99, 220, 0.8));
}

.sc-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.sc-val.warning {
  color: var(--accent-purple);
}

.file-drop-area {
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(236, 238, 245, 0.96)),
    linear-gradient(135deg, rgba(24, 99, 220, 0.04), rgba(155, 96, 170, 0.05));
  border-style: dashed;
}

.file-drop-area:hover,
.file-drop-area.drag-over {
  border-color: rgba(24, 99, 220, 0.24);
  background: linear-gradient(135deg, rgba(24, 99, 220, 0.08), rgba(155, 96, 170, 0.08));
}

.fda-icon {
  color: var(--accent);
}

.fda-text,
.ds-placeholder,
.wa-desc,
.doc-item-desc,
.snippet-preview,
.ct-msg,
.od-v,
.io-table td {
  color: var(--text-muted);
}

.debug-section {
  padding: 18px;
  margin-bottom: 14px;
}

.ds-placeholder {
  font-style: normal;
  font-size: 13px;
}

.rm-bar-bg,
.ckpt-diff-bar {
  background: rgba(33, 33, 33, 0.06);
  border-radius: 999px;
}

.risk-high .rm-bar-fill,
.ckpt-diff-fill.fail {
  background: linear-gradient(90deg, #d92d20, #b42318);
}

.risk-medium .rm-bar-fill {
  background: linear-gradient(90deg, #d97706, #b45309);
}

.risk-low .rm-bar-fill,
.ckpt-diff-fill.pass {
  background: linear-gradient(90deg, #15803d, #177245);
}

.wa-item {
  padding: 14px;
  gap: 12px;
}

.wa-prio {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(243, 243, 247, 0.9);
  border: 1px solid rgba(33, 33, 33, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
}

.prio-1 .wa-prio,
.impact-high {
  background: rgba(180, 35, 24, 0.08);
  color: var(--accent-red);
}

.prio-2 .wa-prio,
.impact-medium {
  background: rgba(180, 92, 23, 0.08);
  color: var(--accent-orange);
}

.prio-3 .wa-prio,
.prio-4 .wa-prio,
.prio-5 .wa-prio,
.prio-6 .wa-prio,
.impact-low {
  color: var(--accent);
}

.wa-name,
.snippet-name,
.doc-item-name,
.od-name,
.opt-title,
.ckpt-name {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.wa-desc code,
.opt-code-block,
.snippet-preview {
  background: rgba(243, 243, 247, 0.92);
  border-radius: 16px;
  font-family: var(--font-mono);
}

.wa-desc code {
  color: var(--accent);
  padding: 3px 8px;
}

.opt-card-header {
  padding: 14px 16px;
  background: transparent;
}

.opt-card-body,
.opt-code-block {
  color: var(--text-secondary);
}

.opt-card-body {
  padding: 0 16px 16px;
  background: transparent;
}

.opt-code-block {
  margin: 10px 0;
  padding: 14px 16px;
  border: 1px solid rgba(33, 33, 33, 0.06);
}

.docs-search {
  padding: 14px;
}

.doc-item,
.snippet-item {
  padding: 14px;
}

.doc-item:hover,
.snippet-item:hover,
.wa-item:hover {
  border-color: rgba(24, 99, 220, 0.18);
  box-shadow: 0 18px 32px rgba(24, 99, 220, 0.08);
}

.doc-item-name {
  color: var(--accent);
}

.doc-item-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(33, 33, 33, 0.08);
  border-radius: 999px;
  background: rgba(243, 243, 247, 0.84);
  font-family: var(--font-mono);
}

.op-detail-grid {
  gap: 10px;
}

.od-badge {
  border-radius: 999px;
  background: rgba(24, 99, 220, 0.08);
  color: var(--accent);
}

.io-table {
  margin-top: 12px;
}

.io-table th {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
}

.io-dir-in {
  color: var(--accent);
}
.io-dir-out { color: var(--accent-green); font-weight: 700; }
.tier-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

/* ──────────── TYPING ANIMATION ──────────── */
.typing-dots {
  display: flex; align-items: center; gap: 4px; padding: 4px 0;
}
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ──────────── NOTIFICATION TOAST ──────────── */
#toast-container {
  position: fixed;
  bottom: 36px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease, toast-out 0.2s ease 2.8s forwards;
  pointer-events: auto;
}
.toast.success { background: #052e16; border: none; color: var(--accent-green); }
.toast.error   { background: #1e0a0a; border: none; color: var(--accent-red); }
.toast.info    { background: #0c1a2e; border: none; color: var(--accent-blue); }
@keyframes toast-in  { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: none; } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; } }

/* ──────────── THINKING INDICATOR ──────────── */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
}
.ai-thinking::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--accent-purple);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ──────────── SVG GRAPH NODE STYLES ──────────── */
.pg-node { cursor: pointer; }
.pg-node rect {
  transition: stroke 0.2s, filter 0.2s;
  stroke-width: 1.5;
}
.pg-node:hover rect { stroke-width: 2.5; }
.pg-node.selected rect { stroke-width: 3; }
.pg-node.risk-high   rect { stroke: #ef4444; filter: url(#glow-red); }
.pg-node.risk-medium rect { stroke: #f97316; filter: url(#glow-orange); }
.pg-node.checkpoint rect { stroke-dasharray: 5 3; stroke: #3b82f6; }

.pg-edge { stroke: #243447; stroke-width: 1.5; fill: none; }
.pg-edge-active { stroke: #3b82f6; stroke-width: 2; }

/* ──────────── MISC ──────────── */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23475569'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px !important;
  cursor: pointer;
}
