/* =====================================================================
   SIGERES — estilos
   Efectos: crossfade de tarjetas, shared elements (View Transitions),
   magnificación tipo Dock y blur en barras, menús y modales.
   ===================================================================== */
:root {
  --bg: #eef2f7;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #dbe6ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #e3f4f1 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #1e3a8a;
  --brand-2: #2563eb;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --warn: #b45309;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .78);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .18);
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --we: rgba(37, 99, 235, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1e293b 0%, transparent 60%), radial-gradient(900px 500px at 110% 0%, #0f2a2a 0%, transparent 55%);
    --surface: #111a2e; --surface-2: #0f172a; --line: #1f2b44; --line-2: #2a3a5a;
    --text: #e2e8f0; --muted: #94a3b8; --brand: #93b4ff; --brand-2: #3b82f6;
    --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .15); --err: #f87171; --err-bg: rgba(239, 68, 68, .15); --warn: #fbbf24;
    --glass: rgba(17, 26, 46, .6); --glass-strong: rgba(17, 26, 46, .8);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --we: rgba(147, 180, 255, .05);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg-grad), var(--bg); background-attachment: fixed;
  color: var(--text); font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: var(--brand-2); }
h1, h2, h3 { margin: 0 0 .4em; letter-spacing: -.02em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ---------- Barra superior con blur + Dock ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; view-transition-name: topbar;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; min-height: 68px;
  border-bottom: 1px solid var(--line); isolation: isolate;
}
/* El blur va en una capa aparte: si estuviera en la barra, la barra de abajo del celular quedaría "pegada" arriba */
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
}
.top-install {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; text-decoration: none;
  font: 600 12px/1 Inter, system-ui, sans-serif; color: var(--brand-2); background: var(--surface); border: 1px solid var(--line);
  margin-left: auto; margin-right: 12px;
}
.top-install[hidden] { display: none; }
.top-install svg { width: 16px; height: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  view-transition-name: marca;
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; font-weight: 700; font-size: 18px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}
.brand-mark.big { width: 64px; height: 64px; font-size: 32px; border-radius: 18px; margin: 0 auto 12px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-size: 16px; letter-spacing: .02em; }
.brand-txt small { font-size: 11px; color: var(--muted); }

.dock {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 10px; height: 54px;
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 18px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.dock-item {
  --s: 1; position: relative; display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--muted);
  transform-origin: 50% 100%; transform: translateY(calc((var(--s) - 1) * -6px)) scale(var(--s));
  transition: transform .18s var(--ease), color .2s;
  will-change: transform;
}
.dock-ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
}
.dock-ic svg { width: 21px; height: 21px; }
.dock-item:hover, .dock-item.on { color: var(--brand-2); }
.dock-item.on .dock-ic { position: relative; color: #fff; border-color: transparent; background: transparent; }
.dock-glow { position: absolute; inset: 0; border-radius: 12px; z-index: -1; view-transition-name: dock-activo; background: linear-gradient(135deg, #1e3a8a, #2563eb); box-shadow: 0 6px 16px rgba(37, 99, 235, .35); }
.dock-ic { position: relative; isolation: isolate; }
.dock-item.on::after { content: ""; position: absolute; bottom: -5px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand-2); }
.dock-lbl {
  position: absolute; bottom: calc(100% + 8px); white-space: nowrap; pointer-events: none;
  padding: 3px 8px; border-radius: 7px; font-size: 11px; font-weight: 600;
  background: var(--glass-strong); color: var(--text); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.dock-item:hover .dock-lbl { opacity: 1; transform: none; }
.topbar .dock-lbl { bottom: auto; top: calc(100% + 10px); transform: translateY(-4px); }
.dock-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line-2); }

/* ---------- Contenido ---------- */
.wrap { max-width: 1480px; margin: 0 auto; padding: 24px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 30px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.title-block { width: fit-content; }
.title-block h1 { margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
  animation: card-in .45s var(--ease) both;
}
/* Crossfade de entrada escalonado (fallback cuando no hay View Transitions) */
.card:nth-child(2) { animation-delay: .03s; } .card:nth-child(3) { animation-delay: .06s; } .card:nth-child(4) { animation-delay: .09s; }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpis .card { margin: 0; }
.kpi > span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi:first-child { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border-color: transparent; }
.kpi:first-child > span { color: rgba(255, 255, 255, .75); }

/* ---------- Crossfade al actualizar datos ---------- */
.xf-stack { display: inline-grid; }
.xf-stack > .xf { grid-area: 1 / 1; }
.xf.out, .xf.in.out { animation: xf-out .35s var(--ease) forwards; }
.xf.in  { animation: xf-in .35s var(--ease) both; }
@keyframes xf-out { to { opacity: 0; filter: blur(2px); transform: translateY(-3px); } }
@keyframes xf-in  { from { opacity: 0; filter: blur(2px); transform: translateY(3px); } }
.flash-row td { animation: row-glow 1s var(--ease); }
@keyframes row-glow { 0% { background-color: rgba(37, 99, 235, .12); } 100% { background-color: transparent; } }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand-2); color: #fff; border: 0; border-radius: 10px; padding: 9px 15px;
  font: 600 13px/1 Inter, system-ui, sans-serif; cursor: pointer; text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .15s, background .15s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }
