/* ─────────────────────────────────────────────────────────────────────────────
   [S43] El shell de MyFit en tema oscuro, en HTML, para /home/ver3.
   Una sola hoja para dos usos, así el hero y las vistas son el mismo producto:
   · las maquetas de captura (ejecucion/proforma/estados.html, 1600×900), que
     render.mjs convierte en las WebP de ../img/ y NO se publican;
   · el marco del hero de index.html (.mf-app.frame), que SÍ carga esta hoja.
   Todo va scopeado a .mf-app, como en la app real, para no tocar el sitio.
   Copian la ESTRUCTURA del shell v2 (rail, topbar, contenido, panel) y de las
   pantallas reales; los datos son ficticios.
   Valores: mf/_tokens.scss, bloque [data-mf-theme="dark"]. Cada literal lleva
   su excepción del gate de tokens (R1 mira también .css).
   ───────────────────────────────────────────────────────────────────────────── */

@font-face { font-family: "Geist"; src: url("/assets/fonts/geist/Geist-Regular.woff2") format("woff2"); font-weight: 400; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist/Geist-Medium.woff2") format("woff2"); font-weight: 500; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist/Geist-SemiBold.woff2") format("woff2"); font-weight: 600; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/geist/GeistMono-Regular.woff2") format("woff2"); font-weight: 400; }

.mf-app {
  --surface: #16181C;            /* gate-tokens: ok maqueta estática: --mf-surface (oscuro) */
  --surface-subtle: #1D2025;     /* gate-tokens: ok maqueta estática: --mf-surface-subtle (oscuro) */
  --surface-sunken: #101216;     /* gate-tokens: ok maqueta estática: --mf-surface-sunken (oscuro) */
  --hair: rgba(255, 255, 255, 0.10);        /* gate-tokens: ok maqueta estática: --mf-hair (oscuro) */
  --hair-strong: rgba(255, 255, 255, 0.16); /* gate-tokens: ok maqueta estática: --mf-hair-strong (oscuro) */
  --row-hair: rgba(255, 255, 255, 0.07);    /* gate-tokens: ok maqueta estática: --mf-row-hair (oscuro) */
  --col-hair: rgba(255, 255, 255, 0.11);    /* gate-tokens: ok maqueta estática: --mf-col-hair (oscuro) */
  --text: #F2F3F5;               /* gate-tokens: ok maqueta estática: --mf-text (oscuro) */
  --text-secondary: #A8AEB8;     /* gate-tokens: ok maqueta estática: --mf-text-secondary (oscuro) */
  --text-tertiary: #8C939E;      /* gate-tokens: ok maqueta estática: --mf-text-tertiary (oscuro) */
  --text-muted: #767D88;         /* gate-tokens: ok maqueta estática: --mf-text-muted (oscuro) */
  --accent: #6BA3EC;             /* gate-tokens: ok maqueta estática: --mf-accent (oscuro, brand-300) */
  --accent-soft: rgba(21, 87, 184, 0.18);   /* gate-tokens: ok maqueta estática: --mf-accent-soft (oscuro) */
  --on-accent: #051A3A;          /* gate-tokens: ok maqueta estática: --mf-on-accent (oscuro, brand-900) */
  --success: #35B36C;            /* gate-tokens: ok maqueta estática: --mf-success (oscuro) */
  --bg-success: rgba(53, 179, 108, 0.16);   /* gate-tokens: ok maqueta estática: --mf-bg-success (oscuro) */
  --warning: #D9A441;            /* gate-tokens: ok maqueta estática: --mf-warning (oscuro) */
  --danger: #E88071;             /* gate-tokens: ok maqueta estática: --mf-danger (oscuro) */
  --bg-danger: rgba(229, 112, 95, 0.16);    /* gate-tokens: ok maqueta estática: --mf-bg-danger (oscuro) */
  --teal: #4DDDE3;               /* gate-tokens: ok maqueta estática: --mf-chat-accent (oscuro, teal-300) */
  --chat-soft: rgba(0, 168, 175, 0.16);     /* gate-tokens: ok maqueta estática: --mf-chat-soft (oscuro) */
  --font: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}

