:root {
  --ink: #1a0d3d;
  --purple: #2c1a6b;
  --purple-mid: #3d2480;
  --yellow: #f4e400;
  --magenta: #e2187c;
  --green: #3da83a;
  --cream: #fbf7ee;
  --cream-2: #f3ece0;
  --white: #fff;
  --muted: #6b6480;
  --line: rgba(44, 26, 107, 0.12);
  --shadow: 0 18px 40px rgba(26, 13, 61, 0.14);
  --font: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --nav: 56px;
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

#app { min-height: 100dvh; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* LOGIN */
.login {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 80% 0%, rgba(244, 228, 0, 0.22), transparent 32%),
    linear-gradient(180deg, #1a0d3d 0%, #2c1a6b 55%, #1a0d3d 100%);
  color: #fff;
  padding: 36px 22px 28px;
  display: flex;
  flex-direction: column;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-brand img { width: 52px; height: 52px; }
.login-brand strong { display: block; font-size: 1.35rem; letter-spacing: -0.03em; }
.login-brand span { color: rgba(255,255,255,.7); font-size: 0.86rem; }
.login h1 {
  font-family: var(--display);
  font-size: clamp(2.1rem, 8vw, 3.1rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  max-width: 12ch;
  margin-bottom: 12px;
}
.login .lead { color: rgba(255,255,255,.78); max-width: 36ch; margin-bottom: 28px; }
.login-card {
  background: var(--cream);
  color: var(--ink);
  border-radius: 24px;
  padding: 22px;
  margin-top: auto;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--cream-2);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.tabs-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.tabs-3 button { font-size: 0.82rem; padding: 0.65rem 0.2rem; }
.tabs button {
  border-radius: 999px;
  padding: 0.7rem 0.4rem;
  font-weight: 650;
  color: var(--muted);
}
.tabs button.on { background: #fff; color: var(--purple); box-shadow: var(--shadow); }
label { display: block; font-size: 0.82rem; font-weight: 650; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: #fff;
}
input[type="date"] {
  min-height: 48px;
  color: var(--ink);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  font-weight: 700;
  margin-top: 16px;
}
.btn-magenta { background: var(--magenta); color: #fff; }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--purple); }
.btn.btn-void {
  width: auto;
  margin-top: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}
.void-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.void-row:last-child { border-bottom: 0; }
.void-row b { display: block; }
.void-row .muted { display: block; }
.hint { margin-top: 14px; font-size: 0.8rem; color: var(--muted); }
.err { color: var(--magenta); font-size: 0.88rem; margin-top: 8px; }

/* SHELL */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(251,247,238,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .who img {
  width: 36px; height: 36px; object-fit: contain;
  background: #fff; border-radius: 10px; border: 1px solid var(--line);
}
.topbar .who b { display: block; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--green);
}
.live i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px rgba(61,168,58,.2);
  animation: pulse 1.6s infinite;
}
.live.local { color: var(--muted); }
.live.local i { background: var(--muted); box-shadow: none; animation: none; }
@keyframes pulse { 50% { opacity: .45; } }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff;
}

main.pad { padding: 16px 16px calc(var(--nav) + var(--safe) + 18px); }

.hero-num {
  background: var(--purple);
  color: #fff;
  border-radius: 24px;
  padding: 22px;
  margin-bottom: 14px;
}
.hero-num .k { font-size: 0.78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--yellow); font-weight: 700; }
.hero-num .n {
  font-family: var(--display);
  font-size: clamp(3rem, 12vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: .92;
  margin: 8px 0 6px;
}
.hero-num p { color: rgba(255,255,255,.75); }
.dato-hoy { margin-top: 12px; }
.dato-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 8px;
}
.dato-copy {
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
.login-card .dato-hoy { background: #fff; }

.hello {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  color: var(--purple);
}
.rank-line {
  margin-top: 8px !important;
  color: var(--yellow) !important;
  font-weight: 700;
  font-size: 0.92rem;
}
.kpis { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.kpis-4 { grid-template-columns: 1fr 1fr; }
.facts {
  margin: 0 0 8px;
  padding-left: 1.1rem;
  display: grid;
  gap: 8px;
}
.facts li { font-size: 0.92rem; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.chip {
  min-width: 44px;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--cream-2);
  font-weight: 700;
}
.chip.on {
  background: var(--yellow);
  border-color: transparent;
  color: var(--ink);
}
.share-bar {
  height: 12px;
  background: var(--cream-2);
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0 4px;
}
.share-bar i {
  display: block;
  height: 100%;
  background: var(--magenta);
  border-radius: 99px;
  min-width: 0;
}
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 12px;
}
.kpi b { display: block; font-family: var(--display); font-size: 1.25rem; }

.recover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.recover-grid article {
  background: var(--cream-2);
  border-radius: 16px;
  padding: 14px 12px;
}
.recover-grid article.wide { grid-column: 1 / -1; }
.recover-grid .k {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--magenta);
}
.recover-grid .n {
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1;
  margin: 6px 0 4px;
  color: var(--purple);
}
.recover-grid p { font-size: 0.82rem; }
.kpi span { font-size: 0.75rem; color: var(--muted); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 16px; margin-bottom: 12px;
}
.card h2 { font-size: 1rem; margin-bottom: 10px; }

.trust-loop {
  border-color: rgba(226, 24, 124, 0.28);
  background:
    linear-gradient(180deg, rgba(244, 228, 0, 0.22) 0%, #fff 38%);
  margin-bottom: 14px;
}
.trust-loop h2 { margin-bottom: 6px; }
.trust-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.trust-k {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 3px;
}
.trust-v {
  display: block;
  font-family: var(--display);
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  color: var(--purple);
  font-weight: 700;
  line-height: 1.25;
}
.trust-v.is-empty {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--muted);
  font-weight: 650;
}
.trust-item .muted { margin-top: 4px; }
.trust-loop .btn { margin-top: 12px; }
button.trust-open {
  width: 100%;
  text-align: left;
  background: none;
  padding: 0;
  border-radius: 8px;
}
button.trust-open:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 3px;
}
.period-tabs { margin-bottom: 14px; }

.tank-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 4px;
}
.tank-teaser {
  border-color: rgba(61, 168, 58, 0.28);
  background:
    linear-gradient(180deg, rgba(61, 168, 58, 0.12) 0%, #fff 42%);
}
.tank-teaser h2,
.tank-guide h2 {
  font-family: var(--display);
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  color: var(--purple);
  margin-bottom: 6px;
}
.tank-teaser .btn { margin-top: 12px; }
.tank-teaser.is-compact h2 { font-size: 1.12rem; }
.tank-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}
.tank-cols {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.tank-list {
  border-radius: 16px;
  padding: 12px 14px 14px;
}
.tank-list h3 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.tank-list ul {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 7px;
}
.tank-list li {
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.25;
}
.tank-list.is-yes {
  background: rgba(61, 168, 58, 0.1);
  border: 1px solid rgba(61, 168, 58, 0.28);
}
.tank-list.is-yes h3 { color: #246e22; }
.tank-list.is-no {
  background: rgba(226, 24, 124, 0.08);
  border: 1px solid rgba(226, 24, 124, 0.22);
}
.tank-list.is-no h3 { color: var(--magenta); }
.tank-guide .btn { margin-top: 14px; }

.receipt-card {
  border-color: rgba(44, 26, 107, 0.22);
  background:
    linear-gradient(180deg, rgba(44, 26, 107, 0.07) 0%, #fff 30%);
}
.receipt-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 4px;
}
.receipt-card h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--purple);
  margin-bottom: 8px;
}
.receipt-date {
  font-weight: 650;
  color: var(--ink);
}
.receipt-kg {
  font-family: var(--display);
  font-size: clamp(2.2rem, 10vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--purple);
  margin: 8px 0 14px;
}
.receipt-dl {
  display: grid;
  gap: 0;
  margin: 0;
}
.receipt-dl > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  align-items: baseline;
}
.receipt-dl dt {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.receipt-dl dd {
  margin: 0;
  font-weight: 650;
  color: var(--ink);
}
.receipt-photo {
  margin: 14px 0 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--cream-2);
}
.receipt-photo img {
  width: 100%;
  height: auto;
  display: block;
}
.receipt-card .btn { margin-top: 14px; }
.row {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.muted { color: var(--muted); font-size: 0.88rem; }
.tag {
  display: inline-block; background: var(--yellow); color: var(--ink);
  font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: .22rem .55rem;
}
.tag.pink { background: #f8c1dc; }
.tag.green { background: #cceecb; }
.tag.purple { background: #ddd4f5; }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 88px 1fr 52px; gap: 8px; align-items: center; font-size: 0.82rem; }
.bar i { display: block; height: 10px; background: var(--cream-2); border-radius: 99px; overflow: hidden; }
.bar i b { display: block; height: 100%; background: var(--magenta); border-radius: 99px; }

.week { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 110px; margin-top: 8px; }
.week button {
  width: 100%;
  background: var(--purple);
  border: 0;
  border-radius: 8px 8px 4px 4px;
  min-height: 6px;
  padding: 0;
  cursor: pointer;
}
.week button.on { background: var(--yellow); }
.week-readout {
  margin-top: 12px;
  font-weight: 700;
  color: var(--purple);
  font-size: 0.95rem;
}

.register { margin-top: 8px; }
.register-head,
.register-row {
  display: grid;
  grid-template-columns: 1fr 64px auto;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.register-head {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 6px;
}
.register-row:last-child { border-bottom: 0; }
.register-row b { display: block; }
.register-row .muted { display: block; }
button.register-row {
  width: 100%;
  text-align: left;
  background: none;
  font: inherit;
  color: inherit;
  border-radius: 0;
  cursor: pointer;
}
button.register-row:hover,
button.register-row:focus-visible {
  background: rgba(244, 228, 0, 0.18);
}
button.register-row:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 2px;
}

.list-item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.list-item b { display: block; }
.kg { font-family: var(--display); font-size: 1.2rem; color: var(--purple); }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--cream);
  border-top: 1px solid var(--line);
  padding: 8px 4px calc(10px + var(--safe));
}
.bottom button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 6px 2px;
  background: none;
  border-radius: 0;
}
.bottom button:nth-child(1) { color: var(--magenta); }
.bottom button:nth-child(2) { color: #c27800; }
.bottom button:nth-child(3) { color: var(--green); }
.bottom button:nth-child(4) { color: var(--purple); }
.bottom button.on {
  text-decoration: underline;
  text-underline-offset: 4px;
  background: none;
}

.form-note { font-size: 0.84rem; color: var(--muted); margin-top: 8px; }
.status { font-weight: 700; font-size: 0.78rem; }
.status.pendiente { color: #c27800; }
.status.en_ruta { color: var(--purple); }
.status.completada { color: var(--green); }

.client-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.client-tile {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; text-align: left;
}
.client-tile img { height: 40px; width: auto; max-width: 100%; object-fit: contain; margin-bottom: 8px; }
.client-tile.on { border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(226,24,124,.15); }

@media (min-width: 880px) {
  body { background: #ece4d4; }
  #app { max-width: 430px; margin: 0 auto; background: var(--cream); box-shadow: var(--shadow); min-height: 100dvh; }
}


/* Monthly share card (Impacto) */
.share-month { padding: 14px; }
.share-preview {
  background:
    radial-gradient(circle at 90% 0%, rgba(244, 228, 0, 0.18), transparent 34%),
    linear-gradient(180deg, #2c1a6b 0%, #2c1a6b 118px, #fbf7ee 118px, #fbf7ee 100%);
  border-radius: 22px;
  padding: 18px 16px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
}
.share-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  min-height: 86px;
}
.share-kicker {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 4px;
}
.share-preview h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: #fff;
  margin: 0 0 4px;
}
.share-client {
  color: rgba(255,255,255,0.78);
  font-size: 0.9rem;
  margin: 0;
}
.share-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 4px;
}
.share-kg {
  margin: 22px 0 14px;
}
.share-kg b {
  display: block;
  font-family: var(--display);
  font-size: clamp(2.6rem, 12vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--purple);
}
.share-kg span {
  display: block;
  margin-top: 6px;
  font-weight: 700;
  color: var(--magenta);
  font-size: 0.88rem;
}
.share-empty {
  margin: 22px 0 14px;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.3;
}
.share-month.is-empty .share-tiles b { color: var(--muted); }
.share-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.share-tiles > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 8px;
}
.share-tiles b {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--purple);
}
.share-tiles span {
  font-size: 0.7rem;
  color: var(--muted);
}
.share-extra {
  margin-top: 12px;
  font-weight: 700;
  color: var(--purple);
  font-size: 0.9rem;
}
.share-last {
  margin-top: 12px;
  font-weight: 650;
  color: var(--purple);
  font-size: 0.9rem;
}
.share-foot {
  margin-top: 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--purple);
}
.share-actions { margin-top: 4px; }
.share-actions .btn { margin-top: 10px; }
.share-actions .btn:disabled { opacity: 0.6; cursor: wait; }

@media print {
  .share-actions, #shareWa, #shareImg, #shareWaWeek, #shareImgWeek { display: none !important; }
}

@media print {
  .topbar, .bottom, .btn, .icon-btn { display: none !important; }
  main.pad { padding: 0; }
  body, #app { background: #fff; box-shadow: none; max-width: none; }
}
