/* Vessel Gestión con la marca Vessel Studio (kit de marca v1 · 2026):
   Negro #0D0D0D · Blanco #FFFFFF · Oro #C9A86A (texto sobre claro #A8874C) · Crema #F6F1E7 · Montserrat.
   Estilo de pantalla «achromatic ledger» (tasteskill): la interfaz va en tinta, sin color; el oro es el único tono
   y va solo en el dato principal (avance del capital y del arranque). Verde y rojo, apagados, solo para estados:
   entra plata (+) y atrasado. Los gastos van en tinta, no en rojo. Bordes de 1px, sin sombras en reposo. */
:root {
  --bg: #f6f1e7;            /* crema de la marca: el suelo */
  --surface: #ffffff;       /* blanco: tarjetas */
  --raised: #f3eee4;        /* un paso bajo el blanco: pistas, celdas, campos de solo lectura */
  --active: #ebe5d9;        /* pastilla de la pestaña activa */
  --line: #e6dfd2;          /* borde de tarjetas */
  --rule: #f0ebe1;          /* reglas entre filas */
  --control: #d3cbbd;       /* borde de controles */
  --ink: #0d0d0d;           /* negro */
  --ink-2: #3d3a35;
  --muted: #6b655b;         /* gris cálido a 4,5:1 sobre blanco y sobre crema */
  --primary: #0d0d0d;       /* acción principal: negro */
  --primary-ink: #ffffff;
  --gold: #a8874c;          /* oro para datos y texto sobre claro (≥3:1) */
  --olive: #3f6a35;         /* entra plata / hecho */
  --red: #a8322d;           /* atrasado */
  --pill-red-bg: #f7e3e0;   --pill-red-ink: #7e221e;
  --pill-oro-bg: #f3e8d2;   --pill-oro-ink: #6b5226;
  --pill-ok-bg: #e2eedc;    --pill-ok-ink: #24401d;
  --pill-gris-bg: #efebe3;  --pill-gris-ink: #3d3a35;
  --pill-azul-bg: #e5e9ee;  --pill-azul-ink: #2c3a48;   /* confirmar con un profesional */
  --focus: #a8874c;
  --radius: 8px; --radius-control: 8px; --radius-chip: 6px;
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d; --surface: #161513; --raised: #1f1d1a; --active: #2a2723;
    --line: #2b2824; --rule: #221f1c; --control: #45403a;
    --ink: #f6f1e7; --ink-2: #d4cdbf; --muted: #aaa294;
    --primary: #f6f1e7; --primary-ink: #0d0d0d;
    --gold: #c9a86a; --olive: #9cc28c; --red: #ef8f86;
    --pill-red-bg: #351f1c; --pill-red-ink: #ef8f86;
    --pill-oro-bg: #2e2719; --pill-oro-ink: #d8bc85;
    --pill-ok-bg: #1d2a19; --pill-ok-ink: #9cc28c;
    --pill-gris-bg: #24221f; --pill-gris-ink: #d4cdbf;
    --pill-azul-bg: #1f2830; --pill-azul-ink: #b8c6d4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }      /* 24px: título de pantalla */
h2 { font-size: 1.0667rem; }                            /* 16px: título de tarjeta */
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--ink); }
b, strong { font-weight: 600; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .9333rem; }   /* 14px */
.tiny { font-size: .8rem; }       /* 12px */
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--olive); }
.neg { color: var(--red); }

