/* Campo OS — hoja de estilos única, pensada primero para el celular.

   Identidad: verde de potrero oscuro arriba, fondo crudo como papel de
   libreta de campo, dorado de trigo para lo que hay que tocar. Números
   grandes en Barlow Semi Condensed (se leen de un vistazo, al sol), el
   texto en Source Sans 3. */

:root {
  --verde: #1f3d2b;
  --verde-2: #2c5239;
  --verde-claro: #3f7a4f;
  --trigo: #c8962e;
  --trigo-claro: #e0b046;
  --trigo-bg: #f6ecd2;
  --hacienda: #8a5a3b;
  --agro: #5b8c3a;

  --marca-fondo: var(--verde);
  --marca-sol: var(--trigo-claro);
  --marca-surco: #9fd08a;

  --ok: #2f7d4a;
  --atencion: #b8820f;
  --critico: #c0433d;

  --texto: #1d2420;
  --texto-suave: #66706a;
  --linea: #e2e0d6;
  --fondo: #f3f1ea;
  --panel: #fffefa;
  --fondo-suave: #e9e6dc;

  --critico-bg: #fbe8e5;
  --critico-texto: #93302b;
  --atencion-bg: #fbf0d6;
  --atencion-texto: #73520b;
  --ok-bg: #e2f0e4;
  --ok-texto: #23603a;
  --info-bg: #e3eee6;
  --info-texto: #24513a;

  --f-num: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-texto: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --sombra: 0 1px 2px rgba(31, 61, 43, .06), 0 4px 14px rgba(31, 61, 43, .06);
  --sombra-alta: 0 8px 28px rgba(31, 61, 43, .18);
  --alto-tabbar: 66px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --verde-claro: #7cc08e;
    --trigo: #e0b046;
    --trigo-bg: rgba(224, 176, 70, .14);
    --hacienda: #c08a64;
    --agro: #8cc26a;
    --texto: #ecefe9;
    --texto-suave: #a3ada6;
    --linea: #2f3832;
    --fondo: #121714;
    --panel: #1b221d;
    --fondo-suave: #263029;
    --critico-bg: rgba(224, 96, 90, .16);
    --critico-texto: #ffa29c;
    --atencion-bg: rgba(224, 176, 70, .15);
    --atencion-texto: #f0cf80;
    --ok-bg: rgba(90, 170, 110, .16);
    --ok-texto: #9fd8ac;
    --info-bg: rgba(124, 192, 142, .14);
    --info-texto: #a9dcb6;
    --ok: #6cc28a;
    --critico: #ec7a73;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
    --sombra-alta: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --verde-claro: #7cc08e;
  --trigo: #e0b046;
  --trigo-bg: rgba(224, 176, 70, .14);
  --hacienda: #c08a64;
  --agro: #8cc26a;
  --texto: #ecefe9;
  --texto-suave: #a3ada6;
  --linea: #2f3832;
  --fondo: #121714;
  --panel: #1b221d;
  --fondo-suave: #263029;
  --critico-bg: rgba(224, 96, 90, .16);
  --critico-texto: #ffa29c;
  --atencion-bg: rgba(224, 176, 70, .15);
  --atencion-texto: #f0cf80;
  --ok-bg: rgba(90, 170, 110, .16);
  --ok-texto: #9fd8ac;
  --info-bg: rgba(124, 192, 142, .14);
  --info-texto: #a9dcb6;
  --ok: #6cc28a;
  --critico: #ec7a73;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
  --sombra-alta: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--f-texto);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
body { overscroll-behavior-y: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.005em; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--verde-claro); }
:focus-visible { outline: 2px solid var(--trigo); outline-offset: 2px; }

.ico { width: 22px; height: 22px; flex: none; display: block; }
.marca { width: 100%; height: 100%; display: block; }