.btn:active { transform: none; }
.btn-success { background: #16a34a; box-shadow: 0 4px 12px rgba(22, 163, 74, .25); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn-ghost:hover { box-shadow: var(--shadow); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 12px; margin-top: 6px; }
.danger { color: var(--err) !important; }
input, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 8px 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 13px; }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: inline; }
.periodo { display: flex; gap: 6px; align-items: center; }
.periodo input { width: 90px; }
.drop { border: 2px dashed var(--line-2); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; color: var(--muted); }
.drop:hover { border-color: var(--brand-2); }
.money-in { width: 120px; text-align: right; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.card form + h3, .card .form-inline + h3 { margin-top: 22px; }

.alert { padding: 12px 16px; border-radius: 12px; font-weight: 500; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.alert-err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.list { margin: 0 0 14px; padding-left: 18px; } .list .warn { color: var(--warn); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; font-weight: 600; }
.tag.big { padding: 6px 10px; font-size: 12px; } .tag small { color: var(--muted); font-weight: 500; }
.tag .x { border: 0; background: none; color: var(--err); cursor: pointer; font-size: 14px; padding: 0 0 0 4px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pill { padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
tr.inactive td { opacity: .55; }

/* ---------- Tablas ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-align: center; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }
.left { text-align: left !important; } .right { text-align: right !important; }
.money { text-align: right !important; font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }

/* ---------- Planilla ---------- */
.grid-card { padding: 0; overflow: hidden; }
.grid-scroll { overflow: auto; max-height: calc(100vh - 220px); }
.grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; text-align: center; white-space: nowrap; background: var(--surface); }
.grid thead th { position: sticky; top: 0; z-index: 3; padding: 8px 6px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--glass-strong); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.grid thead th.day { min-width: 34px; line-height: 1.1; }
.grid thead th.day small { display: block; font-size: 9.5px; opacity: .7; }
.grid th.we, .grid td.we { background-image: linear-gradient(var(--we), var(--we)); }
.grid th.today { color: var(--brand-2); box-shadow: inset 0 -2px 0 var(--brand-2); }
.grid td.today { background-image: linear-gradient(rgba(37, 99, 235, .07), rgba(37, 99, 235, .07)); }
.grid .sticky { position: sticky; z-index: 2; text-align: left; padding: 0 10px; }
.grid thead .sticky { z-index: 4; }
.grid .c-nro { left: 0; width: 44px; min-width: 44px; text-align: center; }
.grid .c-gr { left: 44px; width: 78px; min-width: 78px; }
.grid .c-nom { left: 122px; min-width: 230px; font-weight: 600; box-shadow: 4px 0 8px -6px rgba(15, 23, 42, .25); }
.grid td.sum, .grid th.sum { min-width: 44px; padding: 0 6px; font-weight: 600; background-color: var(--surface-2); }
.grid td.money, .grid th.money { min-width: 120px; padding: 0 10px; background-color: var(--surface-2); }
.grid td.sum, .grid td.money { height: 40px; }
.grid tfoot td { font-weight: 700; height: 42px; background: var(--surface-2); position: sticky; bottom: 0; }
.grid tbody tr:hover td { background-color: var(--surface-2); }

.code {
  --c: transparent; width: 32px; height: 30px; margin: 4px 1px; border: 0; border-radius: 7px; cursor: pointer;
  font: 700 11px/1 Inter, system-ui, sans-serif; color: var(--line-2); background: transparent;
  transition: transform .15s var(--ease), background .25s, color .25s, box-shadow .2s;
}
.code:hover { transform: scale(1.12); background: var(--surface-2); color: var(--muted); }
.code.has { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.code.static { display: inline-grid; place-items: center; cursor: default; width: auto; min-width: 34px; padding: 0 6px; }
.code.pop { animation: code-pop .35s var(--ease); }
@keyframes code-pop { 0% { transform: scale(.6); opacity: .2; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.code.saving { opacity: .5; }
.code.error { box-shadow: inset 0 0 0 2px var(--err); }

.palette-card { padding: 12px 16px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.palette-lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.chip {
  --c: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; font: 700 12px/1 Inter, system-ui, sans-serif; color: var(--text);
  transition: transform .15s var(--ease), border-color .15s, box-shadow .15s;
}
.chip small { font-weight: 500; color: var(--muted); }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip:hover { transform: translateY(-1px); }
.chip.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.chip-off.on { --c: var(--brand-2); }
body.painting .grid .code { cursor: crosshair; }

/* ---------- Menú flotante y modales con blur ---------- */
.popover {
  position: fixed; z-index: 80; width: 250px; padding: 8px; border-radius: 14px;
  background: var(--glass-strong); border: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-lg); transform-origin: top left;
  animation: pop-in .18s var(--ease);
}
.popover[hidden] { display: none; }
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(-4px); } }
.pop-title { font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 8px 8px; text-transform: uppercase; letter-spacing: .06em; }
.pop-list { display: flex; flex-direction: column; max-height: 320px; overflow: auto; }
.pop-list button {
  --c: var(--muted); display: grid; grid-template-columns: 10px 40px 1fr; align-items: center; gap: 8px;
  padding: 8px; border: 0; border-radius: 9px; background: none; cursor: pointer; text-align: left; color: var(--text); font: 500 13px Inter, system-ui, sans-serif;
}
.pop-list button:hover, .pop-list button:focus-visible { background: color-mix(in srgb, var(--c) 14%, transparent); outline: none; }
.pop-list i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pop-list i.none { background: none; border: 1.5px dashed var(--muted); }
.pop-list span { color: var(--muted); font-size: 12px; }

dialog.modal {
  border: 1px solid var(--line); border-radius: 18px; padding: 22px; width: min(440px, calc(100vw - 32px));
  background: var(--glass-strong); color: var(--text); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
}
dialog.modal[open] { animation: modal-in .28s var(--ease); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in .25s; }
dialog.modal form { display: flex; flex-direction: column; gap: 12px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- Anual ---------- */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.month { margin: 0; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; transition: transform .2s var(--ease), box-shadow .2s; }
.month:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.month h3 { margin: 0; font-size: 17px; }
.month b { font-size: 18px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1e3a8a, #2563eb); }

/* ---------- Login ---------- */
.login { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; padding: 30px; }
.login-card label { text-align: left; }

/* =====================================================================
   View Transitions entre páginas: crossfade + elementos compartidos
   ===================================================================== */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .28s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .38s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(3px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); filter: blur(3px); } }
/* Elementos compartidos: se transforman de una página a la otra */
::view-transition-group(*) { animation-duration: .42s; animation-timing-function: var(--ease); }
/* El resaltado del Dock "viaja" de un ícono al otro */
::view-transition-group(dock-activo) { animation-duration: .5s; animation-timing-function: cubic-bezier(.3, 1.3, .5, 1); }
/* Con View Transitions activas no repetimos la animación de entrada de las tarjetas */
html.vt .card { animation: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-txt small { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; justify-content: center; }
  .brand-txt { display: none; }
  .dock { gap: 3px; padding: 5px 7px; height: 48px; }
  .dock-ic { width: 34px; height: 34px; }
  h1 { font-size: 24px; }
  .grid .c-nom { min-width: 150px; }
  .kpi b { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  @view-transition { navigation: none; }
}

/* =====================================================================
   v2 — Selección estilo Excel, usuarios y roles
   ===================================================================== */
.grid-scroll:focus { outline: none; }
#gridScroll { scroll-padding: 46px 300px 50px 360px; }
.grid td.cell { cursor: cell; user-select: none; -webkit-user-select: none; }
.grid .code { pointer-events: none; }
.grid td.cell.sel { background-color: color-mix(in srgb, var(--brand-2) 11%, var(--surface)); }
.grid td.cell.sel.e-t { box-shadow: inset 0 2px 0 var(--brand-2); }
.grid td.cell.sel.e-b { box-shadow: inset 0 -2px 0 var(--brand-2); }
.grid td.cell.sel.e-t.e-b { box-shadow: inset 0 2px 0 var(--brand-2), inset 0 -2px 0 var(--brand-2); }
.grid td.cell.sel.e-l { border-left: 2px solid var(--brand-2); }
.grid td.cell.sel.e-r { border-right: 2px solid var(--brand-2); }
.grid td.cell.anchor .code { outline: 2px solid var(--brand-2); outline-offset: 1px; background-color: var(--surface); }
.grid td.cell.anchor .code.has { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.grid-scroll:not(:focus-within):not(:focus) td.cell.sel { background-color: color-mix(in srgb, var(--muted) 10%, var(--surface)); }

.typing {
  position: fixed; z-index: 85; display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 10px;
  background: var(--glass-strong); border: 1px solid var(--brand-2); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: pop-in .14s var(--ease); pointer-events: none;
}
.typing[hidden] { display: none; }
.typing b { font-size: 15px; color: var(--brand-2); }
.typing span { font-size: 11.5px; color: var(--muted); }

.palette .palette-lbl { min-width: 170px; color: var(--text); }
.save-state { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); transition: color .2s; }
.save-state.ok { color: var(--ok); } .save-state.err { color: var(--err); } .save-state.busy { color: var(--brand-2); }
kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; font: 600 11px/1.6 Inter, system-ui, sans-serif; background: var(--surface); color: var(--text); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; max-width: 360px; padding: 12px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--err-bg) 80%, transparent); color: var(--err); font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: modal-in .3s var(--ease);
  transition: opacity .4s, transform .4s;
}
.toast.out { opacity: 0; transform: translateY(8px); }

.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.roles .card { margin: 0; display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--rc); }
.roles span { color: var(--muted); font-size: 12.5px; }
.role-admin, .rol-admin { --rc: #7c3aed; } .role-editor, .rol-editor { --rc: #2563eb; } .role-lectura, .rol-lectura { --rc: #64748b; }
.pill.rol-admin, .pill.rol-editor, .pill.rol-lectura { background: color-mix(in srgb, var(--rc) 14%, transparent); color: var(--rc); }
.card.narrow { max-width: 460px; }
@media (max-width: 760px) { .roles { grid-template-columns: 1fr; } .palette .palette-lbl { min-width: 0; width: 100%; } }

/* =====================================================================
   v4 — Celular: app instalable, barra inferior, calendario táctil
   ===================================================================== */
.mview { display: none; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.kbdish { display: inline-block; padding: 0 5px; border: 1px solid var(--line-2); border-radius: 5px; }
html.standalone .topbar { padding-top: max(10px, env(safe-area-inset-top)); }

@media (max-width: 760px) {
  html { -webkit-tap-highlight-color: transparent; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  input, select { font-size: 16px; }               /* evita el zoom automático del iPhone */
  .wrap { padding: 14px 14px 20px; }

  /* Barra superior compacta + barra de secciones abajo (como app) */
  .topbar { justify-content: space-between; min-height: 54px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand-txt { display: flex; } .brand-txt small { display: none; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
  .dock {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 60;
    height: 62px; padding: 6px 6px; gap: 0; justify-content: space-around; align-items: center; border-radius: 20px;
    background: var(--glass-strong); box-shadow: 0 10px 40px rgba(15, 23, 42, .25);
    -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  }
  .dock-sep { display: none; }
  .dock-item { flex: 1; transform: none !important; gap: 2px; }
  .dock-ic { width: 36px; height: 30px; border: 0; background: transparent; border-radius: 10px; }
  .dock-ic svg { width: 20px; height: 20px; }
  .dock-item.on::after { display: none; }
  .dock-glow { box-shadow: none; }
  .topbar .dock-lbl, .dock-lbl {
    position: static; opacity: 1; transform: none; padding: 0; border: 0; background: none;
    -webkit-backdrop-filter: none; backdrop-filter: none; font-size: 10px; color: inherit;
  }
  .top-install { margin: 0; padding: 6px 10px; }

  h1 { font-size: 23px; }
  .head-row { gap: 10px; margin-bottom: 12px; align-items: stretch; flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions .periodo { flex: 1; } .head-actions .periodo select { flex: 1; }
  .head-actions .btn-success { width: 100%; }
  .kpis { gap: 10px; margin-bottom: 12px; }
  .kpis .card { padding: 12px 14px; }
  .kpi b { font-size: 16px; }
  .card { padding: 14px; border-radius: 16px; }
  .card > .tbl, .card > form > .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .months { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .month b { font-size: 15px; }
  .form-inline > * { flex: 1 1 140px; }

  /* Modales como hoja inferior */
  dialog.modal { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  dialog.modal[open] { animation: sheet-in .32s var(--ease); }

  /* Planilla: en el celular se reemplaza la tabla por la vista táctil */
  .grid-card, .palette-card { display: none; }
  .mview { display: block; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }

/* --- Pestañas de personas --- */
.m-tabs {
  position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 20; display: flex; gap: 8px; overflow-x: auto;
  margin: 0 -14px 12px; padding: 8px 14px; scrollbar-width: none;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
}
.m-tabs::-webkit-scrollbar { display: none; }
.m-tab {
  position: relative; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 7px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 700 14px/1.2 Inter, system-ui, sans-serif; cursor: pointer; isolation: isolate;
}
.m-tab small { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.m-tab.on { color: #fff; border-color: transparent; }
.m-tab.on small { color: rgba(255, 255, 255, .75); }
.m-tab-ind { display: none; }
.m-tab.on .m-tab-ind {
  display: block; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: linear-gradient(135deg, #1e3a8a, #2563eb); view-transition-name: m-tab-ind;
}
.m-person:not([hidden]) .m-cal { view-transition-name: m-cal; }
.m-person:not([hidden]) .m-totales { view-transition-name: m-totales; }

.m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-head h2 { margin: 2px 0 0; font-size: 16px; }
.m-varios.on { background: var(--brand-2); color: #fff; border-color: transparent; }

/* --- Calendario táctil --- */
.m-cal { padding: 12px 10px; }
.m-week, .m-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.m-week span { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.m-day {
  --c: transparent; position: relative; aspect-ratio: 1 / 1.08; min-height: 44px; border-radius: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  transition: transform .15s var(--ease), box-shadow .15s, background .25s;
  touch-action: manipulation;
}
.m-day small { position: absolute; top: 4px; left: 6px; font-size: 10px; font-weight: 600; color: var(--muted); }
.m-day b { font-size: 14px; font-weight: 800; color: var(--c); margin-top: 8px; }
.m-day.we { background: color-mix(in srgb, var(--brand-2) 5%, var(--surface-2)); }
.m-day.has { background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.m-day.today { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand-2) 60%, transparent); }
.m-day.today small { color: var(--brand-2); }
.m-day:active { transform: scale(.94); }
.m-day.picked { box-shadow: 0 0 0 3px var(--brand-2), 0 6px 16px rgba(37, 99, 235, .3); transform: scale(1.04); z-index: 1; }
.m-day.pop { animation: code-pop .35s var(--ease); }
.m-blank { aspect-ratio: 1 / 1.08; }

/* --- Totales de la persona --- */
.m-tot-main { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.m-tot-main > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.m-tot-main b { font-size: 22px; letter-spacing: -.02em; }
.m-tot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-tot-grid > div > span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.m-tot-grid b { font-size: 14px; }
.m-cant i { font-style: normal; }

/* --- Panel inferior de códigos (blur) --- */
.m-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0;
  background: var(--glass-strong); border-top: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(15, 23, 42, .22);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  transform: translateY(110%); transition: transform .32s var(--ease);
}
.m-sheet.open { transform: none; }
.m-sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 10px; }
.m-sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.m-sheet-head b { font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sheet-head .save-state { margin-left: 0; }
.m-x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer; }
.m-codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-codes button {
  --c: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; padding: 6px 4px; border-radius: 14px; cursor: pointer; touch-action: manipulation;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--text);
  transition: transform .12s var(--ease);
}
.m-codes button:active { transform: scale(.93); }
.m-codes b { font-size: 17px; color: var(--c); }
.m-codes small { font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.15; }
.m-codes .m-clear { --c: var(--muted); background: var(--surface); }
body.sheet-open { padding-bottom: 300px; }
body.sheet-open .dock { opacity: 0; pointer-events: none; transform: translateY(20px); }
.dock { transition: opacity .2s, transform .2s; }

/* =====================================================================
   v6 — Identidad: logo $ y verde dólar · Ingreso con billetes voladores
   ===================================================================== */
:root { --money: #15803d; --money-2: #22c55e; --money-bill: #85bb65; --money-soft: #dcfce7; }
@media (prefers-color-scheme: dark) { :root { --money: #22c55e; --money-2: #4ade80; --money-soft: rgba(34, 197, 94, .14); } }

/* Logo en la barra */
.brand-mark { background: none; box-shadow: 0 6px 16px rgba(21, 128, 61, .35); padding: 0; overflow: hidden; }
.brand-mark .logo { width: 100%; height: 100%; display: block; }
.brand-txt b { background: linear-gradient(90deg, var(--brand), var(--money)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: dark) { .brand-txt b { background: linear-gradient(90deg, #93b4ff, #4ade80); -webkit-background-clip: text; background-clip: text; } }

/* Toques de verde dólar en la app (el azul sigue siendo el color principal) */
.kpi:first-child { background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #15803d 130%); }
.kpi:nth-child(2) b, .month b, .m-tot-main b { color: var(--money); }
.bar i { background: linear-gradient(90deg, #1e3a8a, #2563eb 60%, #22c55e); }
.money.strong, .grid td.money.strong { color: var(--money); }
.btn-success { background: linear-gradient(135deg, #15803d, #22c55e); }

/* ---------- Pantalla de ingreso ---------- */
body.login-page {
  overflow-x: hidden;
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(37, 99, 235, .35), transparent 60%),
    radial-gradient(800px 600px at 90% 90%, rgba(34, 197, 94, .35), transparent 60%),
    linear-gradient(160deg, #0b1b4d 0%, #0f2a5f 45%, #0b3b2a 100%);
  background-attachment: fixed;
  color: #e2e8f0;
}
body.login-page .topbar { background: none; border-bottom: 0; }
body.login-page .topbar::before { display: none; }
body.login-page .brand { visibility: hidden; }
body.login-page .foot { color: rgba(226, 232, 240, .55); position: relative; z-index: 1; }
body.login-page .wrap { position: relative; z-index: 1; }

.login-card {
  position: relative; overflow: hidden;
  background: rgba(255, 255, 255, .72); color: #0f172a; border: 1px solid rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  box-shadow: 0 30px 80px rgba(2, 6, 23, .45);
  border-radius: 24px;
}
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, #1e3a8a, #2563eb, #22c55e, #85bb65); }
.login-card .muted { color: #475569; }
.login-card label { color: #475569; }
.login-card input { background: rgba(255, 255, 255, .85); color: #0f172a; border-color: #cbd5e1; }
.login-card h1 { margin: 0; font-size: 28px; background: linear-gradient(90deg, #1e3a8a, #15803d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card .btn-block:not(.btn-ghost) { background: linear-gradient(135deg, #1d4ed8, #15803d); box-shadow: 0 8px 22px rgba(21, 128, 61, .35); }
.login-card .btn-ghost { background: rgba(255, 255, 255, .7); color: #14532d; border-color: #bbf7d0; }
.brand-mark.big { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 6px; animation: logo-float 4s ease-in-out infinite; box-shadow: 0 14px 32px rgba(21, 128, 61, .45); }
@keyframes logo-float { 50% { transform: translateY(-5px) rotate(-3deg); } }
.login-sep { display: flex; align-items: center; gap: 10px; color: #15803d; font-weight: 800; margin: -2px 0 2px; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #86efac, transparent); }
@media (prefers-color-scheme: dark) {
  .login-card { background: rgba(15, 23, 42, .62); color: #e2e8f0; border-color: rgba(148, 163, 184, .25); }
  .login-card .muted, .login-card label { color: #94a3b8; }
  .login-card input { background: rgba(15, 23, 42, .7); color: #e2e8f0; border-color: #334155; }
  .login-card h1 { background: linear-gradient(90deg, #93b4ff, #4ade80); -webkit-background-clip: text; background-clip: text; }
  .login-card .btn-ghost { background: rgba(15, 23, 42, .6); color: #4ade80; border-color: rgba(74, 222, 128, .3); }
}

/* ---------- Billetes con alas volando por el fondo ---------- */
.money-sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bill {
  position: absolute; left: 0; top: var(--y); width: calc(170px * var(--s)); aspect-ratio: 16 / 9;
  opacity: var(--o); filter: blur(var(--b)) drop-shadow(0 10px 14px rgba(2, 6, 23, .35));
  animation: vuelo var(--dur) linear var(--delay) infinite; will-change: transform;
}
.bill svg { width: 100%; height: 100%; overflow: visible; }
.bill .bob { transform-box: view-box; transform-origin: 80px 45px; animation: bob var(--bob) ease-in-out infinite alternate; }
.bill .ala { transform-box: view-box; transform-origin: 48px 44px; animation: aleteo var(--flap) ease-in-out infinite alternate; }
@keyframes vuelo {
  from { transform: translate(-30vw, 12vh); }
  to   { transform: translate(115vw, -40vh); }
}
@keyframes bob {
  from { transform: translateY(-10px) rotate(-9deg); }
  to   { transform: translateY(10px) rotate(5deg); }
}
@keyframes aleteo {
  from { transform: rotate(22deg) scaleY(1.05); }
  to   { transform: rotate(-28deg) scaleY(.55); }
}
@media (max-width: 760px) { .bill { width: calc(120px * var(--s)); } }
@media (prefers-reduced-motion: reduce) { .bill, .bill .bob, .bill .ala, .brand-mark.big { animation: none !important; } .bill { transform: translate(calc(var(--s) * 40vw), 0); } }

/* ---------- v7: billetes voladores también de fondo en la app (versión suave) ---------- */
body.app-sky .wrap, body.app-sky .foot { position: relative; z-index: 1; }
.money-sky.suave .bill {
  opacity: calc(var(--o) * .30);
  filter: blur(calc(var(--b) + 1px)) saturate(.9);
  animation-duration: calc(var(--dur) * 1.6);
}
.money-sky.suave .bill .ala { animation-duration: calc(var(--flap) * 1.4); }
@media (prefers-color-scheme: dark) { .money-sky.suave .bill { opacity: calc(var(--o) * .38); } }
/* Detrás de las tarjetas: se ven pasar entre ellas y por los márgenes */
@media (max-width: 760px) {
  .money-sky.suave .bill:nth-child(n+7) { display: none; }   /* menos billetes en el celular */
}
/* Si se imprime, sin billetes */
@media print { .money-sky { display: none; } }