/* ---------- Estructura ---------- */
.app { max-width: 680px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 32px); }
.marca-fila { display: flex; align-items: center; gap: 8px; height: 32px; color: var(--muted); font-size: .9333rem; margin-bottom: 10px; }
.marca-fila img { width: 18px; height: 18px; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top .sub { color: var(--muted); margin-top: 4px; font-size: .9333rem; }
.top .btn { flex: none; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { margin-bottom: 10px; }
.card .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.card .head h2 { margin: 0; }
.card .desc { color: var(--muted); font-size: .9333rem; margin-top: 2px; }
.card.alerta { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.section-title { font-size: .8667rem; font-weight: 600; color: var(--muted); margin: 22px 2px 8px; }

/* ---------- Navegación inferior ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav button { background: none; border: 0; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: .7333rem; font-weight: 500; position: relative; }
.nav button svg { width: 22px; height: 22px; padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background-color .15s ease; }
.nav button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav button[aria-current="page"] svg { background: var(--active); }
.nav .dot { position: absolute; top: 6px; left: calc(50% + 12px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7333rem; font-weight: 600; display: grid; place-items: center; padding: 0 5px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-control);
  border: 1px solid var(--control); background: var(--surface); font-weight: 600; transition: transform .12s ease, background-color .15s ease; text-decoration: none; color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink); padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9333rem; }
.btn svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Chips y segmentos ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 16px 4px; margin: 0 -16px; overscroll-behavior-x: contain; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--control); background: var(--surface); border-radius: var(--radius-chip); padding: 7px 12px; font-size: .9333rem; font-weight: 500; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--raised); border-radius: var(--radius-control); padding: 3px; gap: 3px; margin-bottom: 14px; }
.seg button { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 8px 6px; font-weight: 500; color: var(--muted); font-size: .9333rem; }
.seg button[aria-pressed="true"] { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }

.badge { flex: none; display: inline-flex; align-items: center; gap: 4px; border-radius: var(--radius-chip); padding: 2px 8px; font-size: .8rem; font-weight: 500; white-space: nowrap; background: var(--pill-gris-bg); color: var(--pill-gris-ink); }
.badge.red { background: var(--pill-red-bg); color: var(--pill-red-ink); }
.badge.oil { background: var(--pill-oro-bg); color: var(--pill-oro-ink); }
.badge.olive { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.badge.blue { background: var(--pill-azul-bg); color: var(--pill-azul-ink); }
.badge svg { width: 13px; height: 13px; }

/* ---------- Listas ---------- */
.list { display: grid; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 56px; border-top: 1px solid var(--rule); text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; color: inherit; }
.list > .item:first-child { border-top: 0; }
.item .t { font-weight: 500; }
.item .s { color: var(--muted); font-size: .8667rem; margin-top: 2px; }
.item .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.item .chev { flex: none; width: 16px; height: 16px; color: var(--muted); }
.check { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--control); background: var(--surface); display: grid; place-items: center; color: transparent; transition: background-color .15s ease, border-color .15s ease, transform .12s ease; }
.check svg { width: 15px; height: 15px; }
.check.on { background: var(--olive); border-color: var(--olive); color: #fff; }
.check:active { transform: scale(.9); }
/* Íconos de lista: simples, grises, sin cajita de color. */
.ico { flex: none; width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); }
.ico svg { width: 18px; height: 18px; }
.empty { text-align: center; padding: 22px 10px; color: var(--muted); font-size: .9333rem; }
.empty svg { display: none; }
.ver-mas { display: block; margin-top: 4px; padding: 10px 0 2px; border: 0; border-top: 1px solid var(--rule); background: none; width: 100%; text-align: left; font-weight: 500; color: var(--ink); font-size: .9333rem; }

/* ---------- Números ---------- */
.lead .l { font-size: .9333rem; color: var(--muted); }
.lead .v { font-size: 2.1333rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 2px; }   /* 32px: la cifra que responde */
.kpis { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); margin-top: 14px; }
.kpi { padding: 12px 0 2px; }
.kpi + .kpi { padding-left: 14px; border-left: 1px solid var(--rule); }
.kpi .l { font-size: .8667rem; color: var(--muted); }
.kpi .v { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }   /* 18px */
.bar { height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--gold); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.meta { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: .9333rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.meta .total { color: var(--ink); font-weight: 600; }

/* Capital: los dos socios como dos carriles hacia sus $500.000. */
.carriles { display: grid; gap: 14px; }
.carril .row { justify-content: space-between; align-items: baseline; font-size: .9333rem; }
.carril .bar { margin-top: 6px; position: relative; }
.carril .bar .meta-mes { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .55; border-radius: 1px; }

.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius); padding: 12px 14px; font-size: .9333rem; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.alert.blue { background: var(--pill-azul-bg); color: var(--pill-azul-ink); }
.alert.oil { background: var(--pill-oro-bg); color: var(--pill-oro-ink); }
.alert.red { background: var(--pill-red-bg); color: var(--pill-red-ink); }
.alert.olive { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }

/* ---------- Mes ---------- */
.month { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.month strong { font-size: 1.0667rem; font-weight: 600; text-transform: capitalize; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: .9333rem; font-weight: 500; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; border: 1px solid var(--control); background: var(--surface); border-radius: var(--radius-control); padding: 10px 12px; font-size: 16px; outline: none; }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--ink); outline: 2px solid color-mix(in srgb, var(--gold) 45%, transparent); outline-offset: 0; }
.money { position: relative; }
.money .input { font-size: 1.6rem; font-weight: 600; padding-left: 32px; min-height: 58px; font-variant-numeric: tabular-nums; }
.money::before { content: '$'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--muted); font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: var(--control); transition: background-color .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.3, .7, .3, 1); }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(18px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .switch input:checked + i::after { background: #0d0d0d; } }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.calc { background: var(--raised); border-radius: var(--radius-control); padding: 10px 12px; font-size: .9333rem; display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }

/* ---------- Hoja inferior (modales: flotan, por eso llevan sombra) ---------- */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 680px; max-height: 92dvh; background: var(--surface); color: var(--ink);
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(0,0,0,.16); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: subir .26s cubic-bezier(.2, .9, .25, 1); }
dialog.sheet::backdrop { background: rgba(13, 13, 13, .45); animation: aparecer .2s ease; }
@media (min-width: 720px) { dialog.sheet { margin: auto; border-radius: 16px; max-height: 86dvh; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 8px; }
.sheet-head h2 { font-size: 1.2rem; }
.sheet-body { overflow-y: auto; padding: 4px 16px 18px; display: grid; gap: 14px; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface); }
.sheet-foot .btn { flex: 1; }
.grabber { width: 36px; height: 4px; border-radius: 2px; background: var(--control); margin: 8px auto 0; }
@keyframes subir { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Avisos flotantes ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: var(--radius); font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.2); width: max-content; max-width: calc(100% - 32px); animation: subir .25s ease; }