.mf-app, .mf-app * { box-sizing: border-box; }

.mf-app { background: var(--surface-subtle); color: var(--text); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
.mf-app :is(p, h1, h2, h3, ul) { margin: 0; }
.mf-app ul { padding: 0; list-style: none; }
.mf-app .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mf-app .neg { color: var(--danger); }
.mf-app .pos { color: var(--success); }
.mf-app .muted { color: var(--text-tertiary); }
.mf-app svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ── Shell v2: rail 64 · topbar 56 · contenido · chat 380 ─────────────────── */
.mf-app .shell { display: grid; grid-template-columns: 64px minmax(0, 1fr) var(--chat-w, 0px); grid-template-rows: 56px minmax(0, 1fr); grid-template-areas: "rail topbar topbar" "rail content chat"; height: 900px; }
.mf-app .rail { grid-area: rail; background: var(--surface); border-right: 1px solid var(--hair); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; }
.mf-app .rail-logo { width: 32px; height: 32px; margin-bottom: 12px; border-radius: 8px; }
.mf-app .rail a { display: flex; align-items: center; justify-content: center; width: 44px; height: 40px; border-radius: 6px; color: var(--text-secondary); }
.mf-app .rail a.on { background: var(--accent-soft); color: var(--accent); }
.mf-app .topbar { grid-area: topbar; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--hair); }
.mf-app .tb-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; color: var(--text-secondary); }
.mf-app .company { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px; font-size: 16px; font-weight: 600; }
.mf-app .company .logo { width: 24px; height: 24px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.mf-app .company svg.i { width: 16px; height: 16px; color: var(--text-muted); }
.mf-app .divider { width: 1px; height: 20px; background: var(--hair-strong); margin: 0 4px; }
.mf-app .create { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 500; }
.mf-app .create svg.i { width: 16px; height: 16px; stroke-width: 2; }
.mf-app .spacer { flex: 1; }
.mf-app .lang { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--text-secondary); padding: 0 8px; }
.mf-app .user { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding-left: 4px; }
.mf-app .avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-subtle); border: 1px solid var(--hair-strong); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.mf-app .content { grid-area: content; padding: 24px; overflow: hidden; display: flex; flex-direction: column; gap: 16px; }

