/* =========================================================
   Inicio (Juegos / Gastos) y compartidor de gastos
   ========================================================= */
body[data-game="gastos"] { --game: #10b981; --game-2: #06b6d4; }

.home-choices { display: grid; gap: 14px; margin-top: 8px; }
.home-choice {
  display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  text-align: left; width: 100%; padding: 22px 18px; border-radius: var(--radius); cursor: pointer;
  font-family: inherit; color: var(--text-main);
  background: var(--bg-card); border: 1px solid var(--bg-card-border); box-shadow: var(--shadow-card);
  transition: transform 0.1s;
}
.home-choice:active { transform: scale(0.985); }
.home-choice.juegos { background: linear-gradient(135deg, rgba(99,102,241,.32), rgba(168,85,247,.16)); }
.home-choice.gastos { background: linear-gradient(135deg, rgba(16,185,129,.30), rgba(6,182,212,.14)); }
.hc-icon { grid-row: 1 / 3; font-size: 2.6rem; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--bg-inset); }
.hc-title { font-size: 1.45rem; font-weight: 800; }
.hc-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

.gastos-error { border-color: rgba(239,68,68,.5); color: #fca5a5; }
.gastos-head h2 { font-size: 1.35rem !important; }
.gastos-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 12px; }
.gastos-kpis div { background: var(--bg-inset); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.gastos-kpis span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.gastos-kpis strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.pos { color: #34d399; }
.neg { color: #f87171; }
.gastos-me { display: flex; align-items: center; gap: 8px; }
.gastos-me label { font-weight: 700; font-size: 0.9rem; }
.gastos-me select { flex: 1; min-width: 0; min-height: 40px; padding: 8px 12px; font-size: 0.92rem; }
.gastos-status { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; min-height: 1em; }
.gastos-status.error { color: #fbbf24; }

.gastos-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.gastos-actions .btn { min-height: 48px; font-size: 0.95rem; padding: 10px; }

.gastos-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-inset); margin-bottom: 14px; }
.gastos-tabs button, .seg button {
  font-family: inherit; font-weight: 700; font-size: 0.88rem; color: var(--text-muted);
  background: none; border: none; border-radius: 10px; padding: 10px 4px; cursor: pointer;
}
.gastos-tabs button.active, .seg button.active { background: rgba(255,255,255,.1); color: var(--text-main); }

.gastos-list { display: flex; flex-direction: column; gap: 8px; }
.gastos-date { font-size: 0.75rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 8px 4px 0; }
.gastos-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; width: 100%;
  text-align: left; font-family: inherit; color: var(--text-main); cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--bg-card-border); border-radius: 16px; padding: 12px;
}
.gastos-item.pago { background: rgba(6,182,212,.08); }
.gi-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--bg-inset); display: grid; place-items: center; font-size: 1.2rem; }
.gi-main { display: flex; flex-direction: column; min-width: 0; }
.gi-title { font-weight: 800; font-size: 0.98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-sub { font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-amount { display: flex; flex-direction: column; align-items: flex-end; font-weight: 800; font-variant-numeric: tabular-nums; }
.gi-amount span { font-size: 0.72rem; font-weight: 700; }

.saldo-row { display: grid; grid-template-columns: minmax(0, 1fr) 1fr auto; gap: 10px; align-items: center; padding: 7px 0; }
.saldo-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saldo-bar { position: relative; height: 10px; border-radius: 5px; background: var(--bg-inset); }
.saldo-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(255,255,255,.25); }
.saldo-bar span { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.saldo-bar span.pos { background: #10b981; }
.saldo-bar span.neg { background: #ef4444; }
.saldo-val { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.settle-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--bg-card-border); }
.settle-row:first-of-type { border-top: none; }
.settle-amt { font-weight: 800; font-variant-numeric: tabular-nums; }

.gastos-log { padding: 8px 16px; }
.log-row { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--bg-card-border); font-size: 0.88rem; }
.log-row:first-child { border-top: none; }
.log-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-inset); font-size: 0.85rem; }
.log-icon.alta { color: #34d399; }
.log-icon.edicion { color: #fbbf24; }
.log-icon.borrado { color: #f87171; }
.log-main { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.log-time { font-size: 0.72rem; color: var(--text-muted); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-inset); margin-bottom: 14px; }
.seg.seg-4 { grid-template-columns: repeat(4, 1fr); }
.gm-label { display: block; font-size: 0.78rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 6px; }
.gm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gm-help { font-size: 0.82rem; color: var(--text-muted); }
input[type="date"] {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.13);
  background: rgba(7,11,22,.6); color: white; font-family: inherit; font-size: 1rem; font-weight: 600; color-scheme: dark;
}
.split-tools { display: flex; gap: 8px; margin-bottom: 6px; }
.split-tools button { font-family: inherit; font-size: 0.8rem; font-weight: 700; color: var(--text-main); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 6px 12px; cursor: pointer; }
.split-list { display: flex; flex-direction: column; }
.split-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bg-card-border); color: var(--text-main); font-weight: 700; }
div.split-row { grid-template-columns: minmax(0, 1fr) 116px 70px; }
.split-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: #10b981; }
.split-input { display: flex; align-items: center; gap: 6px; }
.split-input input { min-height: 40px !important; padding: 8px 10px !important; text-align: right; }
.split-input em { font-style: normal; color: var(--text-muted); width: 14px; }
.split-prev { font-size: 0.82rem; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.gm-check { font-size: 0.85rem; margin-top: 10px; font-weight: 700; }
.gm-check.ok { color: #34d399; }
.gm-check.warn { color: #fbbf24; }
.gm-error { color: #f87171; font-weight: 700; font-size: 0.88rem; margin-top: 10px; min-height: 1em; }
