:root {
  --ground: #F3F3F1;
  --panel: #FFFFFF;
  --panel-2: #EEEEEB;
  --panel-3: #E4E4E0;
  --ink: #0C0C0B;
  --ink-2: #2B2B28;
  --muted: #5F5F59;
  --line: #DCDCD6;
  --line-2: #C9C9C2;
  --sun: #FFE500;
  --sun-deep: #F2D600;
  --sun-soft: #FFF6B0;
  --sun-wash: #FFFBDD;
  --danger: #B3261E;
  --serif: 'Nyght Serif', 'Times New Roman', serif;
  --sans: 'Heros', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(12,12,11,.04), 0 8px 28px -12px rgba(12,12,11,.14);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
::selection { background: var(--sun); color: var(--ink); }
input, select, button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.login[hidden], .toast[hidden] { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--ground); }

/* ---------- Brand decoration ---------- */
.ribbon {
  position: fixed; inset: 0 auto 0 0; width: 44px; z-index: 1;
  overflow: hidden; pointer-events: none;
}
.ribbon-track {
  position: absolute; left: 50%; bottom: 0;
  transform-origin: 0 0; transform: rotate(-90deg) translate(0, -50%);
  white-space: nowrap; font-size: 19px; letter-spacing: .32em; color: var(--ink-2);
  line-height: 1;
}
.ribbon-track b { font-weight: 700; letter-spacing: -.01em; margin-right: .45em; font-size: 22px; color: var(--ink); }
.ribbon-track i { font-style: normal; margin-right: 1.1em; }

.deco-star {
  position: fixed; z-index: 0; pointer-events: none;
  filter: drop-shadow(0 0 40px rgba(255, 229, 0, .55)) blur(.4px);
}
.deco-star--tr { width: 360px; height: 360px; top: -185px; right: -175px; transform: rotate(14deg); opacity: .9; }
.deco-star--bl { width: 260px; height: 260px; bottom: -120px; left: -70px; transform: rotate(-8deg); opacity: .85; }

