/* Main Yuktav Brain — Regulatory Intelligence Centre (Track B, B1).
 * Neumorphism (Soft UI) built ONLY on the existing design system: --bg, --text, --border and the
 * --neu-* shadow tokens from neumorphic.css. No second theme. Loaded after design_system.css's
 * siblings; every rule is scoped to .bc-wrap / .bc-dialog so no other screen changes.
 * Contrast: text #2B1D14 / #3A2A1D on --bg is >= 12:1; chip text/tint pairs below are >= 4.5:1;
 * the focus ring is a solid 3px outline (not shadow-only) so it stays visible on soft surfaces. */

.bc-wrap {
  /* Lifecycle states that exist today */
  --st-staged-bg: #FFF1D6;     --st-staged-fg: #7A4B00;
  --st-active-bg: #E3F1E5;     --st-active-fg: #1E5C2B;
  --st-superseded-bg: #E8EAF2; --st-superseded-fg: #3F4768;
  --st-retired-bg: #EDE6E0;    --st-retired-fg: #5B4636;
  /* Reserved for later slices (B3/B4): defined once so the palette stays consistent, unused in B1 */
  --st-new-bg: #E2EEF8;        --st-new-fg: #1B4F7A;
  --st-review-bg: #FFF1D6;     --st-review-fg: #7A4B00;
  --st-approved-bg: #E0F2F0;   --st-approved-fg: #11594F;
  --bc-focus: #8A4710;
  padding: 4px 2px 24px;
  color: var(--text);
}

.bc-wrap :focus-visible, .bc-dialog :focus-visible {
  outline: 3px solid var(--bc-focus) !important;
  outline-offset: 2px;
}
.bc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bc-intro { max-width: 70ch; color: var(--text-muted); line-height: 1.5; margin: 4px 0 16px; }

/* Status filter cards: raised, pressed (inset) when selected */
.bc-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.bc-kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 64px; padding: 12px 14px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--bg); color: var(--text); text-align: left;
  box-shadow: var(--neu-raised-sm);
}
.bc-kpi.is-on { box-shadow: var(--neu-inset); }
.bc-kpi-n { font-size: 24px; font-weight: 700; line-height: 1.1; }
.bc-kpi-l { font-size: 13px; color: var(--text-muted); }

.bc-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.bc-search { flex: 1 1 240px; min-width: 0; }
.bc-search input, .bc-form input, .bc-form select {
  width: 100%; min-height: 44px; padding: 10px 14px; box-sizing: border-box; font: inherit; color: var(--text);
  background: var(--bg); border: 0; border-radius: 12px; box-shadow: var(--neu-inset);
}
.bc-toolbar .btn-primary, .bc-actions button { min-height: 44px; padding: 10px 18px; }

/* Stage form: one raised panel, inset fields */
.bc-stage { margin-bottom: 20px; padding: 16px; border-radius: 20px; background: var(--bg); box-shadow: var(--neu-raised); }
.bc-stage[hidden] { display: none; }
.bc-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.bc-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.bc-form input[type=file] { padding: 10px; }

