/* =====================================================================
   Cobrao · Panel (herramienta seria)
   Reglas: limpio, rápido, sin historieta. Plus Jakarta Sans en todo.
   Coby y Baloo 2 SOLO en estados vacíos y en "Pago confirmado".
   ===================================================================== */
body.appx {
  --bg: #F7F4EE;
  --card: #FFFFFF;
  --ink: #16202E;
  --ink-2: #475467;
  --muted: #667085;
  --line: #ECE7DD;
  --line-2: #F2EEE6;
  --brand: #0E7A4F;
  --brand-ink: #FFFFFF;
  --brand-soft: #E7F4EC;
  --warn: #B45309;
  --warn-soft: #FEF3E2;
  --bad: #B42318;
  --bad-soft: #FEEDEB;
  --info: #175CD3;
  --info-soft: #EAF1FD;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 16px 32px -8px rgba(16, 24, 40, .16);
  --r-sm: 12px; --r-md: 16px; --r-lg: 22px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-feature-settings: 'cv11', 'ss01';
}
body.appx .amt, body.appx .v, body.appx .money, body.appx .kpi .v { font-variant-numeric: tabular-nums; }
body.appx h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
body.appx h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }

/* Tarjetas: borde suave, sombra moderna, nada de bordes gruesos */
body.appx .card { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 18px; }
body.appx .btn { border-radius: var(--r-sm); font-weight: 600; transition: background .15s, box-shadow .15s, transform .06s; }
body.appx .btn:hover { box-shadow: var(--shadow-sm); }
body.appx .btn.primary { box-shadow: 0 1px 2px rgba(14, 122, 79, .25), inset 0 1px 0 rgba(255,255,255,.12); }
body.appx .btn.sm { padding: 8px 12px; }
body.appx input, body.appx select, body.appx textarea { border-radius: var(--r-sm); border-color: #E2DCCF; transition: border-color .15s, box-shadow .15s; }
body.appx input:focus, body.appx select:focus, body.appx textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(14, 122, 79, .12); }
body.appx .banner { border-radius: var(--r-md); border: 1px solid transparent; }
body.appx .banner.warn { border-color: #F7DDB4; }
body.appx .banner.info { border-color: #CFE0FB; }
body.appx .banner.good { border-color: #C8E6D4; }

/* Estados: punto de color + texto, discretos */
body.appx .pill { gap: 6px; padding: 3px 9px 3px 8px; font-weight: 600; font-size: 12px; border: 1px solid transparent; }
body.appx .pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
body.appx .pill.pagado { border-color: #C8E6D4; }
body.appx .pill.pendiente { border-color: #CFE0FB; }
body.appx .pill.vencido { border-color: #F9CFCA; }
body.appx .pill.en_revision { border-color: #F7DDB4; }

/* ---------- Barra superior ---------- */
body.appx .topbar { background: rgba(247, 244, 238, .86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
body.appx .topbar .wrap:first-child { height: 58px; }
body.appx .logo i { border-radius: 10px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
body.appx .tabs { gap: 2px; padding: 8px 0; }
body.appx .tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; font-weight: 600; color: var(--muted); }
body.appx .tab svg { width: 18px; height: 18px; flex: none; }
body.appx .tab:hover { color: var(--ink); background: rgba(22, 32, 46, .04); }
body.appx .tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
body.appx .tab .count { position: static; margin-left: 2px; }

/* En el teléfono: navegación abajo, al alcance del pulgar */
@media (max-width: 720px) {
  body.appx main { padding-bottom: 96px !important; }
  body.appx .topbar .wrap:last-child { position: fixed; left: 0; right: 0; bottom: 0; max-width: none; padding: 0 8px env(safe-area-inset-bottom); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 20; }
  body.appx .tabs { justify-content: space-around; padding: 6px 0 8px; }
  body.appx .tab { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 8px; min-width: 56px; position: relative; }
  body.appx .tab svg { width: 22px; height: 22px; }
  body.appx .tab.active { background: transparent; box-shadow: none; color: var(--brand); }
  body.appx .tab .count { position: absolute; top: 2px; right: 10px; min-width: 16px; line-height: 16px; font-size: 10px; }
  body.appx .toast { bottom: 92px; }
}

/* ---------- Hoy ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 4px 0 2px; }
.hello h2 { font-size: 26px !important; }
.hello .date { color: var(--muted); font-size: 14px; font-weight: 500; text-transform: capitalize; }
.hero-kpi { background: linear-gradient(160deg, #0E7A4F 0%, #0B6641 100%); color: #fff; border: 0 !important; box-shadow: var(--shadow-md) !important; position: relative; overflow: hidden; }
.hero-kpi::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.12), transparent); }
.hero-kpi .l { font-size: 13px; font-weight: 600; opacity: .85; }
.hero-kpi .v { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; line-height: 1.05; }
.hero-kpi .sub { font-size: 13px; opacity: .85; margin-top: 6px; }
.hero-kpi .bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); margin-top: 14px; overflow: hidden; }
.hero-kpi .bar > i { display: block; height: 100%; border-radius: 99px; background: #fff; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .06s; }
.mini:hover { box-shadow: var(--shadow-md); }
.mini:active { transform: scale(.98); }
.mini .l { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.mini .l::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); }
.mini .v { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; color: var(--ink); }
.mini .n { font-size: 12px; color: var(--muted); }
.mini.warn { --c: var(--warn); } .mini.bad { --c: var(--bad); } .mini.info { --c: var(--info); }
.mini.bad .v { color: var(--bad); }
@media (max-width: 420px) { .minis { gap: 8px; } .mini { padding: 10px; } .mini .v { font-size: 16px; } }
.section-h { display: flex; justify-content: space-between; align-items: center; margin: 6px 2px 0; }
.section-h h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wa-strip { display: flex; align-items: center; gap: 12px; }
.wa-strip .ic { width: 40px; height: 40px; border-radius: 12px; background: #E8F7EE; color: #1FA855; display: grid; place-items: center; flex: none; }

/* ---------- Filas de cobro ---------- */
body.appx .list .item { padding: 14px 0; border-top: 1px solid var(--line-2); }
body.appx .list .item:first-child { border-top: 0; padding-top: 4px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; color: #fff; background: var(--a, #98A2B3); }
body.appx .item .title { font-weight: 650; font-size: 15px; }
body.appx .item .sub { font-size: 13px; }
body.appx .item .amt { font-weight: 700; font-size: 15px; }
body.appx .actions { gap: 8px; }
body.appx .actions .btn.sm { padding: 7px 11px; font-size: 13px; }
body.appx .proof { background: #FBFAF7; border: 1px solid var(--line); border-style: solid; border-radius: var(--r-md); padding: 10px; gap: 12px; }
body.appx .proof img { width: 64px; height: 84px; border-radius: 10px; border: 1px solid var(--line); }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.verdict.ok { color: var(--brand); } .verdict.chk { color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; margin-top: 4px; }
.kv span:nth-child(odd) { color: var(--muted); }

/* ---------- Modal y avisos ---------- */
body.appx .modal-bg { background: rgba(16, 24, 40, .38); backdrop-filter: blur(3px); animation: fade-in .15s ease; }
body.appx .modal { border-radius: 24px; box-shadow: var(--shadow-lg); animation: pop-in .2s cubic-bezier(.2,.9,.3,1.2); }
@media (max-width: 560px) {
  body.appx .modal-bg { place-items: end center; padding: 0; }
  body.appx .modal { border-radius: 24px 24px 0 0; max-height: 90vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); animation: sheet-up .25s cubic-bezier(.2,.9,.3,1); }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } }
body.appx .toast { border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-lg); animation: toast-in .25s cubic-bezier(.2,.9,.3,1.2); display: flex; gap: 8px; align-items: center; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Carga (esqueleto) ---------- */
.skel { background: linear-gradient(90deg, #EFEAE0 25%, #F7F3EC 50%, #EFEAE0 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =====================================================================
   Momentos de deleite (los únicos con Coby y Baloo 2)
   ===================================================================== */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 16px 22px; background: var(--bg); border-radius: var(--r-md); }
.empty-state .koby { width: 116px; height: auto; }
.empty-state h4 { font-family: 'Baloo 2', 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 21px; line-height: 1.15; margin: 8px 0 4px; letter-spacing: -0.01em; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; max-width: 320px; }
.empty-state .btn { margin-top: 14px; }

.celebrate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(16, 24, 40, .32); backdrop-filter: blur(2px); animation: fade-in .15s ease; }
.celebrate .box { position: relative; background: #fff; border-radius: 28px; padding: 22px 26px 24px; text-align: center; box-shadow: var(--shadow-lg); width: min(320px, 86vw); animation: pop-in .3s cubic-bezier(.2,.9,.3,1.3); }
.celebrate .koby { width: 132px; height: auto; margin: -70px auto 0; }
.celebrate h4 { font-family: 'Baloo 2', 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 26px; margin: 4px 0 0; color: var(--brand); }
.celebrate .amount { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.celebrate .who2 { color: var(--muted); font-size: 14px; margin-top: 2px; }
.celebrate .note { font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.confetti { position: absolute; left: 50%; top: 40%; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; opacity: 0; animation: confetti .9s ease-in-out forwards; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) {
  .celebrate .box, .confetti i, body.appx .modal, body.appx .toast, .skel { animation: none !important; }
}

/* Ajustes finos */
.hello .date { text-transform: none; }
.mini .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verdict svg { width: 16px; height: 16px; flex: none; }
.wa-strip .ic svg { width: 22px; height: 22px; }
body.appx .actions .btn.ghost { margin-left: auto; color: var(--muted); }
@media (max-width: 720px) {
  /* el desenfoque del encabezado "atrapa" a la barra fija: en el teléfono va sólido */
  body.appx .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); position: static; }
  .mini .l { font-size: 11.5px; }
}

/* Barra inferior centrada: cada pestaña ocupa la misma fracción del ancho */
@media (max-width: 720px) {
  body.appx .topbar .wrap:last-child { display: block; height: auto; }
  body.appx .tabs { width: 100%; justify-content: space-between; overflow: visible; }
  body.appx .tab:not(.hidden) { flex: 1 1 0; min-width: 0; justify-content: center; }
  body.appx .tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
@media (max-width: 720px) {
  body.appx .tabs[data-n="6"] .tab, body.appx .tabs[data-n="7"] .tab { font-size: 9.5px; letter-spacing: -0.01em; padding: 6px 2px; }
  body.appx .tabs[data-n="6"] .tab svg, body.appx .tabs[data-n="7"] .tab svg { width: 21px; height: 21px; }
}