/* ---------- Layout ---------- */
.app {
  position: relative; z-index: 2;
  padding: 26px 32px 32px 76px;
  max-width: 1840px; margin: 0 auto;
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  flex-wrap: wrap; margin-bottom: 26px;
}
.brand { display: flex; align-items: center; gap: 24px; min-width: 0; }
.brand-logo { height: 52px; width: auto; display: block; }
.brand-text { border-left: 1px solid var(--line-2); padding-left: 24px; }
.brand-text h1 {
  font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; margin: 0;
  letter-spacing: -.035em;
}
.brand-text p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.apps { display: inline-flex; gap: 2px; background: var(--panel-2); border-radius: 999px; padding: 3px; margin-top: 8px; }
.apps a { font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-decoration: none; padding: 5px 14px; border-radius: 999px; }
.apps a:hover { background: var(--panel); }
.apps a[aria-current="page"] { background: var(--ink); color: var(--sun); }
.apps + p { margin-top: 4px !important; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.period {
  display: flex; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; height: 44px;
}
.period select, .period input {
  border: 0; background: transparent; height: 36px; padding: 0 12px; border-radius: 999px;
  font-weight: 700; font-size: 15px;
}
.period select { padding-right: 6px; }
.period input { width: 78px; font-variant-numeric: tabular-nums; border-left: 1px solid var(--line); border-radius: 0 999px 999px 0; }
.period select:focus-visible, .period input:focus-visible { outline-offset: -2px; }

.work {
  display: grid;
  grid-template-columns: 290px minmax(460px, 1fr) minmax(420px, 560px);
  gap: 20px; align-items: start;
}
.col { min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; white-space: nowrap; user-select: none;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-sun { background: var(--sun); color: var(--ink); border-color: rgba(12,12,11,.1); box-shadow: 0 6px 18px -8px rgba(212, 186, 0, .9); }
.btn-sun:hover:not([disabled]) { background: var(--sun-deep); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-2); }
.btn-ghost { background: var(--panel); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { background: var(--panel-2); }
.btn-icon { width: 44px; padding: 0; background: var(--panel); border-color: var(--line); }
.btn-icon.btn-sm { width: 36px; }
.btn-icon.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-icon.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-icon:hover { border-color: var(--ink); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-sm .ic { width: 16px; height: 16px; }
.ic-inline { width: 14px; height: 14px; vertical-align: -2px; }
.btn.is-busy { pointer-events: none; }

/* ---------- Worker list ---------- */
.col-list {
  background: var(--panel-2); border-radius: var(--r-lg); padding: 18px 14px 12px;
  position: sticky; top: 20px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 14px; gap: 10px; }
.col-head h2 { white-space: nowrap; }
.col-head h2, .preview-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 28px; letter-spacing: -.03em; margin: 0; line-height: 1.05;
}
.count {
  font-family: var(--sans); font-size: 12px; font-weight: 700; background: var(--ink); color: var(--sun);
  border-radius: 999px; padding: 2px 8px; vertical-align: 6px; margin-left: 4px; font-variant-numeric: tabular-nums;
}
.wlist { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.witem {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  padding: 11px 8px 11px 14px; border-radius: var(--r-md); cursor: pointer;
  transition: background-color .18s var(--ease);
}
.witem + .witem { margin-top: 2px; }
.witem:hover { background: rgba(255,255,255,.7); }
.witem.is-active { background: var(--sun); }
.witem-main { min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.witem-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.witem-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; white-space: nowrap; overflow: hidden; }
.witem.is-active .witem-meta { color: var(--ink-2); }
.witem-meta .witem-neto { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 700; margin-left: auto; }
.witem-dl {
  width: 34px; height: 34px; border-radius: 999px; border: 0; background: transparent; display: grid; place-items: center;
  color: var(--ink-2); opacity: .6; transition: opacity .15s, background-color .15s;
}
.witem:hover .witem-dl, .witem.is-active .witem-dl, .witem-dl:focus-visible { opacity: 1; }
.witem-dl:hover { background: rgba(12,12,11,.08); }
.witem-warn { color: var(--danger); font-weight: 700; }

.list-empty { padding: 20px 10px 26px; text-align: center; color: var(--muted); font-size: 13.5px; }
.list-empty p { margin: 4px 0; max-width: 28ch; margin-inline: auto; }
.list-empty-title { font-family: var(--serif); font-size: 21px; color: var(--ink); letter-spacing: -.02em; }
.list-empty-star { width: 34px; height: 34px; color: var(--sun-deep); margin-bottom: 6px; }
.list-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 0; margin-top: 8px; border-top: 1px solid var(--line); gap: 8px; }
.list-total { white-space: nowrap; font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.list-total b { color: var(--ink); }

/* ---------- Form ---------- */
.col-form { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 26px 28px 30px; }
.form-empty { padding: 56px 12px 64px; max-width: 46ch; }
.form-empty h2 { font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1; letter-spacing: -.035em; margin: 0 0 16px; }
.form-empty p { color: var(--muted); margin: 0 0 26px; }
.form-empty-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.wform-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
.wform-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.02; letter-spacing: -.035em; margin: 0;
  text-wrap: balance;
}
.wform-sub { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.wform-tools { display: flex; gap: 6px; }

.fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.fs + .fs { margin-top: 30px; }
.wform .fs:first-of-type { margin-top: 22px; }
.fs legend {
  font-family: var(--serif); font-size: 22px; letter-spacing: -.02em; padding: 0; margin-bottom: 12px; line-height: 1.1;
}
.grid { display: grid; gap: 12px; }
.grid + .grid { margin-top: 12px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g31 { grid-template-columns: 3fr 1fr; }
.g1 { grid-template-columns: 1fr; }
.g13 { grid-template-columns: 1fr 3fr; }
.list-exports { display: flex; gap: 6px; padding: 10px 0 2px; flex-wrap: wrap; }
.list-exports .btn { flex: 1; padding: 0 10px; }
.plame-table input { width: 90px; }
.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn[hidden] { display: none; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f > span { font-size: 12.5px; color: var(--muted); }
.f input, .f select, .mrow input, .mrow-label input {
  height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel);
  padding: 0 12px; width: 100%; min-width: 0;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.f input:hover, .f select:hover { border-color: var(--line-2); }
.f input:focus, .f select:focus, .mrow input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun-soft); }
.f select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230C0C0B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.period select { appearance: none; -webkit-appearance: none; padding-right: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230C0C0B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 6px center / 15px;
}
input[type=number] { font-variant-numeric: tabular-nums; }
input::placeholder { color: #8A8A83; }
.f input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--danger); }

.checks { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; }
.chk { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.chk input {
  appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 7px; margin: 0;
  border: 1.5px solid var(--line-2); background: var(--panel); display: grid; place-items: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.chk input::after { content: ''; width: 10px; height: 6px; border: 2px solid var(--ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .18s var(--ease); }
.chk input:checked { background: var(--sun); border-color: var(--ink); }
.chk input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }

.hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; max-width: 72ch; }
.fs-money > .hint { margin: 0 0 16px; }
.tag-auto {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--panel-2); color: var(--muted); padding: 2px 8px; border-radius: 6px; vertical-align: 1px;
}

/* ---------- Money tables ---------- */
.money-groups { display: grid; gap: 14px; }
.mgroup { background: var(--panel-2); border-radius: var(--r-md); padding: 14px 14px 8px; }
.mgroup-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 8px; }
.mgroup-head h3 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.mgroup-head output { font-weight: 700; font-variant-numeric: tabular-nums; }
.mrow {
  display: grid; grid-template-columns: 1fr 52px 150px 36px; gap: 8px; align-items: center;
  padding: 4px 4px; border-top: 1px solid var(--line);
}
.mrow:first-child { border-top: 0; }
.mrow[hidden] { display: none; }
.mrow-label { font-size: 14px; min-width: 0; }
.mrow-label small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.mrow-label input { height: 36px; font-size: 14px; }
.mrow input.amt { height: 36px; text-align: right; font-variant-numeric: tabular-nums; padding: 0 10px; }
.mrow.is-manual input.amt { background: var(--sun-wash); border-color: var(--sun-deep); }
.mrow-tag { justify-self: end; }
.mrow-tag .tag-manual { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--sun); padding: 2px 8px; border-radius: 6px; }
.mrow-act {
  width: 32px; height: 32px; border-radius: 999px; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted);
}
.mrow-act:hover { background: var(--panel-3); color: var(--ink); }
.mrow-act[hidden] { visibility: hidden; display: grid; }
.mrow-extra-afecto { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; }
.add-extra { margin: 4px 0 2px; }