.app { max-width: 760px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ---------- barra de arriba ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px 16px;
  background: var(--verde); color: #f3f6ef;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.topbar__btn {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .08); color: inherit; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.topbar__btn:hover { background: rgba(255, 255, 255, .16); }
.topbar__marca { width: 34px; height: 34px; flex: none; --marca-fondo: rgba(255, 255, 255, .1); }
.topbar__titles { flex: 1; min-width: 0; }
.topbar__title { font-family: var(--f-num); font-size: 21px; font-weight: 600; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__sub { font-size: 12.5px; color: rgba(243, 246, 239, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.banda {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 8px 16px; background: var(--trigo-bg); color: var(--atencion-texto); font-size: 14px;
}
.banda button { border: 0; background: var(--panel); color: var(--texto); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 13px; cursor: pointer; flex: none; }

.view { padding: 16px 16px calc(var(--alto-tabbar) + 40px + env(safe-area-inset-bottom)); outline: none; }

/* ---------- barra de secciones y botón central ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: stretch; justify-content: space-around;
  height: calc(var(--alto-tabbar) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--linea);
}
.tabbar__item {
  flex: 1; min-width: 0; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11.5px; font-weight: 600; color: var(--texto-suave); padding: 0;
}
.ico-caja { display: flex; align-items: center; justify-content: center; width: 48px; height: 28px; border-radius: 999px; transition: background .15s; }
.tabbar__item.is-activo { color: var(--verde-claro); }
.tabbar__item.is-activo .ico-caja { background: var(--info-bg); }
.tabbar__centro {
  flex: none; width: 60px; height: 60px; margin-top: -18px; border-radius: 20px; border: 4px solid var(--fondo);
  background: var(--verde-claro); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--sombra-alta);
}
:root[data-theme="dark"] .tabbar__centro { color: #10160f; }
.tabbar__centro .ico { width: 28px; height: 28px; stroke-width: 2.4; }
.tabbar__marca, .tabbar__cargar { display: none; }

@media (min-width: 900px) {
  .app { max-width: none; margin: 0; padding-left: 240px; }
  .view { max-width: 980px; padding: 24px 32px 60px; }
  .topbar { padding-left: 32px; }
  .topbar__marca { display: none; }
  .tabbar {
    top: 0; right: auto; width: 240px; height: auto; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 18px 12px; border-top: 0; border-right: 1px solid var(--linea);
  }
  .tabbar__marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 15px; line-height: 1.2; }
  .marca-mini { width: 36px; height: 36px; flex: none; }
  .tabbar__cargar {
    display: flex; align-items: center; gap: 8px; justify-content: center; margin: 0 4px 14px; padding: 12px; border: 0; border-radius: 14px;
    background: var(--verde-claro); color: #fff; font-weight: 700; cursor: pointer; box-shadow: var(--sombra);
  }
  .tabbar__item { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 15px; padding: 8px 10px; border-radius: 12px; }
  .tabbar__item .ico-caja { width: auto; height: auto; background: none !important; }
  .tabbar__item.is-activo { background: var(--info-bg); }
  .tabbar__item:hover { background: var(--fondo-suave); }
  .tabbar__centro { display: none; }
}

/* ---------- bloques y tarjetas ---------- */

.bloque { margin: 0 0 24px; }
.bloque__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.bloque__titulo { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--texto-suave); }
.bloque__accion { font-size: 14px; color: var(--verde-claro); background: none; border: 0; cursor: pointer; font-weight: 700; padding: 0; flex: none; }
.card { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); padding: 14px 16px; }

.numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .numeros { grid-template-columns: repeat(4, 1fr); } }
.numeros--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 420px) { .numeros--3 { grid-template-columns: 1fr 1fr; } .numeros--3 > :last-child { grid-column: span 2; } }
.numero {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0;
  background: var(--panel); border: 0; border-radius: var(--r-md); box-shadow: var(--sombra); padding: 12px 14px; cursor: pointer;
}
.numero:not([data-ir]) { cursor: default; }
.numero__label { font-size: 12.5px; color: var(--texto-suave); font-weight: 600; }
.numero__valor { font-family: var(--f-num); font-size: 27px; font-weight: 600; line-height: 1.1; margin: 2px 0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.numero__sub { font-size: 12.5px; color: var(--texto-suave); display: flex; align-items: center; gap: 4px; min-height: 18px; }
.tendencia { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.tendencia .ico { width: 16px; height: 16px; }

.salud { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); margin-bottom: 14px; background: var(--ok-bg); color: var(--ok-texto); font-size: 15.5px; font-weight: 600; }
.salud__punto { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: none; margin-top: 5px; box-shadow: 0 0 0 4px rgba(255, 255, 255, .5); }
.salud--atencion { background: var(--atencion-bg); color: var(--atencion-texto); }
.salud--critico { background: var(--critico-bg); color: var(--critico-texto); }
.salud--info { background: var(--info-bg); color: var(--info-texto); }

.capital {
  width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border: 0; cursor: pointer; text-align: left;
  background: var(--trigo-bg); border-radius: var(--r-md); padding: 10px 14px; margin: -4px 0 20px;
}
.capital span { font-size: 13px; font-weight: 700; color: var(--atencion-texto); }
.capital b { font-family: var(--f-num); font-size: 20px; font-weight: 600; }
.capital small { flex-basis: 100%; color: var(--texto-suave); font-size: 12.5px; }

.segmentado--inicio { margin-bottom: 14px; }

/* ---------- alertas ---------- */

.alertas { display: flex; flex-direction: column; gap: 8px; }
.alerta {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left; border: 0; cursor: pointer;
  padding: 11px 13px; border-radius: 14px; font-size: 14.5px; font-weight: 600; background: var(--info-bg); color: var(--info-texto);
}
.alerta__ico { flex: none; display: flex; }
.alerta__txt { flex: 1; min-width: 0; }
.alerta__accion { flex: none; background: var(--panel); color: var(--texto); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.alerta--critico { background: var(--critico-bg); color: var(--critico-texto); }
.alerta--atencion { background: var(--atencion-bg); color: var(--atencion-texto); }
.alerta--ok { background: var(--ok-bg); color: var(--ok-texto); cursor: default; }

/* ---------- listas ---------- */

.lista { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); overflow: hidden; }
.lista__item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 11px 14px; border-bottom: 1px solid var(--linea); color: var(--texto); text-decoration: none;
}
div.lista__item, label.lista__item { cursor: default; }
label.lista__item { cursor: pointer; }
.lista__item:last-child { border-bottom: 0; }
button.lista__item:hover { background: var(--fondo-suave); }
.lista__item > .ico { color: var(--texto-suave); width: 18px; height: 18px; }
.lista__item--alto { align-items: flex-start; flex-wrap: wrap; }
.lista__cuerpo { flex: 1; min-width: 0; }
.lista__titulo { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.25; overflow-wrap: anywhere; }
.lista__sub { display: block; font-size: 13px; color: var(--texto-suave); margin-top: 1px; }
.lista__extra { font-size: 13px; color: var(--texto-suave); text-align: right; flex: none; }
.lista__monto { font-family: var(--f-num); font-weight: 600; font-size: 17px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--critico); }
.txt-critico { color: var(--critico-texto); }
.txt-atencion { color: var(--atencion-texto); }