/* ---------- Entrar ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 16px; }
.brand { display: grid; justify-items: center; gap: 10px; margin-bottom: 10px; text-align: center; }
.brand .logo { width: 210px; height: auto; }
/* La única etiqueta en mayúsculas espaciadas de la pantalla (la guía de marca la pide para detalles). */
.brand .tag { font-size: .8rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.pie { display: block; width: 210px; max-width: 70%; height: auto; margin: 8px auto 0; opacity: .85; }
.logo-oscuro, .pie.pie-oscuro { display: none; }
@media (prefers-color-scheme: dark) { .logo-claro, .pie.pie-claro { display: none; } .logo-oscuro, .pie.pie-oscuro { display: block; } }
.qr { background: #fff; border-radius: var(--radius); padding: 12px; width: 200px; height: 200px; margin: 0 auto; display: block; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* La clave del autenticador es un código: se lee carácter por carácter. */
.secret { font-family: ui-monospace, Menlo, monospace; font-size: .8667rem; word-break: break-all; background: var(--raised); padding: 8px 10px; border-radius: var(--radius-control); } /* taste-skill-ignore */

/* ---------- Archivo ---------- */
.doc-ico { flex: none; width: 36px; height: 44px; border-radius: 4px; border: 1px solid var(--line); background: var(--raised); display: grid; place-items: center; font-size: .7333rem; font-weight: 600; color: var(--muted); }
.preview { width: 100%; max-height: 50dvh; object-fit: contain; border-radius: var(--radius); background: var(--raised); }
.drop { border: 1px dashed var(--control); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); font-size: .9333rem; background: var(--surface); }
.drop b { color: var(--ink); }
.drop.on { border-color: var(--ink); background: var(--raised); }

/* ---------- Tabla de resumen ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: .9333rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 10px 6px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; text-transform: capitalize; padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl th { font-size: .8rem; color: var(--muted); font-weight: 500; border-bottom-color: var(--line); }
.tbl tr:last-child td { border-bottom: 0; }

.etapa summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 40px; }
.etapa summary::-webkit-details-marker { display: none; }
.etapa summary .chev { transition: transform .2s; width: 16px; height: 16px; color: var(--muted); }
.etapa[open] summary .chev { transform: rotate(90deg); }
.etapa .list { margin-top: 6px; }
.done .t { text-decoration: line-through; color: var(--muted); }

/* Cargando: el mismo bloque en gris plano, sin brillo. */
.skeleton { height: 120px; border-radius: var(--radius); background: var(--raised); }

@media (hover: hover) {
  .btn:hover { background: var(--raised); }
  .btn.primary:hover { background: color-mix(in srgb, var(--primary) 86%, var(--bg)); }
  .item[data-act]:hover, button.item:hover { background: color-mix(in srgb, var(--raised) 60%, transparent); }
  .chip:hover { border-color: var(--ink-2); }
}
