/* styles.css — Emabel Finanzas.
   Shell (topbar + sidebar colapsable) tomado del mismo lenguaje visual que SuperAdmin
   (workers/sadm/src/index.js, bloque "SHELL EMABEL v1"): tema oscuro, acento naranja,
   sidebar de 56px que se expande al hover, breakpoint a barra inferior en móvil. */

:root {
  color-scheme: dark;
  --acc: #fb923c;
  --acc-soft: #fdba74;
  --bg: #0c0c0e;
  --bg2: #121215;
  --panel: #16161a;
  --panel2: #121215;
  --border: #2a2a30;
  --border-soft: #222226;
  --text: #eef2f6;
  --muted: #9a9aa2;
  --muted2: #6f6f78;
  --verde: #86efac;
  --rojo: #f87171;
  --sb: 56px;
  --sb-open: 208px;
  --topbar: 48px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; }
.hidden { display: none !important; }
button { font: inherit; }

/* ---------- topbar ---------- */
.top {
  display: flex; align-items: center; gap: 10px; height: var(--topbar);
  padding: 0 16px 0 0; border-bottom: 1px solid var(--border-soft);
  position: fixed; top: 0; left: 0; right: 0; background: var(--bg2); z-index: 30;
}
.top .marca { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }
.top .marca .cubo {
  width: var(--sb); height: var(--topbar);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.top .marca .cubo svg { width: 22px; height: 22px; display: block; }
.top .marca .rot { display: flex; flex-direction: column; line-height: 1.15; }
.top .marca .rot b { font-size: 13.5px; font-weight: 700; letter-spacing: .2px; color: var(--text); }
.top .sub { font-size: 10.5px; color: var(--muted2); font-weight: 500; letter-spacing: .1px; }
.top .sp { flex: 1; }
.top .who { font-size: 12px; color: var(--muted); margin-right: 12px; }

/* ---------- sidebar ---------- */
.sb {
  position: fixed; top: var(--topbar); left: 0; bottom: 0; width: var(--sb);
  background: var(--bg2); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 8px 0; z-index: 40;
  transition: width .16s ease; overflow: hidden;
}
.sb:hover { width: var(--sb-open); box-shadow: 14px 0 40px -14px #000c; }
.sb-item {
  display: flex; align-items: center; gap: 0; height: 38px; margin: 1px 8px; padding: 0;
  border-radius: 8px; cursor: pointer; color: var(--muted); border: 0; background: transparent;
  width: calc(100% - 16px); text-align: left; transition: background .12s, color .12s; white-space: nowrap;
  text-decoration: none;
}
.sb-item .ic { width: 40px; flex: 0 0 40px; display: flex; align-items: center; justify-content: center; }
.sb-item .ic svg { width: 17px; height: 17px; display: block; }
.sb-item .tx { font-size: 13px; font-weight: 500; opacity: 0; transition: opacity .13s; pointer-events: none; }
.sb:hover .sb-item .tx { opacity: 1; }
.sb-item:hover { background: #ffffff0a; color: var(--text); }
.sb-item.activo { background: #fb923c14; color: var(--acc-soft); }
.sb-item.activo .tx { font-weight: 600; }
.sb-sep { height: 1px; background: var(--border-soft); margin: 8px 12px; }
.sb-sp { flex: 1; }

/* ---------- área de contenido ---------- */
/* Patricio, criterio de diseño para apps internas (09-sep-2026): la app ocupa TODA la
   pantalla, sin franjas laterales vacías ni contenedores centrados con márgenes muertos.
   El contenido se estira al ancho disponible; las grillas de tarjetas/tablas hacen el
   trabajo de no verse gigantes en pantallas anchas (auto-fill con minmax). */
.shell { padding-left: var(--sb); padding-top: var(--topbar); }
.wrap { width: 100%; padding: 0 28px 90px; min-width: 0; }

@media (max-width: 720px) {
  .sb {
    top: auto; bottom: 0; right: 0; width: 100%; height: 56px; flex-direction: row;
    border-right: 0; border-top: 1px solid var(--border-soft); padding: 0;
    justify-content: space-around; overflow-x: auto;
  }
  .sb:hover { width: 100%; box-shadow: none; }
  .sb-item { flex-direction: column; justify-content: center; gap: 2px; height: 100%; margin: 0; width: auto; flex: 1 0 auto; padding: 0 6px; }
  .sb-item .ic { width: auto; flex: none; }
  .sb-item .ic svg { width: 18px; height: 18px; }
  .sb-item .tx { opacity: 1; font-size: 9px; }
  .sb-sep, .sb-sp { display: none; }
  .shell { padding-left: 0; padding-bottom: 56px; }
  .wrap { padding: 0 14px 40px; }
  .top { padding: 0 12px; }
  .top .who { display: none; }
  .top .marca .rot { display: none; }
  .top .marca .cubo { width: 40px; }
}

/* ---------- botón hamburguesa (móvil, abre/cierra menú si hiciera falta) ---------- */
.btn-ghost {
  appearance: none; background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-size: 12.5px; padding: 7px 13px; border-radius: 8px; cursor: pointer; transition: .15s;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: #fb923c66; color: var(--acc-soft); background: #fb923c0f; }
.btn-primario {
  appearance: none; background: linear-gradient(180deg, #fdaa5c, #fb923c); border: 0; color: #1a0e02;
  font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 9px; cursor: pointer; transition: .15s;
}
.btn-primario:hover { filter: brightness(1.06); }
.btn-primario:disabled { opacity: .5; cursor: default; }

/* ---------- login ---------- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-card {
  width: 100%; max-width: 380px; background: linear-gradient(180deg, #1b1b20f2, #121215f5);
  border: 1px solid #ffffff10; border-radius: 24px; padding: 40px 32px;
  box-shadow: 0 30px 80px -24px #000c; text-align: center;
}
.login-card .cubo-login { width: 44px; height: 44px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center; }
.login-card .cubo-login svg { width: 30px; height: 30px; }
.login-card h1 { font-size: 19px; margin: 0 0 6px; font-weight: 700; }
.login-card .muted { color: var(--muted); font-size: 13.5px; margin: 0 0 26px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px;
  background: #1a1a1e; border: 1px solid #33333a; border-radius: 10px; color: #eef2f6; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: .15s; text-decoration: none; box-sizing: border-box;
}
.btn-google:hover { border-color: #4b4b54; background: #202024; }
.err { color: var(--rojo); font-size: 12.5px; margin-top: 16px; min-height: 14px; font-weight: 500; }
.privada-card { text-align: center; }
.privada-card p { color: var(--muted); font-size: 14px; margin: 8px 0 24px; }

/* ---------- hero de sección ---------- */
.hero { padding: 34px 0 6px; }
.hero h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; letter-spacing: -.35px; }
.hero p { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- tarjetas resumen ---------- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 20px 0; }
.tarjeta { border: 1px solid var(--border); border-radius: 13px; background: var(--panel2); padding: 17px 16px; }
.tarjeta .tt { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted2); font-weight: 700; margin: 0 0 8px; }
.tarjeta .vv { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -.4px; }
.tarjeta .vv.acc { color: var(--acc-soft); }
.tarjeta .vv.verde { color: var(--verde); }
.tarjeta .sub { font-size: 11.5px; color: var(--muted2); margin-top: 6px; }

/* ---------- secciones / bloques ---------- */
.bloque { margin: 30px 0; }
.bloque h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--text); }
.bloque .bloque-sub { font-size: 12.5px; color: var(--muted); margin: -8px 0 14px; }

/* ---------- tablas ---------- */
.tabla-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted2); font-weight: 700; padding: 11px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #ffffff05; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* fila chica de desglose de pago debajo de un documento (ver filasPagosDeDocumento) */
tr.fila-pago-doc td { padding: 6px 13px 6px 26px; font-size: 12px; background: #ffffff03; }
tr.fila-pago-doc td.sub-detalle { color: var(--muted); }

/* ---------- chips de estado ---------- */
.chip { font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; display: inline-block; }
.chip.pagada { background: #14331f; color: var(--verde); }
.chip.saldo { background: #2c2410; color: #fbbf24; }
.chip.pendiente { background: #331414; color: var(--rojo); }
.chip.vigente { background: #14331f; color: var(--verde); }
.chip.pausado { background: #232328; color: var(--muted); }
.chip.terminado { background: #1c1c21; color: var(--muted2); }
.chip.por_definir { background: #2c2410; color: #fbbf24; }
.chip.confirmar { background: #2c2410; color: #fbbf24; }
.chip.condonado { background: #232328; color: var(--muted); }
.chip.consideracion { background: #1c2430; color: #93c5fd; }

/* ---------- estado vacío ---------- */
.vacio { text-align: center; padding: 46px 20px; color: var(--muted); font-size: 13.5px; }
.vacio .ic-vacio { font-size: 26px; margin-bottom: 10px; opacity: .5; }

/* ---------- tarjetas de clientes ---------- */
.clientes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 18px 0; }
.cliente-card { border: 1px solid var(--border); border-radius: 14px; background: var(--panel2); padding: 18px; }
.cliente-card .cc-avatar {
  width: 34px; height: 34px; border-radius: 9px; margin-bottom: 11px; background: #fb923c1f;
  color: var(--acc-soft); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.cliente-card .cc-name { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cliente-card .cc-considera { font-weight: 700; text-decoration: none; }
.cliente-card .cc-sub { font-size: 12px; color: var(--muted2); margin-bottom: 14px; }
.cliente-card .cc-fila { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 5px 0; border-top: 1px solid var(--border-soft); }
.cliente-card .cc-fila b { color: var(--text); font-weight: 600; }
.cliente-card .cc-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.cliente-card .cc-acciones a, .cliente-card .cc-acciones button { flex: 1 1 auto; text-align: center; }

/* ---------- modal simple ---------- */
.modal-fondo {
  position: fixed; inset: 0; background: #000a; z-index: 80; display: flex; align-items: center;
  justify-content: center; padding: 20px;
}
.modal-fondo.hidden { display: none; }
.modal-caja { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.modal-caja h3 { margin: 0 0 12px; font-size: 15px; }
.modal-caja textarea {
  width: 100%; min-height: 130px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 13px; padding: 12px; resize: vertical; font-family: inherit; line-height: 1.5;
}
.modal-acciones { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* ---------- formulario nota ---------- */
.form-nota { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.form-nota textarea {
  width: 100%; min-height: 80px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 13.5px; padding: 12px; resize: vertical; font-family: inherit; line-height: 1.5;
}

/* ---------- filtros (facturas/pagos) ---------- */
.filtros { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.filtros select, .filtros input {
  padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  color: #fff; font-size: 13.5px;
}

/* ---------- gráfico de barras SVG ---------- */
.grafico-wrap { border: 1px solid var(--border); border-radius: 13px; background: var(--panel2); padding: 20px; }
.grafico-wrap svg { display: block; width: 100%; height: auto; }
.grafico-eje { font-size: 10px; fill: var(--muted2); }
.grafico-valor { font-size: 10.5px; fill: var(--muted); font-weight: 600; }

/* ---------- detalle de cliente: encabezado ---------- */
.cliente-encabezado { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cliente-encabezado .ce-avatar {
  width: 46px; height: 46px; border-radius: 12px; background: #fb923c1f; color: var(--acc-soft);
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex: 0 0 auto;
}
.cliente-encabezado h1 { font-size: 19px; margin: 0; }
.cliente-encabezado .ce-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.decision-item { border-top: 1px solid var(--border-soft); padding: 12px 0; }
.decision-item:first-child { border-top: 0; }
.decision-item .di-fecha { font-size: 11px; color: var(--muted2); font-weight: 600; margin-bottom: 3px; }
.decision-item .di-texto { font-size: 13.5px; color: var(--text); }
.decision-item .di-fuente { font-size: 11px; color: var(--muted2); margin-top: 3px; font-style: italic; }

.propuesta-item { border: 1px solid #fbbf2440; background: #2c241012; border-radius: 11px; padding: 13px 15px; margin-bottom: 10px; }
.propuesta-item .pi-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.propuesta-item .pi-monto { font-size: 15px; font-weight: 700; color: #fbbf24; }
.propuesta-item .pi-detalle { font-size: 12px; color: var(--muted); margin-top: 4px; }

.equipo-placeholder { text-align: center; padding: 70px 20px; color: var(--muted); }
.equipo-placeholder .ep-ic { font-size: 30px; margin-bottom: 14px; opacity: .5; }
.equipo-placeholder h2 { font-size: 16px; color: var(--text); margin: 0 0 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel);
  border: 1px solid var(--border); color: var(--text); padding: 11px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 14px 34px -14px #000d; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.mostrar { opacity: 1; transform: translateX(-50%) translateY(-6px); }

@media (max-width: 480px) {
  .tarjetas { grid-template-columns: 1fr 1fr; }
  .clientes-grid { grid-template-columns: 1fr; }
}