.mov__ico {
  width: 36px; height: 36px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--fondo-suave); color: var(--verde-claro);
}
.mov__ico .ico { width: 20px; height: 20px; }
.mov__ico--venta, .mov__ico--cobro, .mov__ico--ingreso { background: var(--ok-bg); color: var(--ok-texto); }
.mov__ico--compra, .mov__ico--gasto, .mov__ico--pago { background: var(--critico-bg); color: var(--critico-texto); }
.mov__ico--traslado, .mov__ico--nacimiento, .mov__ico--sanidad, .mov__ico--pesada, .mov__ico--muerte, .mov__ico--cambio_categoria { background: rgba(138, 90, 59, .14); color: var(--hacienda); }
.mov__ico--labor, .mov__ico--cosecha { background: rgba(91, 140, 58, .15); color: var(--agro); }
.mov.is-anulado .lista__titulo, .mov.is-anulado .lista__monto { text-decoration: line-through; opacity: .55; }

.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--info-texto); font-weight: 700; font-size: 13px; }

.vacio { text-align: center; color: var(--texto-suave); padding: 22px 16px; font-size: 14.5px; background: var(--panel); border-radius: var(--r-md); border: 1px dashed var(--linea); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--info-bg); color: var(--info-texto); white-space: nowrap; }
.chip--gris { background: var(--fondo-suave); color: var(--texto-suave); }
.chip--atencion { background: var(--atencion-bg); color: var(--atencion-texto); }
.chip--critico { background: var(--critico-bg); color: var(--critico-texto); }
.chip--ok { background: var(--ok-bg); color: var(--ok-texto); }
.chip--info { background: var(--info-bg); color: var(--info-texto); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }

