/* views.css — Cortex module views: Chat · Inspector · Memory · Insights · Telemetry.
   Reuses shared components from app.css (.card/.btn-*/.chip/.field/.input/.modal). */

/* ════════════════════════ Chat ════════════════════════ */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-msgs {
  flex: 1; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-4);
}
.chat-msg {
  max-width: 86%; padding: 10px 13px; border-radius: var(--r-lg);
  font-size: var(--fs-body); line-height: var(--lh);
  border: 1px solid var(--stroke); box-shadow: var(--sh-1);
}
.chat-msg.is-user {
  align-self: flex-end; background: rgba(110,168,254,.16);
  border-color: rgba(110,168,254,.34); border-bottom-right-radius: var(--r-sm);
}
.chat-msg.is-ai {
  align-self: flex-start; background: var(--bg-3);
  border-bottom-left-radius: var(--r-sm);
}
.chat-text { color: var(--t-1); white-space: pre-wrap; word-break: break-word; }
.chat-cites {
  display: flex; flex-wrap: wrap; gap: var(--s-1);
  margin-top: var(--s-2);
}
.chat-cites .chip { cursor: pointer; }
.chat-cites .chip:hover { border-color: var(--acc); color: var(--t-1); }
.chat-grow {
  margin-top: var(--s-2); font-size: var(--fs-fine); color: var(--acc-2);
  display: flex; flex-wrap: wrap; gap: var(--s-1); align-items: center;
}
.chat-composer {
  flex: none; position: sticky; bottom: 0;
  display: flex; gap: var(--s-2); align-items: flex-end;
  padding: var(--s-3); border-top: 1px solid var(--stroke);
  background: var(--bg-glass); backdrop-filter: blur(14px);
}
.chat-input {
  flex: 1; resize: none; min-height: 42px; max-height: 140px;
  background: var(--bg-1); color: var(--t-1);
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  padding: 10px 12px; font-size: var(--fs-body); font-family: inherit; line-height: var(--lh);
}
.chat-input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(110,168,254,.18); }

/* ════════════════════════ Inspector ════════════════════════ */
.insp { display: flex; flex-direction: column; gap: var(--s-3); }
.insp-head { display: flex; align-items: flex-start; gap: var(--s-2); justify-content: space-between; }
.insp-title { font-size: var(--fs-h3); font-weight: 700; color: var(--t-1); line-height: 1.25; }
.insp-field { display: flex; flex-direction: column; gap: 4px; }
.insp-field > span { font-size: var(--fs-fine); text-transform: uppercase; letter-spacing: .6px; color: var(--t-3); }
.insp-field p { color: var(--t-2); white-space: pre-wrap; word-break: break-word; }
.insp-neighbors { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.nbr {
  font-size: var(--fs-fine); color: var(--t-2);
  background: var(--bg-3); border: 1px solid var(--stroke);
  border-radius: var(--r-pill); padding: 4px 10px; cursor: pointer;
  transition: .14s var(--ease);
}
.nbr:hover { border-color: var(--acc); color: var(--t-1); box-shadow: var(--glow); }
.nbr:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.chat-cites .chip:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.insp-proposals { display: flex; flex-direction: column; gap: var(--s-2); }
.prop {
  display: flex; align-items: center; gap: var(--s-2); justify-content: space-between;
  padding: 8px 10px; background: var(--bg-3);
  border: 1px solid var(--stroke); border-left: 3px solid var(--acc-2);
  border-radius: var(--r-md); font-size: var(--fs-cap); color: var(--t-2);
}
.prop b { color: var(--t-1); font-weight: 600; }
.insp-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ════════════════════════ Memory ════════════════════════ */
.mem-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-3) var(--s-2); }
.mem-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-3); }
.mem-card { border-left: 3px solid var(--t-3); }
.mem-card[data-kind="preference"] { border-left-color: var(--acc-3); }
.mem-card[data-kind="fact"]       { border-left-color: var(--acc); }
.mem-card[data-kind="decision"]   { border-left-color: var(--acc-warn); }
.mem-card[data-kind="note"]       { border-left-color: var(--t-3); }
.mem-card[data-kind="learning"]   { border-left-color: var(--acc-2); }
.mem-card .spread { margin-bottom: var(--s-2); }
.mem-kind {
  font-size: var(--fs-fine); text-transform: uppercase; letter-spacing: .6px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--bg-1); border: 1px solid var(--stroke); color: var(--t-2);
}
.mem-card[data-kind="preference"] .mem-kind { color: var(--acc-3); }
.mem-card[data-kind="fact"]       .mem-kind { color: var(--acc); }
.mem-card[data-kind="decision"]   .mem-kind { color: var(--acc-warn); }
.mem-card[data-kind="learning"]   .mem-kind { color: var(--acc-2); }
.mem-form { padding: var(--s-3); border-top: 1px solid var(--stroke); background: var(--bg-2); }