.neto {
  margin-top: 16px; display: flex; justify-content: space-between; align-items: center;
  background: var(--ink); color: #fff; border-radius: var(--r-md); padding: 16px 20px;
}
.neto span { font-family: var(--serif); font-size: 24px; letter-spacing: -.02em; }
.neto output { font-size: 28px; font-weight: 700; color: var(--sun); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.neto.is-negative output { color: #FF8A80; }

/* ---------- Preview ---------- */
.col-preview { position: sticky; top: 20px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.sheet-frame {
  position: relative; border-radius: 6px; overflow: hidden; background: #fff;
  box-shadow: 0 1px 2px rgba(12,12,11,.06), 0 24px 50px -20px rgba(12,12,11,.28);
}
.sheet-scale { transform-origin: 0 0; width: 794px; }
.sheet-empty {
  width: 794px; height: 1123px; display: grid; place-items: center; color: var(--muted);
  font-family: var(--serif); font-size: 40px; letter-spacing: -.02em; background: #fff;
}

#renderHost { position: fixed; left: -20000px; top: 0; width: 794px; pointer-events: none; }

.fab-preview { display: none; }


/* ---------- Resumen del mes ---------- */
.work.is-dash .col-preview { display: none; }
.work.is-dash .col-form { grid-column: 2 / -1; background: transparent; box-shadow: none; padding: 0; }
.dash-link {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left;
  padding: 11px 14px; border-radius: var(--r-md); font-weight: 700; font-size: 14.5px; margin-bottom: 6px;
  transition: background-color .18s var(--ease);
}
.dash-link:hover { background: rgba(255,255,255,.7); }
.dash-link.is-active { background: var(--sun); }
.dash-link[hidden] { display: none; }
.list-sum { margin: 8px 0 0; padding: 10px 8px 0; border-top: 1px solid var(--line); display: grid; gap: 3px; font-size: 13px; font-variant-numeric: tabular-nums; }
.list-sum div { display: flex; justify-content: space-between; gap: 10px; }
.list-sum dt { color: var(--muted); }
.list-sum dd { margin: 0; font-weight: 700; }
.list-sum .is-total { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 14px; }
.list-sum .is-total dt { color: var(--ink); font-weight: 700; }
.list-sum:empty { display: none; }

.dash { display: grid; gap: 16px; }
.dash-head h2 { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1.02; letter-spacing: -.035em; margin: 0; }
.dash-card { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 22px 24px 24px; min-width: 0; }
.dash-card h3 { font-family: var(--serif); font-weight: 400; font-size: 25px; letter-spacing: -.02em; margin: 0 0 14px; line-height: 1.1; }
.dash-card > .hint:not(:last-child) { margin-bottom: 12px; }
.dash-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.dash-main, .dash-side { display: grid; gap: 16px; min-width: 0; }

.pagos { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.pagos th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12.5px; padding: 0 10px 8px 0; }
.pagos td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.pagos td small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.pagos .num { text-align: right; white-space: nowrap; font-weight: 700; }
.pagos th.num { font-weight: 400; }
.pagos .donde { color: var(--muted); font-size: 13px; padding-left: 18px; }
.pagos tr.is-muted td { color: var(--muted); }
.pagos tr.is-muted td b { font-weight: 400; }
.pagos tfoot th, .pagos tfoot td { border-top: 2px solid var(--ink); padding-top: 12px; color: var(--ink); font-size: 15px; }
.pagos tfoot th { font-weight: 700; }
.pagos tfoot td.num { font-size: 20px; }
.pagos tfoot .donde { font-size: 12.5px; color: var(--muted); font-weight: 400; }

.legend { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(12,12,11,.12); }
.bars { display: grid; gap: 4px; }
.bar-row {
  display: grid; grid-template-columns: minmax(110px, 30%) 1fr auto; align-items: center; gap: 12px;
  border: 0; background: transparent; padding: 6px 6px; border-radius: 10px; text-align: left; width: 100%;
}
.bar-row:hover, .bar-row:focus-visible { background: var(--panel-2); }
.bar-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 16px; display: block; }
.bar-fill { display: flex; gap: 2px; height: 100%; min-width: 6px; }
.bar-fill span { display: block; height: 100%; min-width: 2px; box-shadow: inset 0 0 0 1px rgba(12,12,11,.08); }
.bar-fill span:last-child { border-radius: 0 4px 4px 0; }
.bar-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.costo-tbl { font-size: 13px; }

.seg { display: flex; gap: 2px; height: 14px; margin-bottom: 12px; }
.seg span:first-child { border-radius: 4px 0 0 4px; }
.seg span:last-child { border-radius: 0 4px 4px 0; }
.seg span:only-child { border-radius: 4px; }
.s-ok { background: #2E7D4F; }
.s-pend { background: #E08A00; }
.s-none { background: #CFCFC8; }
.seg-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.seg-legend li { display: flex; align-items: center; gap: 8px; }
.seg-legend i { width: 10px; height: 10px; border-radius: 3px; }
.seg-legend b { font-variant-numeric: tabular-nums; min-width: 1.5ch; }
.link { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; text-align: left; }
.link:hover { text-decoration-color: var(--ink); }
.avisos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.avisos li { display: flex; gap: 10px; align-items: baseline; }
.avisos li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); background: var(--line-2); }
.avisos .av-cumple::before, .avisos .av-aniv::before { background: var(--sun-deep); }
.avisos .av-dato::before, .avisos .av-cese::before { background: #E08A00; }
.avisos .av-nuevo::before { background: #2E7D4F; }

.cols { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.col-bar { flex: 1; max-width: 64px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; position: relative; border-radius: 6px; outline-offset: 2px; }
.col-bar:hover .col-fill { background: var(--sun-deep); }
.col-fill { display: block; background: var(--ink); border-radius: 4px 4px 0 0; min-height: 3px; transition: background-color .15s; }
.col-lbl { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.tip {
  position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: #fff; border-radius: 12px;
  padding: 10px 12px; font-size: 12.5px; display: grid; gap: 4px; min-width: 210px; box-shadow: 0 12px 30px -10px rgba(12,12,11,.5);
  font-variant-numeric: tabular-nums;
}
.tip b { font-size: 13px; margin-bottom: 2px; }
.tip span { display: flex; align-items: center; gap: 6px; color: #DADAD3; }
.tip i { width: 8px; height: 8px; border-radius: 2px; }
.tip em { font-style: normal; margin-left: auto; padding-left: 14px; color: #fff; font-weight: 700; }
.tip .tip-total { border-top: 1px solid rgba(255,255,255,.18); padding-top: 4px; margin-top: 2px; color: #fff; }
.tip[hidden] { display: none; }

@media (max-width: 1180px) {
  .work.is-dash .col-form { grid-column: auto; }
  .dash-grid { grid-template-columns: 1fr; }
  /* una sola columna: intercala las tarjetas en su orden de lectura */
  .dash-main, .dash-side { display: contents; }
  .dc-1 { order: 1; } .dc-2 { order: 2; } .dc-3 { order: 3; } .dc-4 { order: 4; }
  .dc-5 { order: 5; } .dc-6 { order: 6; } .dc-7 { order: 7; } .dc-8 { order: 8; }
}
@media (max-width: 820px) {
  .dash-head h2 { font-size: 34px; }
  .dash-card { padding: 18px 16px 20px; }
  .pagos .donde, .pagos thead th:last-child { display: none; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .work.is-dash ~ .fab-preview, body:has(.work.is-dash) .fab-preview { display: none; }
}


.st { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); white-space: nowrap; margin: 0; }
.st-ok { background: #E3F1E8; color: #1F5E3A; }
.st-warn { background: #FFF1D6; color: #8A5200; }
.st-bad { background: #FBE4E2; color: #9A1F18; }
p.st { margin-top: 8px; }
.venc { list-style: none; margin: 0; padding: 0; display: grid; }
.venc li { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.venc li:first-child { border-top: 0; padding-top: 0; }
.venc-chk { margin-top: 1px; }
.venc-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.venc-top b { font-size: 14px; }
.venc small { color: var(--muted); font-size: 12.5px; }
.venc li.is-done b, .venc li.is-done small { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.venc-missing { color: #8A5200; }
.venc-date { margin-top: 6px; height: 34px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; font: inherit; font-size: 13px; }
.comp-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.comp-head b { display: block; font-size: 20px; }
.comp-head .muted-num { color: var(--muted); }
.comp-lbl { font-size: 12.5px; color: var(--muted); }
.comp-delta { margin: 4px 0 12px; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.comp-pct { color: var(--muted); font-weight: 400; }
.comp-sub { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.drivers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.drivers li { display: flex; justify-content: space-between; gap: 10px; }
.d-up, .d-down, .d-flat { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-weight: 700; }
.d-up { color: #9A1F18; }
.d-down { color: #1F5E3A; }
.d-flat { color: var(--muted); font-weight: 400; }
.d-up .ic, .d-down .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.proy-total { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hatch { background: repeating-linear-gradient(135deg, #B9B9B2 0 4px, var(--panel-3) 4px 7px) !important; }
.legend i.hatch { display: inline-block; }
.cols-12 { gap: 6px; }
.cols-12 .col-bar { max-width: none; }
.col-bar.is-now .col-lbl { color: var(--ink); font-weight: 700; }
.col-bar:hover .col-fill.hatch { filter: brightness(.92); }
.ratio { margin: 14px 0 6px; }
.ratio-num { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ratio-num b { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ratio-num span { color: var(--muted); font-size: 13.5px; }
.ratio-bar { position: relative; height: 10px; background: var(--panel-2); border-radius: 999px; margin-top: 12px; }
.ratio-bar span { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 999px; }
.ratio-bar i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--danger); }
.ratio-meta { margin: 12px 0 10px; }
.ventas-tbl { margin: 4px 0 8px; font-size: 13px; }
.ventas-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ventas-grid input { height: 36px !important; font-size: 13px; }
.dash-card .f input { height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; width: 100%; font-variant-numeric: tabular-nums; }
.dash-card .f input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun-soft); }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(12,12,11,.28); z-index: 40; opacity: 0; transition: opacity .3s var(--ease); }
.drawer-scrim.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 41;
  background: var(--ground); box-shadow: -20px 0 60px -20px rgba(12,12,11,.3);
  transform: translateX(104%); transition: transform .45s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px 14px; }
.drawer-head h2 { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -.035em; margin: 0; }
.drawer-body { overflow-y: auto; padding: 4px 26px 40px; }
.drawer-body .fs { background: var(--panel); border-radius: var(--r-md); padding: 18px 18px 20px; }
.drawer-body .fs + .fs { margin-top: 14px; }
.drawer-body .fs legend { float: left; width: 100%; margin-bottom: 4px; }
.drawer-body .fs legend + * { clear: both; }
.drawer-body .hint { margin: 0 0 12px; }
.drawer-body .f + .f, .drawer-body .grid + .f, .drawer-body .f + .grid { margin-top: 12px; }
.sig-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.sig-preview {
  width: 220px; height: 90px; border: 1px dashed var(--line-2); border-radius: var(--r-sm);
  display: grid; place-items: center; background: #fff; color: var(--muted); font-size: 13px; overflow: hidden;
}
.sig-preview img { max-width: 92%; max-height: 82px; }
.sig-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.afp-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.afp-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 400; padding: 0 0 6px; }
.afp-table td { padding: 4px 0; border-top: 1px solid var(--line); }
.afp-table td:first-child { font-weight: 700; }
.afp-table input { height: 36px; width: 120px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; text-align: right; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Login & nube ---------- */
body.is-locked .app, body.is-locked .fab-preview { visibility: hidden; }
.login {
  position: fixed; inset: 0; z-index: 70; display: flex; overflow-y: auto; overscroll-behavior: contain;
}
.login-wrap {
  margin: auto; width: 100%; max-width: 1220px;
  padding: 32px 48px 32px 104px;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-areas: "intro card" "uses card";
  column-gap: clamp(40px, 6vw, 104px); row-gap: 30px; align-items: start;
}

/* Lado izquierdo: como las publicaciones de la marca */
.login-intro { grid-area: intro; min-width: 0; }
.login-brand { display: block; height: 52px; width: auto; margin: 0 0 30px -4px; }
.login-headline {
  font-family: var(--serif); font-weight: 400; margin: 0;
  font-size: clamp(54px, 5.4vw, 88px); line-height: .94; letter-spacing: -.038em; color: var(--ink);
}
.login-headline span { display: block; white-space: nowrap; }
.login-place {
  display: flex; align-items: center; gap: 8px; margin: 22px 0 0;
  font-size: 14px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink);
}
.login-place .ic { width: 20px; height: 20px; stroke-width: 1.8; }
.login-desc { margin: 18px 0 0; max-width: 44ch; font-size: 18px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

/* «Para qué sirve»: el panel gris de «Requisitos» */
.login-uses { grid-area: uses; background: var(--panel-2); border-radius: var(--r-lg); padding: 26px 32px 22px; max-width: 640px; }
.login-uses h2 { font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.05; letter-spacing: -.03em; margin: 0 0 16px; }
.login-uses ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.login-uses li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 14px; align-items: start; }
.login-uses li svg { width: 18px; height: 18px; margin-top: 3px; filter: drop-shadow(0 1px 2px rgba(184, 159, 0, .35)); }
.login-uses li p { margin: 0; font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.login-uses li b { color: var(--ink); font-weight: 700; }
.login-trust { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--muted); }

/* Tarjeta de ingreso */
.login-card {
  grid-area: card; align-self: center; position: relative; width: 100%;
  background: var(--panel); border-radius: var(--r-lg);
  box-shadow: 0 2px 4px rgba(12,12,11,.04), 0 24px 60px -24px rgba(12,12,11,.28);
  padding: 34px 32px 30px; display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1; letter-spacing: -.035em; margin: 0; }
.login-lead { margin: -4px 0 8px; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.login-card .btn { margin-top: 6px; height: 50px; font-size: 15.5px; }
.login-err { margin: 0; color: var(--danger); font-size: 13.5px; }
.login-err.is-ok { color: #1F5E3A; }
.login [hidden] { display: none !important; }
.login-forgot { align-self: center; font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.login-new { display: flex; flex-direction: column; gap: 14px; }

/* Un solo momento de movimiento: las estrellas se acomodan al abrir */
body.is-locked .deco-star--tr { animation: star-tr 1.6s cubic-bezier(.16, 1, .3, 1) both; }
body.is-locked .deco-star--bl { animation: star-bl 1.8s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes star-tr { from { transform: rotate(-22deg) scale(.82); } }
@keyframes star-bl { from { transform: rotate(-40deg) scale(.8); } }

@media (max-width: 980px) {
  .login-wrap {
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "card" "uses";
    padding: 40px 40px 48px 84px; row-gap: 28px; max-width: 680px;
  }
  .login-brand { margin-bottom: 30px; }
  .login-card { align-self: stretch; }
  .login-uses { max-width: none; }
}
@media (max-width: 720px) {
  .login-wrap { padding: 28px 16px 40px; row-gap: 22px; }
  .login-brand { height: 44px; margin-bottom: 26px; }
  .login-headline { font-size: clamp(40px, 12.4vw, 60px); }
  .login-headline span { white-space: normal; }
  .login-place { margin-top: 16px; font-size: 13px; }
  .login-desc { font-size: 16px; margin-top: 12px; }
  .login-card { padding: 26px 20px 22px; }
  .login-card h1 { font-size: 38px; }
  .login-uses { padding: 24px 20px 20px; }
  .login-uses h2 { font-size: 32px; margin-bottom: 14px; }
  .login-uses li p { font-size: 15px; }
}

.cloud {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 4px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap;
}
.cloud[hidden] { display: none; }
.cloud i { width: 8px; height: 8px; border-radius: 50%; background: #2E7D4F; flex: none; }
.cloud[data-kind="pending"] i { background: var(--sun-deep); box-shadow: 0 0 0 3px var(--sun-soft); }
.cloud[data-kind="error"] i { background: var(--danger); }
.cloud[data-kind="error"] { color: var(--danger); }

.hist { list-style: none; margin: 12px 0 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.hist li small { display: block; color: var(--muted); font-size: 12px; }
.hist b { font-variant-numeric: tabular-nums; }
.hist-sent { color: #2E7D4F; }
.hist-pend { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.wbadge { font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 1px 7px; border-radius: 999px; background: rgba(12,12,11,.08); color: var(--ink-2); flex: none; }
.wbadge.is-ok { background: #2E7D4F; color: #fff; }
.witem.is-active .wbadge:not(.is-ok) { background: rgba(12,12,11,.12); }
.hist-empty { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 60; transform: translate(-50%, 16px); opacity: 0;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 10px 10px 20px;
  display: flex; align-items: center; gap: 14px; font-size: 14px; max-width: calc(100vw - 32px);
  box-shadow: 0 16px 40px -12px rgba(12,12,11,.5);
  transition: transform .35s var(--ease), opacity .35s var(--ease);
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast button { background: var(--sun); color: var(--ink); border: 0; border-radius: 999px; height: 32px; padding: 0 14px; font-weight: 700; font-size: 13px; }
.toast:not(:has(button:not([hidden]))) { padding-right: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1440px) {
  .work { grid-template-columns: 270px minmax(420px, 1fr) minmax(360px, 440px); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .work { grid-template-columns: 260px minmax(0, 1fr); }
  .col-preview { grid-column: 1 / -1; position: static; max-width: 700px; justify-self: center; width: 100%; }
}
@media (max-width: 820px) {
  .cloud { order: -1; flex: 1 1 100%; }
  .app { padding: 18px 16px 90px; }
  .ribbon { display: none; }
  .deco-star--tr { width: 220px; height: 220px; top: -110px; right: -100px; }
  .deco-star--bl { display: none; }
  .top { gap: 16px; }
  .brand { gap: 14px; }
  .brand-logo { height: 38px; }
  .brand-text { padding-left: 14px; }
  .brand-text h1 { font-size: 30px; }
  .brand-text p { font-size: 12px; }
  .top-actions { width: 100%; }
  .top-actions .btn-ghost { flex: 1; padding: 0 12px; }
  #btnZip { flex: 1; }
  .work { grid-template-columns: 1fr; gap: 16px; }
  .col-list { position: static; max-height: none; }
  .wlist { max-height: 300px; }
  .col-form { padding: 20px 16px 24px; }
  .wform-head h2 { font-size: 32px; }
  .form-empty h2 { font-size: 36px; }
  .g2, .g3, .g4, .g31, .g13 { grid-template-columns: 1fr 1fr; }
  .mrow { grid-template-columns: 1fr 120px 32px; }
  .mrow-tag { display: none; }
  .fab-preview { display: inline-flex; position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: 0 12px 30px -10px rgba(12,12,11,.5); }
  .neto output { font-size: 24px; }
}
@media (max-width: 480px) {
  .g2, .g3, .g4, .g31, .g13 { grid-template-columns: 1fr; }
  .period { flex: 1 1 100%; }
  .period select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