.filtros { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 4px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtro { flex: none; border: 1px solid var(--linea); background: var(--panel); border-radius: 999px; padding: 6px 13px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--texto); }
.filtro small { color: var(--texto-suave); font-weight: 600; }
.filtro.is-activo { background: var(--verde); border-color: var(--verde); color: #f3f6ef; }
.filtro.is-activo small { color: rgba(243, 246, 239, .7); }

.buscador { width: 100%; border: 1px solid var(--linea); background: var(--panel); border-radius: 14px; padding: 11px 14px; font: inherit; color: var(--texto); margin-bottom: 12px; }
.no-coincide { display: none !important; }

.pestanas { display: flex; gap: 6px; margin-bottom: 16px; background: var(--fondo-suave); border-radius: 14px; padding: 4px; }
.pestanas--scroll { overflow-x: auto; scrollbar-width: none; }
.pestanas--scroll::-webkit-scrollbar { display: none; }
.pestana { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; border-radius: 11px; padding: 8px 12px; font-weight: 700; font-size: 14px; color: var(--texto-suave); cursor: pointer; white-space: nowrap; }
.pestana .ico { width: 18px; height: 18px; }
.pestana.is-activo { background: var(--panel); color: var(--texto); box-shadow: var(--sombra); }

.dato-fila { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--linea); font-size: 14.5px; }
.dato-fila:last-child { border-bottom: 0; }
.dato-fila__label { color: var(--texto-suave); flex: none; }
.dato-fila__valor { text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.nota { font-size: 14.5px; color: var(--texto-suave); white-space: pre-wrap; }
.nota--chica { font-size: 12.5px; margin-top: 8px; }
.enlace { color: var(--verde-claro); font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; font-size: inherit; display: inline-flex; align-items: center; gap: 2px; }
.enlace .ico { width: 16px; height: 16px; }

/* ---------- botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; font-size: 16px; cursor: pointer;
  background: var(--verde); color: #f3f6ef; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn .ico { width: 18px; height: 18px; }
.btn--suave { background: var(--info-bg); color: var(--info-texto); }
.btn--gris { background: var(--fondo-suave); color: var(--texto); }
.btn--peligro { background: var(--critico-bg); color: var(--critico-texto); }
.btn--chico { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn-fila { display: flex; gap: 8px; }
.btn-fila .btn { flex: 1; }
.acciones-fila { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.icono-btn { border: 0; background: var(--fondo-suave); width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icono-btn .ico { width: 18px; height: 18px; }

.opcion {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; cursor: pointer;
  padding: 10px 12px; border-radius: 14px; background: none; color: var(--texto);
}
.opcion:hover { background: var(--fondo-suave); }
.opcion__ico { width: 38px; height: 38px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--info-texto); }
.opcion__cuerpo { flex: 1; min-width: 0; }
.opcion__titulo { display: block; font-weight: 700; }
.opcion__sub { display: block; font-size: 13px; color: var(--texto-suave); }
.menu-grupo { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--texto-suave); margin: 16px 4px 4px; }

/* ---------- captura ---------- */

.captura-libre { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--fondo-suave); font-size: 14px; color: var(--texto-suave); margin-bottom: 14px; }
.captura-libre__fila { display: flex; gap: 8px; color: var(--verde-claro); }
.captura-libre__fila span { width: 34px; height: 34px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; }
.captura-libre__fila .ico { width: 18px; height: 18px; }
.atajos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.atajo { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: var(--panel); border-radius: 14px; padding: 10px 4px; font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: var(--sombra); text-align: center; line-height: 1.2; }
.atajo__ico { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--info-texto); }
.atajos--grande .atajo { padding: 14px 4px; font-size: 13px; }
@media (max-width: 360px) { .atajos { grid-template-columns: repeat(3, 1fr); } }

.efectos { margin: 4px 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--fondo-suave); font-size: 14px; }
.efectos:empty { display: none; }
.efectos__titulo { font-weight: 700; color: var(--texto-suave); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.efectos__linea { padding: 3px 0 3px 14px; position: relative; }
.efectos__linea::before { content: ""; position: absolute; left: 0; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--texto-suave); }
.efectos__linea--stock::before { background: var(--hacienda); }
.efectos__linea--cuenta::before { background: var(--ok); }
.efectos__linea--deuda::before { background: var(--atencion); }
.efectos__linea--resultado::before { background: var(--verde-claro); }
.efectos__aviso { margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: var(--atencion-bg); color: var(--atencion-texto); font-weight: 600; }
.efectos--ficha { background: var(--panel); box-shadow: var(--sombra); }
.mov-ficha__resumen { font-size: 18px; font-weight: 700; line-height: 1.3; }
.mov-ficha.is-anulado .mov-ficha__resumen { text-decoration: line-through; opacity: .6; }