/* ════════════════════════ Insights ════════════════════════ */
.ins { flex: 1; min-height: 0; overflow: auto; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-5); }
.ins-section { display: flex; flex-direction: column; gap: var(--s-2); }
.ins-h { font-size: var(--fs-fine); text-transform: uppercase; letter-spacing: .8px; color: var(--t-3); font-weight: 700; }
.ins-row { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-cap); color: var(--t-2); }
.ripe {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px var(--s-2);
  padding: 8px 10px; background: var(--bg-3); border: 1px solid var(--stroke);
  border-radius: var(--r-md); cursor: pointer; transition: .14s var(--ease);
}
.ripe:hover { border-color: var(--stroke-strong); }
.ripe-label, .ripe .pair { font-size: var(--fs-cap); color: var(--t-1); }
.ripe-label .muted, .ripe .pair span { color: var(--t-3); margin: 0 4px; }
.ripe .score { font-size: var(--fs-fine); color: var(--acc-2); font-variant-numeric: tabular-nums; }
.ripe-bar { grid-column: 1 / -1; height: 5px; border-radius: var(--r-pill); background: var(--bg-1); overflow: hidden; }
.ripe-bar > i { display: block; height: 100%; background: var(--acc-2); border-radius: inherit; }
.hub-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: 7px 10px; border-radius: var(--r-md); cursor: pointer; transition: .14s var(--ease);
  font-size: var(--fs-cap); color: var(--t-2);
}
.hub-row:hover { background: var(--bg-3); color: var(--t-1); }
.hub-title { color: var(--t-1); font-weight: 500; }
.hub-row .metric { font-size: var(--fs-fine); color: var(--acc); font-variant-numeric: tabular-nums; }
.comm-chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.gap-row { justify-content: space-between; background: var(--bg-3); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 8px 10px; }
.gap-row:hover { border-color: var(--stroke-strong); }

/* ════════════════════════ Telemetry ════════════════════════ */
.telemetry {
  position: absolute; bottom: var(--s-3); left: var(--s-3); z-index: 5;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--bg-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--stroke); box-shadow: var(--sh-1);
  font-size: var(--fs-fine); color: var(--t-3); pointer-events: none;
}
.tm-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tm-item b { color: var(--t-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.tm-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc-2); box-shadow: 0 0 6px var(--acc-2); }

/* ════════════════════════ Mobile ════════════════════════ */
@media (max-width: 860px) {
  .chat-msg { max-width: 92%; }
  .chat-msgs, .mem-list, .ins { padding: var(--s-3); }
  .telemetry { bottom: var(--s-2); left: var(--s-2); gap: var(--s-2); padding: 4px 10px; }
  .telemetry .tm-item:nth-child(n+3) { display: none; }
  .insp-actions .btn-primary, .insp-actions .btn-soft, .insp-actions .btn-ghost { flex: 1; justify-content: center; }
}
