/* Brain models view — design v10 (2026-09-16)
   Desktop: spread gauge + stat tiles + routing rows (dept → model → picker) + catalogue.
   Mobile (<=900px): app-style — segmented control, stacked tap cards, searchable list.
   Rules: dark theme, no CDN/emoji, customer view never shows keys/pools/evidence age. */

.models-view { min-height: 100vh; padding: 34px 22px 70px; position: relative; z-index: 1;
  background: var(--bg, #0a0e14);
  background-image:
    radial-gradient(900px 320px at 84% -80px, rgba(232,180,74,.06), transparent 60%),
    radial-gradient(700px 260px at -10% 30%, rgba(109,155,255,.05), transparent 60%); }
.models-view .models-wrap { max-width: 1440px; margin: 0 auto; }
@media (max-width: 900px) { .models-view { padding: 18px 14px 90px; } }

/* ── page head ─────────────────────────────────────────────────────────────── */
.models-head { padding: 4px 0 10px; }
.hd-eyebrow { font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 10.5px; letter-spacing: .18em;
  color: var(--gold, #e8b44a); text-transform: uppercase; }
.hd-eyebrow .cursor { display: inline-block; width: 7px; height: 12px; margin-left: 6px; background: var(--gold, #e8b44a);
  vertical-align: -1px; animation: mvblink 1.2s step-end infinite; }
@keyframes mvblink { 50% { opacity: 0 } }
.models-head h1 { margin: 8px 0 6px; font-size: 22px; font-weight: 800; letter-spacing: .1px; color: var(--text, #eaeff6); }
.sub-flag { font-family: var(--mono, monospace); font-size: 10px; font-weight: 700; color: #0a0f16;
  background: linear-gradient(180deg, #f8db93, #e8b44a); padding: 3px 8px; border-radius: 6px; vertical-align: 3px; margin-left: 6px; }
.hd-desc { margin: 0; max-width: 720px; color: var(--text-dim, #95a3b5); font-size: 13px; line-height: 1.7; }
.hd-line { height: 1px; margin-top: 14px; background: linear-gradient(90deg, rgba(232,180,74,.35), transparent 70%); }

/* ── segmented control (mobile only) ───────────────────────────────────────── */
.mv-seg { display: none; }

/* ── layout grid ───────────────────────────────────────────────────────────── */
.mv-top { display: grid; grid-template-columns: 340px 1fr; gap: 13px; margin-bottom: 13px; }
@media (max-width: 1100px) { .mv-top { grid-template-columns: 1fr; } }

/* ── spread gauge ──────────────────────────────────────────────────────────── */
.mv-radar { border: 1px solid var(--border-soft, rgba(255,255,255,.08)); border-radius: 18px; padding: 14px 16px 10px;
  background: radial-gradient(420px 200px at 18% 0%, rgba(232,180,74,.12), transparent 64%), var(--surface, #0f1621);
  box-shadow: 0 22px 44px -34px #000; }
.mv-cap { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint, #5c6a7c); font-weight: 700; }
.mv-cap2 { color: var(--gold-bright, #f8db93); }
.mv-gauge { position: relative; width: 236px; height: 236px; margin: 4px auto 0; }
.mv-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.mv-mid b { font-family: var(--mono, monospace); font-size: 42px; font-weight: 800; line-height: 1; letter-spacing: -1.5px;
  background: linear-gradient(180deg, #fff, #f8db93); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mv-mid em { display: block; font-style: normal; font-size: 11.5px; color: var(--text-dim, #95a3b5);
  font-family: var(--mono, monospace); margin-top: 5px; }
.mv-sweep { transform-origin: 118px 118px; animation: mvspin 4.2s linear infinite; }
@keyframes mvspin { to { transform: rotate(360deg) } }
.mv-radarfoot { text-align: center; font-family: var(--mono, monospace); font-size: 11.5px; color: var(--text-dim, #95a3b5); padding: 6px 0 8px; }

/* ── stat tiles ────────────────────────────────────────────────────────────── */
.sum-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
@media (max-width: 1100px) { .sum-row { grid-template-columns: repeat(2, 1fr); } }
.mv-tile { position: relative; border: 1px solid var(--border-soft, rgba(255,255,255,.08)); border-radius: 16px;
  padding: 13px 15px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.006)), var(--surface, #0f1621); }
.mv-tile .k { font-size: 11.5px; color: var(--text-dim, #95a3b5); }
.mv-tile .v { font-family: var(--mono, monospace); font-size: 26px; font-weight: 800; margin-top: 7px;
  letter-spacing: -.6px; color: var(--text, #eaeff6); display: flex; align-items: center; gap: 8px; }
.mv-tile .s { font-size: 11px; color: var(--text-faint, #5c6a7c); margin-top: 3px; font-family: var(--mono, monospace); }
.mv-dot { width: 9px; height: 9px; border-radius: 50%; background: #33c97a;
  box-shadow: 0 0 0 0 rgba(51,201,122,.55); animation: mvpulse 2.4s infinite; }
@keyframes mvpulse { 0% { box-shadow: 0 0 0 0 rgba(51,201,122,.55) } 70% { box-shadow: 0 0 0 9px rgba(51,201,122,0) } 100% { box-shadow: 0 0 0 0 rgba(51,201,122,0) } }
.mv-famlist { margin-top: 9px; display: flex; flex-direction: column; gap: 6px; }
.mv-famrow { display: flex; align-items: center; gap: 8px; font-family: var(--mono, monospace); font-size: 11.5px; color: var(--text-dim, #95a3b5); }
.mv-famrow i { width: 9px; height: 9px; border-radius: 3px; }
.mv-famrow .bt { flex: 1; height: 5px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.mv-famrow .bt i { display: block; height: 100%; border-radius: 99px; }
.mv-famrow b { color: var(--text, #eaeff6); }

/* ── routing rows ──────────────────────────────────────────────────────────── */
.models-list { margin-top: 13px; border: 1px solid var(--border-soft, rgba(255,255,255,.08)); border-radius: 18px;
  padding: 6px 14px 14px; background: var(--surface, #0f1621); }
.mv-row { display: grid; grid-template-columns: 296px 100px 1fr 232px; gap: 10px; align-items: center;
  padding: 6px 4px; min-height: 54px; border-radius: 13px; position: relative; }
.mv-row + .mv-row { border-top: 1px solid rgba(255,255,255,.045); }
.mv-row:hover { background: rgba(232,180,74,.04); }
.mv-row.flash { animation: mvflash 1.3s ease-out; }
@keyframes mvflash { 0% { background: rgba(232,180,74,.22) } 100% { background: transparent } }
.mv-row.pinned::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--gold, #e8b44a); }
.mv-dept { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mv-dot2 { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.mv-who { min-width: 0; }
.mv-who b { display: block; font-size: 13.5px; color: var(--text, #eaeff6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-pol { display: inline-block; margin-top: 3px; font-family: var(--mono, monospace); font-size: 10px;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-soft, rgba(255,255,255,.08)); color: var(--text-dim, #95a3b5); }
.mv-pol.premium { color: #f8db93; border-color: rgba(232,180,74,.3); background: rgba(232,180,74,.07); }
.mv-pol.fast { color: #a9d5ff; border-color: rgba(109,155,255,.3); background: rgba(109,155,255,.07); }
.mv-pol.balanced { color: #b8f2d3; border-color: rgba(51,201,122,.26); background: rgba(51,201,122,.06); }
.mv-conn { height: 40px; overflow: hidden; }
.mv-conn svg { width: 100%; height: 40px; display: block; }
.mv-conn path { fill: none; stroke-width: 1.6; opacity: .55; stroke-dasharray: 5 9; animation: mvdash 1.5s linear infinite; }
@keyframes mvdash { to { stroke-dashoffset: -28 } }
.mv-model { display: flex; align-items: center; gap: 11px; min-width: 0; border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  border-radius: 12px; padding: 9px 12px; background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.006)); }
.mv-mdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.mv-mn { font-family: var(--mono, monospace); font-size: 13px; color: var(--text, #eaeff6); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mv-mst { font-size: 10.5px; font-family: var(--mono, monospace); color: var(--text-faint, #5c6a7c); white-space: nowrap; flex: 0 0 auto; }
.mv-bar { flex: 1 1 56px; height: 9px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; min-width: 40px; }
.mv-bar i { display: block; height: 100%; border-radius: 99px; transition: width .6s ease; }
.mv-lat { font-family: var(--mono, monospace); font-size: 12.5px; min-width: 46px; text-align: right; flex: 0 0 auto; color: var(--text, #eaeff6); }
.mv-pick { min-width: 0; }
.mv-pick select { width: 100%; min-width: 0; font-family: inherit; font-size: 12.5px; color: var(--text, #eaeff6);
  border: 1px solid var(--border-soft, rgba(255,255,255,.08)); border-radius: 11px; padding: 10px 26px 10px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)), var(--bg, #05080e);
  appearance: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: .16s;
  background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2398a5b6' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat, no-repeat; background-position: 0 0, right 10px center; }
.mv-pick select:hover { border-color: rgba(232,180,74,.35); }
.mv-pick select:focus { outline: none; border-color: var(--gold, #e8b44a); box-shadow: 0 0 0 3px rgba(232,180,74,.12); }
.mv-pick select option { background: #0f1621; color: var(--text, #eaeff6); }
.mv-warn { display: block; margin-top: 6px; font-size: 10.5px; color: #e0a33e; font-family: var(--mono, monospace); }

/* ── catalogue ─────────────────────────────────────────────────────────────── */
.avail-wrap { margin-top: 13px; border: 1px solid var(--border-soft, rgba(255,255,255,.08)); border-radius: 18px;
  padding: 14px 16px 16px; background: var(--surface, #0f1621); }
.avail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.avail-label { font-size: 14px; font-weight: 700; color: var(--text, #eaeff6); }
.avail-label em { font-style: normal; font-family: var(--mono, monospace); font-size: 11.5px; color: var(--text-faint, #5c6a7c); }
.avail-cnt { font-family: var(--mono, monospace); font-size: 11.5px; color: var(--text-faint, #5c6a7c); }
.mv-cat-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mv-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  border-radius: 11px; padding: 8px 11px; background: rgba(255,255,255,.03); }
.mv-search input { border: 0; background: transparent; color: var(--text, #eaeff6); font-family: inherit; font-size: 12.5px; width: 150px; }
.mv-search input:focus { outline: none; }
.mv-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.mv-fbtn { font-family: var(--mono, monospace); font-size: 11px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border-soft, rgba(255,255,255,.08)); color: var(--text-dim, #95a3b5); cursor: pointer; transition: .16s; }
.mv-fbtn:hover { color: var(--text, #eaeff6); border-color: rgba(232,180,74,.3); }
.mv-fbtn.on { color: #0a0f16; font-weight: 800; background: linear-gradient(180deg, #f8db93, #e8b44a); border-color: transparent; }
.avail-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 10px; }
.mv-mcard { position: relative; border: 1px solid var(--border-soft, rgba(255,255,255,.08)); border-radius: 14px;
  padding: 11px 13px; overflow: hidden; transition: transform .18s, border-color .18s;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.005)); }
.mv-mcard:hover { transform: translateY(-2px); border-color: rgba(232,180,74,.28); }
.mv-mcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--fc, #98a5b6); }
.mv-mcard .t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mv-mcard .d { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--fc, #98a5b6);
  box-shadow: 0 0 8px var(--fc, #98a5b6); }
.mv-mcard .n { font-family: var(--mono, monospace); font-size: 12.5px; color: var(--text, #eaeff6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mv-mcard .row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.mv-mcard .tier { font-size: 10px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  color: var(--text-dim, #95a3b5); font-family: var(--mono, monospace); }
.mv-mcard .lat { margin-left: auto; font-family: var(--mono, monospace); font-size: 11.5px; color: var(--text-dim, #95a3b5); }
.mv-mcard .bt { height: 4px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 9px; }
.mv-mcard .bt i { display: block; height: 100%; border-radius: 99px; background: var(--fc, #98a5b6); opacity: .85; }
.mv-inuse { font-size: 9.5px; font-family: var(--mono, monospace); color: #0a0f16; background: var(--gold, #e8b44a);
  padding: 2px 6px; border-radius: 5px; margin-left: auto; flex: 0 0 auto; }
.mv-empty { grid-column: 1 / -1; padding: 18px; text-align: center; color: var(--text-faint, #5c6a7c); font-family: var(--mono, monospace); }

/* ── toast / states ────────────────────────────────────────────────────────── */
.models-loading { color: var(--text-dim, #95a3b5); font-family: var(--mono, monospace); font-size: 12.5px; padding: 14px 2px; }
.models-error { color: #f0786f; font-size: 12.5px; padding: 10px 0; }

/* ══ MOBILE (app-style, not a shrunk desktop) ══════════════════════════════ */
@media (max-width: 900px) {
  .models-head h1 { font-size: 19px; }
  .hd-desc { font-size: 12.5px; }

  /* segmented control */
  .mv-seg { display: flex; gap: 4px; padding: 4px; margin: 10px 0 12px; border-radius: 14px;
    border: 1px solid var(--border-soft, rgba(255,255,255,.08)); background: rgba(255,255,255,.035);
    position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
  .mv-seg button { flex: 1; border: 0; background: transparent; color: var(--text-dim, #95a3b5);
    font-family: inherit; font-size: 13px; padding: 11px 0; border-radius: 11px; }
  .mv-seg button.on { color: #0a0f16; font-weight: 800; background: linear-gradient(180deg, #f8db93, #e8b44a); }
  .mv-seg button:active { transform: scale(.97); }

  /* one pane at a time */
  #modelsView .mv-pane.mv-hidden-mobile { display: none; }

  .mv-top { grid-template-columns: 1fr; gap: 11px; }
  .mv-radar { padding: 12px 14px 8px; }
  .mv-gauge { width: 200px; height: 200px; }
  .mv-gauge svg { width: 200px; height: 200px; }
  .mv-mid b { font-size: 34px; }
  .sum-row { grid-template-columns: 1fr 1fr; gap: 9px; }
  .mv-tile { padding: 11px 12px; }
  .mv-tile .v { font-size: 21px; }

  /* department cards: tap to expand */
  .models-list { padding: 4px 10px 10px; }
  .mv-row { grid-template-columns: 1fr; gap: 8px; min-height: 0; padding: 10px 4px; }
  .mv-conn { display: none; }
  .mv-pick select { padding: 13px 26px 13px 12px; font-size: 13.5px; }
  .mv-dept { justify-content: flex-start; }
  .mv-model { padding: 10px 12px; }

  /* catalogue: list rows + horizontal chips */
  .avail-wrap { padding: 12px; }
  .mv-cat-tools { margin-left: 0; width: 100%; }
  .mv-search, .mv-search input { width: 100%; }
  .mv-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; width: 100%; }
  .mv-fbtn { flex: 0 0 auto; }
  .avail-chips { grid-template-columns: 1fr; gap: 8px; }
  .mv-mcard { padding: 12px 13px; }
}