/* ── Encabezado de pantalla ─────────────────────────────────────────────────── */
.mf-app .ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.mf-app .back { font-size: 12px; color: var(--text-muted); }
.mf-app .overline { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.mf-app .ph h1 { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.mf-app .badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 9999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.mf-app .badge.ok { background: var(--bg-success); color: var(--success); }
.mf-app .field { display: flex; flex-direction: column; gap: 4px; }
.mf-app .field label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.mf-app .control { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: 32px; padding: 0 10px; min-width: 150px; border-radius: 6px; background: var(--surface-sunken); border: 1px solid var(--hair-strong); font-size: 13px; }
.mf-app .btn-outline { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--accent); color: var(--accent); font-size: 13px; font-weight: 500; }
.mf-app .toolbar { display: flex; align-items: flex-end; gap: 16px; }

/* ── Tarjetas y KPI ─────────────────────────────────────────────────────────── */
.mf-app .kpis { display: grid; grid-template-columns: repeat(var(--kpi-cols, 4), minmax(0, 1fr)); gap: 12px; }
.mf-app .kpi { background: var(--surface); border: 1px solid var(--hair); border-radius: 8px; padding: 12px 16px; }
.mf-app .kpi.hero { border-left: 3px solid var(--accent); }
.mf-app .kpi .v { margin-top: 4px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mf-app .kpi .s { margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.mf-app .panel { background: var(--surface); border: 1px solid var(--hair); border-radius: 8px; overflow: hidden; }
.mf-app .panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.mf-app .panel-h h2 { font-size: 16px; font-weight: 600; }
.mf-app .seg { display: inline-flex; border: 1px solid var(--hair-strong); border-radius: 6px; overflow: hidden; }
.mf-app .seg span { padding: 4px 12px; font-size: 12px; color: var(--text-secondary); border-right: 1px solid var(--hair-strong); }
.mf-app .seg span:last-child { border-right: 0; }
.mf-app .seg span.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* ── Tabla (contrato journal-entries: una sola regla vertical, sin zebra) ──── */
.mf-app table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.mf-app table.t th { height: 30px; padding: 0 12px; text-align: right; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-subtle); border-bottom: 1px solid var(--hair-strong); white-space: nowrap; }
.mf-app table.t th:first-child, .mf-app table.t td:first-child { text-align: left; }
.mf-app table.t td { height: 30px; padding: 0 12px; text-align: right; border-bottom: 1px solid var(--row-hair); }
.mf-app table.t .rule { border-left: 1px solid var(--col-hair); }
.mf-app table.t tr.total td { font-weight: 600; background: var(--surface-subtle); border-top: 1px solid var(--hair-strong); }
.mf-app table.t tr.sub td { font-weight: 600; }
.mf-app table.t tr.flag td { background: var(--bg-danger); }
.mf-app table.t .lvl1 { padding-left: 30px; }
.mf-app table.t .sec td { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: var(--surface-subtle); }

/* ── Panel de chat (sección 06 del contrato) ───────────────────────────────── */
.mf-app .chat { grid-area: chat; background: var(--surface); border-left: 1px solid var(--hair); display: flex; flex-direction: column; }
.mf-app .chat-h { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--hair); font-size: 13px; font-weight: 600; }
.mf-app .chat-h .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.mf-app .chat-h .co { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.mf-app .chat-ctx { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.mf-app .chip { height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-subtle); border: 1px solid var(--hair); font-size: 11px; color: var(--text-secondary); display: inline-flex; align-items: center; }
.mf-app .chat-b { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 16px; font-size: 13px; line-height: 1.55; }
.mf-app .msg-u { align-self: flex-end; max-width: 85%; padding: 8px 12px; border-radius: 12px 12px 4px 12px; background: var(--accent-soft); }
.mf-app .msg-a .who { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.mf-app .chat-in { margin: 0 16px 16px; height: 40px; border: 1px solid var(--hair-strong); border-radius: 8px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-muted); background: var(--surface-sunken); }

/* ── Marco del hero de /home/ver3: el mismo shell a ancho de contenedor y alto natural ── */
.mf-app.frame {
  --frame-shadow: 0 32px 64px -40px rgba(10, 49, 106, 0.45); /* gate-tokens: ok marco del hero: sombra del objeto sobre la página clara */
  border: 1px solid var(--hair-strong);
  border-radius: 12px;
  box-shadow: var(--frame-shadow);
  overflow: hidden;
  text-align: left;
}
.mf-app.frame .num { font-family: var(--mono); }
.mf-app.frame svg.i { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.mf-app.frame .shell { height: auto; grid-template-columns: 56px minmax(0, 55fr) minmax(0, 45fr); grid-template-rows: 52px auto; }
.mf-app.frame .rail { padding: 10px 8px; gap: 2px; }
.mf-app.frame .rail-logo { width: 28px; height: 28px; margin-bottom: 8px; }
.mf-app.frame .ri { display: flex; align-items: center; justify-content: center; width: 40px; height: 36px; border-radius: 6px; color: var(--text-secondary); }
.mf-app.frame .ri.on { background: var(--accent-soft); color: var(--accent); }
.mf-app.frame .topbar { padding: 0 14px; }
.mf-app.frame .company { font-size: 15px; }
.mf-app.frame .company svg.i, .mf-app.frame .create svg.i { width: 16px; height: 16px; }
.mf-app.frame .content { padding: 20px; gap: 14px; overflow: visible; min-width: 0; }
.mf-app.frame .inv-title { font-size: 18px; font-weight: 600; }
.mf-app.frame .sub2 { margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.mf-app.frame .kpi { padding: 10px 14px; }
.mf-app.frame .kpi .v { font-size: 22px; }
.mf-app.frame .tabs { display: flex; gap: 0; padding: 0 6px; border-bottom: 1px solid var(--hair); }
.mf-app.frame .tabs span { padding: 9px 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; white-space: nowrap; }
.mf-app.frame .tabs span.on { color: var(--text); border-bottom-color: var(--accent); }
.mf-app.frame .tabs .num { margin-left: 2px; color: var(--text-muted); }
.mf-app.frame table.inv { font-size: 12px; table-layout: fixed; }
.mf-app.frame table.inv th, .mf-app.frame table.inv td { text-align: left; padding: 0 6px; }
.mf-app.frame table.inv th { height: 34px; white-space: normal; line-height: 1.15; }
.mf-app.frame table.inv td { height: 40px; line-height: 1.3; }
/* El marco nunca pasa de ~1000 px lógicos (a ≤ 1100 px va a ancho completo; arriba,
   escalado al 80 % junto al texto): la tabla deja la fecha de emisión —la que cruza
   con el asistente es la del pago, que va en Estado— y parte proveedor y estado. */
.mf-app.frame table.inv th:nth-child(1), .mf-app.frame table.inv td:nth-child(1) { display: none; }
.mf-app.frame table.inv th:nth-child(2) { width: 22%; }
.mf-app.frame table.inv th:nth-child(3) { width: 21%; }
.mf-app.frame table.inv th:nth-child(4) { width: 16%; }
.mf-app.frame table.inv th:nth-child(5) { width: 20%; }
.mf-app.frame table.inv th:nth-child(6) { width: 21%; }
.mf-app.frame table.inv .r { text-align: right; }
.mf-app.frame table.inv td:nth-child(2) { padding-left: 14px; }
.mf-app.frame table.inv tr.new td { background: var(--accent-soft); }
.mf-app.frame table.inv tr.new td:nth-child(2) { box-shadow: inset 2px 0 0 var(--accent); }
.mf-app.frame .st { display: inline-flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.mf-app.frame .st i { flex-shrink: 0; width: 5px; height: 5px; margin-top: 6px; border-radius: 50%; background: var(--text-muted); }
.mf-app.frame .st-sched i { background: var(--accent); }
.mf-app.frame .st-pend i { background: var(--warning); }
.mf-app.frame .st-paid i { background: var(--success); }
.mf-app.frame tr.new .st { color: var(--text); }
.mf-app.frame .chat { min-width: 0; }
.mf-app.frame .as-h { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--hair); }
.mf-app.frame .as-title { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; }
.mf-app.frame .online { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.mf-app.frame .online i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.mf-app.frame .mode { display: inline-flex; align-items: center; height: 22px; margin-left: auto; padding: 0 9px; border-radius: 9999px; background: var(--chat-soft); color: var(--teal); font-size: 11px; font-weight: 600; white-space: nowrap; }
.mf-app.frame .as-bar { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.mf-app.frame .as-new { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--hair-strong); font-size: 12px; white-space: nowrap; }
.mf-app.frame .as-search { flex: 1; display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--surface-sunken); border: 1px solid var(--hair); font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.mf-app.frame .as-bar svg.i { width: 16px; height: 16px; }
.mf-app.frame .as-ctx { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.mf-app.frame .chat-b { gap: 12px; padding: 14px 16px; }
.mf-app.frame .trace { margin-top: 6px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--text-secondary); }
.mf-app.frame .trace svg.chk { width: 13px; height: 13px; color: var(--teal); vertical-align: -2px; }
.mf-app.frame .chat-in { margin: 0 16px 16px; }
.mf-app.frame .send { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: var(--on-accent); }
.mf-app.frame .send svg.i { width: 16px; height: 16px; }

/* Móvil: sólo topbar y asistente, a ancho completo. */
@media (max-width: 860px) {
  .mf-app.frame .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "topbar" "chat"; }
  .mf-app.frame .rail, .mf-app.frame .content, .mf-app.frame .tb-menu, .mf-app.frame .divider, .mf-app.frame .user-name, .mf-app.frame .company .logo { display: none; }
  .mf-app.frame .topbar { gap: 6px; padding: 0 10px; }
  .mf-app.frame .company { font-size: 14px; padding: 0 2px; white-space: nowrap; }
}