/* ---------- formularios ---------- */

.campo { margin-bottom: 14px; }
.campo__label { display: block; font-size: 13.5px; font-weight: 700; color: var(--texto-suave); margin-bottom: 6px; }
.campo__input, .campo__select, .campo__textarea {
  width: 100%; border: 1px solid var(--linea); background: var(--panel); color: var(--texto);
  border-radius: 12px; padding: 11px 13px; font: inherit; font-size: 16px; min-height: 46px;
}
.campo__input:focus, .campo__select:focus, .campo__textarea:focus { outline: none; border-color: var(--verde-claro); box-shadow: 0 0 0 3px var(--info-bg); }
.campo__select--chico { width: auto; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.campo__textarea { min-height: 70px; resize: vertical; }
.campo__ayuda { font-size: 13px; color: var(--texto-suave); margin-top: 5px; }
.campo__nota { margin: -4px 0 14px; }
.campo__con-unidad { position: relative; display: flex; align-items: center; }
.campo__unidad { position: absolute; right: 12px; color: var(--texto-suave); font-size: 14px; pointer-events: none; }
.campo__unidad:empty { display: none; }
.campo__con-unidad .campo__input[type=number] { padding-right: 70px; }
.campo--par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-titulo { font-size: 15px; margin: 18px 0 10px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15.5px; padding: 6px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--verde-claro); }
.codigo { font-family: var(--f-num); font-size: 26px; letter-spacing: .3em; text-align: center; }

.segmentado { display: flex; background: var(--fondo-suave); border-radius: 12px; padding: 3px; gap: 3px; }
.segmentado button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 6px; font-weight: 700; font-size: 14px; color: var(--texto-suave); cursor: pointer; }
.segmentado button.is-activo { background: var(--panel); color: var(--texto); box-shadow: var(--sombra); }

.picker { position: relative; }
.picker__lista {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; max-height: 260px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--linea); border-radius: 12px; box-shadow: var(--sombra-alta);
}
.picker__op { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 13px; font-size: 15px; cursor: pointer; color: var(--texto); border-bottom: 1px solid var(--linea); }
.picker__op:last-child { border-bottom: 0; }
.picker__op:hover { background: var(--fondo-suave); }
.picker__op small { display: block; color: var(--texto-suave); font-size: 12.5px; }
.picker__op--nuevo { color: var(--verde-claro); font-weight: 700; }
.picker__op--nada { cursor: default; }
.picker__elegido { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--verde-claro); background: var(--info-bg); color: var(--info-texto); border-radius: 12px; padding: 9px 8px 9px 13px; font-weight: 700; min-height: 46px; }
.picker__elegido button { border: 0; background: var(--panel); width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; color: var(--texto); flex: none; }

.interruptor { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--linea); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.interruptor::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.interruptor:checked { background: var(--verde-claro); }
.interruptor:checked::after { transform: translateX(18px); }
.interruptor:disabled { opacity: .5; cursor: default; }
.modulo.is-proximamente { opacity: .7; }

/* ---------- panel inferior y avisos ---------- */

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(10, 20, 14, .5); backdrop-filter: blur(2px); }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--fondo); border-radius: 22px 22px 0 0; padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--sombra-alta); animation: sube .2s ease-out;
}
@keyframes sube { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  .sheet__panel { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 560px; border-radius: 22px; max-height: 88vh; animation: none; }
}
.sheet__grip { width: 42px; height: 5px; border-radius: 5px; background: var(--linea); margin: 2px auto 10px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; position: sticky; top: -10px; background: var(--fondo); padding: 6px 0; z-index: 6; }
.sheet__title { font-size: 20px; }
.sheet__close { border: 0; background: var(--fondo-suave); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; cursor: pointer; flex: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--alto-tabbar) + 22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); width: max-content;
  background: #17201a; color: #f3f6ef; padding: 11px 16px; border-radius: 14px; font-size: 14.5px; box-shadow: var(--sombra-alta);
}
.toast button { border: 0; background: none; color: var(--trigo-claro); font-weight: 700; cursor: pointer; flex: none; padding: 0; }
@media (min-width: 900px) { .toast { bottom: 28px; margin-left: 120px; } }

