/* client/src/styles/v218.css — v2.18 Lienzo de dibujo (vista CAD, interpretación, pantalla completa) · v2.20 Conexiones de IA */

/* ── Lienzo y herramientas ───────────────────────────────────────── */
.fn-sketch { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* el lienzo (4:3) nunca más alto que la pantalla: en un teléfono acostado cabe entero */
.fn-sketch .fn-canvas-wrap {
  width: min(100%, calc((100dvh - 150px) * 4 / 3));
  min-width: min(100%, 260px);
  margin-inline: auto;
}
.fn-sketch-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fn-sketch-tools .btn { padding: 4px 10px; min-height: 32px; font-size: 12.5px; }
.fn-sketch-tools .fn-chip { padding: 5px 11px; font-size: 12.5px; }

/* ── Barra de interpretación (lo que el sistema entendió) ───────── */
.fn-interp {
  display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center;
  min-height: 34px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 12.5px; line-height: 1.35;
  overflow-wrap: anywhere; min-width: 0;
}
.fn-interp-title { font-weight: 650; font-size: 13.5px; margin-right: 2px; }
.fn-interp-item {
  padding: 1px 8px; border-radius: 999px;
  background: var(--bg-alt, var(--bg)); color: var(--text);
  border: 1px solid var(--border);
}
.fn-interp-hint { color: var(--text-muted); }

/* ── Vista CAD encima de la tinta ───────────────────────────────── */
.fn-sketch-live .fn-clean line, .fn-sketch-live .fn-clean path,
.fn-sketch-live .fn-clean polyline, .fn-sketch-live .fn-clean rect {
  stroke: var(--accent3); stroke-width: 3.5; fill: none; opacity: .95;
  stroke-linecap: round; stroke-linejoin: round;
}
.fn-clean text {
  fill: var(--accent3); stroke: none;
  font-family: system-ui, "Segoe UI", Arial, sans-serif; font-weight: 600;
  pointer-events: none;
}
/* etiqueta junto a cada palabra o medida leída */
.fn-sketch-live .fn-clean .fn-read rect { fill: var(--surface); stroke: var(--accent3); stroke-width: 2; opacity: .96; }
.fn-sketch-live .fn-clean .fn-read text { fill: var(--text); font-weight: 600; }
.fn-sketch-live .fn-canvas:has(.fn-clean > *) .fn-ink path { opacity: .3; }

/* ── Pantalla completa (todo el espacio para dibujar) ───────────── */
.fn-sketch.is-full {
  position: fixed; inset: 0; z-index: 1150;
  background: var(--bg); padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  justify-content: center; gap: 8px;
}
.fn-sketch.is-full .fn-canvas-wrap { width: min(100%, calc((100dvh - 128px) * 4 / 3)); }
.fn-sketch.is-full .fn-sketch-tools { justify-content: center; }
body.fn-sketch-open { overflow: hidden; }
/* teléfono acostado: lienzo a la izquierda, texto y herramientas en una columna a la derecha */
@media (orientation: landscape) and (max-height: 520px) {
  .fn-sketch.is-full {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 30%);
    grid-template-rows: auto minmax(0, 1fr); align-content: center; column-gap: 10px;
  }
  .fn-sketch.is-full .fn-canvas-wrap { grid-column: 1; grid-row: 1 / span 2; align-self: center; width: min(100%, calc((100dvh - 16px) * 4 / 3)); }
  .fn-sketch.is-full .fn-interp { grid-column: 2; grid-row: 1; max-height: 52dvh; overflow-y: auto; align-content: flex-start; }
  .fn-sketch.is-full .fn-sketch-tools { grid-column: 2; grid-row: 2; justify-content: flex-start; align-content: flex-start; }
}

/* ── Notas del ventanero: el lienzo se lleva el espacio ─────────── */
@media (min-width: 1024px) {
  .fn-editor.fn-editor-draw { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
}

/* ── v2.20: «Conexiones de IA» en Usuarios del sistema ─────────────── */
.oc-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.oc-intro, .oc-note { margin: 0 0 4px; font-size: 13px; color: var(--text-muted); overflow-wrap: break-word; }
.oc-note { padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; }
.oc-row {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.oc-main { flex: 1 1 220px; min-width: 0; }
.oc-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.oc-meta { font-size: 12.5px; color: var(--text-muted); overflow-wrap: break-word; }