/* Document list: soft raised rows, whole row is one button */
.bc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bc-row {
  display: flex; flex-direction: column; gap: 10px; width: 100%; min-height: 64px; padding: 14px 16px;
  border: 0; border-radius: 16px; background: var(--bg); color: var(--text); text-align: left; cursor: pointer; font: inherit;
  box-shadow: var(--neu-raised-sm);
}
.bc-row:hover { box-shadow: var(--neu-raised); }
.bc-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bc-row-title { font-weight: 600; overflow-wrap: anywhere; }
.bc-row-meta, .bc-row-date { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.bc-row-side { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Status chips: colour + icon + text, never colour alone */
.bc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.bc-chip .icon { width: 14px; height: 14px; }
.bc-st-staged { background: var(--st-staged-bg); color: var(--st-staged-fg); }
.bc-st-active { background: var(--st-active-bg); color: var(--st-active-fg); }
.bc-st-superseded { background: var(--st-superseded-bg); color: var(--st-superseded-fg); }
.bc-st-retired { background: var(--st-retired-bg); color: var(--st-retired-fg); }

/* Detail */
.bc-detail { padding: 16px; border-radius: 20px; background: var(--bg); box-shadow: var(--neu-raised); }
.bc-back { margin-bottom: 12px; min-height: 44px; }
.bc-d-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.bc-d-head h3 { margin: 0; overflow-wrap: anywhere; }
.bc-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; padding: 0; }
.bc-steps li { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--text-muted); background: var(--bg); box-shadow: var(--neu-inset); }
.bc-steps li.is-done { color: var(--text); }
.bc-steps li.is-now { color: var(--text); font-weight: 700; box-shadow: var(--neu-raised-sm); }
.bc-d-state { color: var(--text-muted); margin: 6px 0 12px; }
.bc-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; }
.bc-actions button:disabled { opacity: .55; cursor: not-allowed; }
.bc-note { font-size: 13px; color: var(--text-muted); margin: 4px 0; }
.bc-warn { font-size: 13px; margin: 6px 0; padding: 8px 12px 8px 28px; border-left: 3px solid currentColor; color: var(--text-primary, inherit); }
.bc-error { color: #9B1C1C; font-weight: 600; }
.bc-empty { padding: 24px 8px; color: var(--text-muted); }
.bc-meta { display: grid; grid-template-columns: 1fr; gap: 10px 20px; margin: 14px 0; }
.bc-meta dt { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.bc-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.bc-link { border: 0; background: none; padding: 0; font: inherit; color: var(--bc-focus); text-decoration: underline; cursor: pointer; min-height: 24px; }
.bc-preview { max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border-radius: 14px; background: var(--bg); box-shadow: var(--neu-inset); font-size: 13px; line-height: 1.5; }
.bc-audit { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bc-audit li { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 14px; border-radius: 12px; box-shadow: var(--neu-inset); }
.bc-audit-when, .bc-audit-who { font-size: 13px; color: var(--text-muted); }
.bc-audit-what { font-weight: 600; }

/* B2 assisted metadata */
.bc-metaedit { margin: 18px 0; }
.bc-ai { margin-top: 6px; font-size: 13px; overflow-wrap: anywhere; }
.bc-ai-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--st-staged-bg); color: var(--st-staged-fg); }
.bc-aisummary { padding: 12px 14px; margin: 8px 0; border-radius: 14px; background: var(--bg); box-shadow: var(--neu-inset); overflow-wrap: anywhere; }
.bc-aisummary p { margin: 6px 0 0; }

/* Confirmation dialog */
.bc-dialog { max-width: min(92vw, 460px); padding: 20px; border: 0; border-radius: 20px; background: var(--bg); color: var(--text); box-shadow: 14px 14px 34px rgba(45,42,40,.28), -8px -8px 24px rgba(255,255,255,.35); }
.bc-dialog::backdrop { background: rgba(43,29,20,.45); }
.bc-dialog h3 { margin-top: 0; }
.bc-dialog p { line-height: 1.5; }
.bc-dialog .bc-actions { justify-content: flex-end; }

/* B3 Source Registry */
.bc-srcpanel { margin: 16px 0; padding: 12px 16px; border: 1px solid var(--bc-border, #d0d5dd); border-radius: 8px; }
.bc-src-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.bc-src { padding: 12px 16px; border: 1px solid var(--bc-border, #d0d5dd); border-radius: 8px; }
.bc-src-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bc-src-versions { margin: 8px 0; padding-left: 18px; }
.bc-matches { margin: 8px 0; }
.bc-src-draft, .bc-src-suspended { background: #fff4e5; color: #7a4100; }
.bc-src-verified { background: #e6f4ea; color: #14532d; }
.bc-src-retired { background: #eceff3; color: #3b4452; }

@media (min-width: 720px) {
  .bc-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bc-wide { grid-column: 1 / -1; }
  .bc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bc-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .bc-row-side { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; }
  .bc-audit li { grid-template-columns: 11rem 1fr auto; align-items: baseline; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bc-wrap *, .bc-dialog * { transition: none !important; animation: none !important; }
}