/* ---------- inicio ---------- */

.saludo { margin-bottom: 16px; }
.saludo h2 { font-family: var(--f-num); font-size: 26px; font-weight: 600; }
.saludo p { color: var(--texto-suave); }
.tarea-check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--linea); flex: none; }
.tarea-check--en_curso { border-color: var(--trigo); background: linear-gradient(90deg, var(--trigo-bg) 50%, transparent 50%); }
.tarea-check--hecha { border-color: var(--verde-claro); background: var(--verde-claro); }

/* ---------- barras ---------- */

.barras { padding: 6px 16px; }
.barra { margin: 10px 0; }
.barra[data-ir] { cursor: pointer; }
.barra__fila { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.barra__fila b { font-family: var(--f-num); font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.barra__pista { position: relative; height: 9px; background: var(--fondo-suave); border-radius: 6px; margin-top: 5px; overflow: hidden; }
.barra__pista--centro::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--linea); }
.barra__relleno { position: absolute; top: 0; bottom: 0; background: var(--verde-claro); border-radius: 6px; }
.barra__relleno--neg { background: var(--critico); }

/* ---------- producción ---------- */

.plano { display: flex; flex-direction: column; gap: 12px; }
.plano__campo { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); padding: 10px; }
.plano__titulo { font-weight: 700; font-size: 14px; margin: 0 4px 8px; }
.plano__titulo small { color: var(--texto-suave); font-weight: 600; }
.plano__lotes { display: flex; flex-wrap: wrap; gap: 6px; }
.plano__lote {
  flex: 1 1 110px; min-height: 74px; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 10px; color: #fff;
  background: var(--lote, var(--verde-claro));
  background-image: repeating-linear-gradient(-28deg, rgba(255, 255, 255, .09) 0 2px, transparent 2px 11px);
}
.plano__lote b { font-size: 14px; line-height: 1.2; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.plano__lote small { font-size: 12px; opacity: .92; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.plano__lote--vacio { background: var(--fondo-suave); color: var(--texto-suave); background-image: none; border: 1px dashed var(--linea); }
.plano__lote--vacio b, .plano__lote--vacio small { text-shadow: none; }
.lote-color { width: 10px; align-self: stretch; border-radius: 4px; flex: none; }

/* ---------- finanzas ---------- */

.deuda { display: flex; flex-direction: column; gap: 8px; background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); padding: 12px 14px; margin-bottom: 10px; border-left: 4px solid transparent; }
.deuda--vencida { border-left-color: var(--critico); }
.deuda__cuerpo { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.deuda__nombre { font-weight: 700; font-size: 15.5px; }
.deuda__monto { font-family: var(--f-num); font-size: 21px; font-weight: 600; text-align: right; grid-row: span 2; align-self: center; }
.deuda__sub { font-size: 13px; color: var(--texto-suave); }
.deuda__acciones { display: flex; gap: 8px; }

.flujo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.flujo__col { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flujo__dias { font-size: 12.5px; color: var(--texto-suave); font-weight: 700; }
.flujo__col b { font-family: var(--f-num); font-size: 21px; font-weight: 600; }
.flujo__col small { font-size: 12px; display: flex; flex-wrap: wrap; gap: 0 6px; }
.semaforo-punto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.semaforo-punto--rojo { background: var(--critico); }
.semaforo-punto--amarillo { background: var(--atencion); }
.semaforo-punto--verde { background: var(--ok); }

.saldo-contacto { display: flex; flex-direction: column; align-items: center; padding: 18px; border-radius: var(--r-md); background: var(--panel); box-shadow: var(--sombra); margin-bottom: 14px; }
.saldo-contacto span { font-weight: 700; color: var(--texto-suave); }
.saldo-contacto b { font-family: var(--f-num); font-size: 32px; font-weight: 600; }
.saldo-contacto.pos b { color: var(--ok); }
.saldo-contacto.neg b { color: var(--critico); }

/* ---------- operaciones ---------- */

.kanban { display: grid; grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 8px; scroll-snap-type: x mandatory; }
.kanban__col { background: var(--fondo-suave); border-radius: var(--r-md); padding: 10px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.kanban__titulo { font-weight: 700; font-size: 14px; padding: 0 4px; }
.kanban__titulo small { color: var(--texto-suave); }
.kanban__card { display: flex; gap: 6px; align-items: stretch; background: var(--panel); border-radius: 12px; box-shadow: var(--sombra); }
.kanban__cuerpo { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.kanban__cuerpo small { color: var(--texto-suave); font-size: 12.5px; }
.kanban__mover { border: 0; background: none; border-left: 1px solid var(--linea); padding: 0 10px; cursor: pointer; color: var(--verde-claro); }
.kanban__vacio { color: var(--texto-suave); font-size: 13px; padding: 4px; }
.dia { margin-bottom: 16px; }
.dia__fecha { margin: 0 4px 6px; text-transform: capitalize; }

/* ---------- análisis ---------- */

.pregunta { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--linea); border-radius: 16px; padding: 4px 4px 4px 12px; box-shadow: var(--sombra); margin-bottom: 10px; }
.pregunta__ico { color: var(--trigo); display: flex; }
.pregunta input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 16px; padding: 10px 0; color: var(--texto); outline: none; }
.pregunta button { border: 0; background: var(--verde); color: #f3f6ef; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.sugerencias { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 4px; scrollbar-width: none; }
.sugerencias::-webkit-scrollbar { display: none; }
.sugerencia { flex: none; border: 0; background: var(--trigo-bg); color: var(--atencion-texto); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.respuesta { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); padding: 14px 16px; margin: 6px 0 16px; display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--trigo); }
.respuesta__pregunta { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--texto-suave); font-size: 14px; }
.respuesta__pregunta .ico { width: 18px; height: 18px; }
.respuesta .analisis { box-shadow: none; padding: 0; background: none; }
.analisis { background: var(--panel); border-radius: var(--r-md); box-shadow: var(--sombra); padding: 14px 16px; margin-bottom: 14px; }
.analisis .card, .analisis .barras { box-shadow: none; padding: 0; background: none; }
.analisis__titulo { font-size: 16px; margin-bottom: 4px; }
.analisis__frase { font-size: 15px; margin-bottom: 8px; }
.analisis__mas { margin-top: 8px; }
.tabla-scroll { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; color: var(--texto-suave); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.tabla td { padding: 7px 8px; border-bottom: 1px solid var(--linea); }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- ingreso ---------- */

.login { max-width: 400px; margin: 0 auto; padding: 48px 4px 40px; }
.login__logo { width: 72px; height: 72px; margin: 0 auto; }
.login__nombre { text-align: center; font-family: var(--f-num); font-size: 32px; font-weight: 600; margin: 10px 0 4px; }
.login__bajada { text-align: center; color: var(--texto-suave); margin-bottom: 26px; }
.login__nota { text-align: center; color: var(--texto-suave); font-size: 14px; margin-top: 16px; }

/* Con permiso "solo mirar" no se ven los botones para cargar o cambiar. */
.solo-mirar [data-cargar], .solo-mirar [data-nueva-tarea], .solo-mirar [data-mover], .solo-mirar .alerta__accion { display: none !important; }

/* ---------- importar planillas ---------- */

.subir-archivo { display: flex; align-items: center; gap: 14px; padding: 18px; border: 2px dashed var(--linea); border-radius: var(--r-md); background: var(--panel); cursor: pointer; color: var(--verde-claro); }
.subir-archivo:hover { border-color: var(--verde-claro); }
.subir-archivo .ico { width: 30px; height: 30px; }
.subir-archivo span { display: flex; flex-direction: column; color: var(--texto); }
.subir-archivo small { color: var(--texto-suave); }
.hoja-imp__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.hoja-imp__head small { color: var(--texto-suave); }
.mapa-imp { margin-top: 10px; font-size: 14px; }
.mapa-imp summary { cursor: pointer; color: var(--verde-claro); font-weight: 700; }
.mapa-imp__fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--linea); }
.mapa-imp__fila .campo__select { max-width: 60%; }
.imp-final { position: sticky; bottom: calc(var(--alto-tabbar) + 10px); box-shadow: var(--sombra-alta); }
.bienvenida-datos { margin-bottom: 14px; border-left: 4px solid var(--trigo); }
@media (min-width: 900px) { .imp-final { bottom: 16px; } }
