/* Mi Parte — cuadro de mandos nocturno.
   Asfalto, ámbar de taxímetro y cifras de rótulo de carretera. */

:root {
  --bg: #f2eee5;
  --bg-2: #e9e3d6;
  --surface: #fffcf5;
  --surface-2: #f6f1e6;
  --line: #d9d0bd;
  --text: #17191c;
  --muted: #6a6d72;
  --accent: #f5a300;
  --accent-text: #9a5b00;
  --accent-ink: #1b1200;
  --ok: #138a4f;
  --bad: #c2381d;
  --info: #2764c7;
  --shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 30px -18px rgba(60, 40, 0, .35);
  --grain: .05;

  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body: 'Figtree', ui-sans-serif, sans-serif;
  --r: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1012;
    --bg-2: #15181b;
    --surface: #171a1e;
    --surface-2: #1e2227;
    --line: #2b3036;
    --text: #f2ede3;
    --muted: #8d939b;
    --accent: #ffb020;
    --accent-text: #ffc14d;
    --accent-ink: #1b1200;
    --ok: #3ddc84;
    --bad: #ff6b4a;
    --info: #7fb0ff;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -24px rgba(0, 0, 0, .9);
    --grain: .07;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1012;
  --bg-2: #15181b;
  --surface: #171a1e;
  --surface-2: #1e2227;
  --line: #2b3036;
  --text: #f2ede3;
  --muted: #8d939b;
  --accent: #ffb020;
  --accent-text: #ffc14d;
  --accent-ink: #1b1200;
  --ok: #3ddc84;
  --bad: #ff6b4a;
  --info: #7fb0ff;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -24px rgba(0, 0, 0, .9);
  --grain: .07;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 500 16px/1.45 var(--body);
  padding-bottom: env(safe-area-inset-bottom);
}
/* Grano de asfalto */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

main, .topbar, .lane, .banner { position: relative; z-index: 1; }
main { max-width: 560px; margin: 0 auto; padding: 18px 16px 48px; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
b { font-weight: 700; }
.muted { color: var(--muted); font-weight: 500; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lane {
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 22px, transparent 22px 38px);
  opacity: .85;
  animation: drive 1.6s linear infinite;
  animation-play-state: paused;
}
body:has(.view.is-active:not([data-view="inicio"])) .lane { animation-play-state: running; }
@keyframes drive { to { background-position: 38px 0; } }

.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin-right: auto; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background:
    linear-gradient(135deg, transparent 46%, var(--accent-ink) 46% 54%, transparent 54%),
    var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.brand-name { font: 800 22px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.brand-name b { color: var(--accent-text); font-weight: 900; }
.brand--big .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
.brand--big .brand-name { font-size: 40px; }

.month { display: flex; align-items: center; gap: 2px; }
.month.is-hidden { visibility: hidden; }
.month-label {
  border: 0; background: none; padding: 6px 2px; min-width: 84px; white-space: nowrap;
  font: 800 19px/1 var(--display); letter-spacing: .04em; text-transform: uppercase;
}
.month-label.is-other { color: var(--accent-text); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 20px; line-height: 1; text-decoration: none;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn--gear { color: var(--muted); }

.banner {
  max-width: 560px; margin: 10px auto 0; padding: 8px 14px;
  border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--text);
}

/* ---------- entrada escalonada ---------- */
.view.is-active .reveal {
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  .view.is-active .reveal, .lane { animation: none; }
}

/* ---------- inicio ---------- */
.eyebrow {
  margin: 0 0 12px;
  font: 700 13px/1 var(--body); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.month-card {
  padding: 18px 18px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.month-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.month-stats > div { display: flex; align-items: baseline; gap: 8px; }
.stat-num { font: 900 54px/.9 var(--display); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 14px; color: var(--muted); line-height: 1.15; max-width: 7.5em; }

.keys { display: grid; gap: 12px; }
.key {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  padding: 18px 18px 18px 16px;
  border-radius: 18px;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.key::before { /* borde de tecla de taxímetro */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--accent);
}
.key:first-child {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.key:first-child::before { background: var(--accent-ink); opacity: .85; }
.key:first-child .key-num, .key:first-child .key-desc { color: inherit; opacity: .72; }
.key:active { transform: scale(.985); }
.key:hover { border-color: var(--accent); }
.key-num { font: 900 44px/1 var(--display); color: var(--accent-text); font-variant-numeric: tabular-nums; padding-left: 6px; }
.key-title { display: block; font: 800 27px/1.02 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.key-desc { display: block; margin-top: 5px; font-size: 14px; color: var(--muted); line-height: 1.3; }
.key-arrow { font: 800 26px/1 var(--display); transition: transform .2s; }
.key:hover .key-arrow { transform: translateX(4px); }

/* ---------- vistas de cálculo ---------- */
.back {
  display: inline-block; margin: 2px 0 10px; padding: 6px 0;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px;
}
.title {
  margin: 0 0 20px;
  font: 900 38px/.95 var(--display); text-transform: uppercase; letter-spacing: .005em;
  text-wrap: balance;
}
.title-num {
  display: block; margin-bottom: 6px;
  font-size: 16px; letter-spacing: .2em; color: var(--accent-text);
}

.field { display: block; margin-bottom: 18px; }
.field-label {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
  font: 700 13px/1.2 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.field-hint { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.auto {
  border: 0; background: none; padding: 0;
  font: 700 12px/1 var(--body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px;
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font: 600 20px/1.2 var(--body);
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.input--big {
  min-height: 68px;
  font: 800 38px/1 var(--display);
  letter-spacing: .01em;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }

.money { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.money--pct { grid-template-columns: 120px auto; justify-content: start; align-items: center; }
.suffix { font: 800 26px/1 var(--display); color: var(--muted); }

.seg {
  display: inline-flex; flex-direction: column; gap: 4px; padding: 4px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
}
.seg button {
  border: 0; border-radius: 9px; background: none; padding: 6px 12px;
  font: 700 13px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  flex: 1;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg--wide { flex-direction: row; display: flex; }
.seg--wide button { padding: 12px 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 104px; padding: 10px 14px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  text-align: left;
  transition: transform .12s, border-color .12s, background .12s;
}
.chip:active { transform: scale(.96); }
.chip-name { font-size: 13px; font-weight: 600; color: var(--muted); }
.chip-val { font: 800 24px/1 var(--display); font-variant-numeric: tabular-nums; }
.chip--other .chip-val { font-size: 18px; color: var(--muted); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.chip[aria-pressed="true"] .chip-name { color: var(--accent-text); }

/* ---------- resultado: ticket de taxímetro ---------- */
.result {
  position: relative;
  margin-top: 8px;
  padding: 20px 18px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.result::before, .result::after { /* muescas de ticket */
  content: ''; position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line); transform: translateY(-50%);
}
.result::before { left: -9px; clip-path: inset(0 0 0 50%); }
.result::after { right: -9px; clip-path: inset(0 50% 0 0); }
.result > * + * { margin-top: 14px; }

.empty { margin: 0; color: var(--muted); font-size: 15px; text-align: center; padding: 10px 0; }

.readout { padding-bottom: 14px; border-bottom: 2px dashed var(--line); }
.readout-label {
  margin: 0; font: 700 13px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.readout-big { margin: 6px 0 0; display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.amount { font-family: var(--display); color: var(--accent-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-int { font-size: clamp(56px, 18vw, 84px); font-weight: 900; line-height: .85; letter-spacing: -.01em; }
.amount-dec { font-size: 30px; font-weight: 800; }
.amount-cur { font-size: 30px; font-weight: 800; margin-left: 4px; }
.readout--ok .amount, .readout--ok .readout-label { color: var(--ok); }
.readout-sub { margin: 8px 0 0; font-size: 17px; font-weight: 600; }
.tag {
  display: inline-block; margin-bottom: 6px; padding: 4px 8px; border-radius: 6px;
  font: 700 12px/1 var(--body); letter-spacing: .1em; text-transform: uppercase;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair > div { padding: 12px; border-radius: 12px; background: var(--surface-2); }
.pair-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pair-val { margin: 4px 0 0; font: 800 30px/1 var(--display); font-variant-numeric: tabular-nums; }

.note { margin: 0; font-size: 15px; color: var(--muted); }
.note b { color: var(--text); }

.alert { margin: 0; padding: 11px 13px; border-radius: 12px; font-size: 14.5px; font-weight: 600; border-left: 4px solid; }
.alert--warn { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); }
.alert--info { background: color-mix(in srgb, var(--info) 12%, transparent); border-color: var(--info); }
.alert--bad { background: color-mix(in srgb, var(--bad) 13%, transparent); border-color: var(--bad); }

/* Barra de tramos, como un indicador de depósito */
.gauge { padding: 24px 12px 22px 0; }
.gauge-track {
  position: relative; display: flex; height: 16px; border-radius: 5px; overflow: visible;
  background: var(--surface-2);
}
.gauge-seg {
  position: relative; width: var(--w); height: 100%;
  background: color-mix(in srgb, var(--accent) calc(18% + var(--k, 0%)), var(--surface-2));
  border-right: 2px solid var(--surface);
}
.gauge-seg:nth-child(1) { --k: 0%; }
.gauge-seg:nth-child(2) { --k: 22%; }
.gauge-seg:nth-child(3) { --k: 44%; }
.gauge-seg:nth-child(n+4) { --k: 66%; }
.gauge-seg:first-child { border-radius: 5px 0 0 5px; }
.gauge-seg--out {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 5px, color-mix(in srgb, var(--bad) 30%, var(--surface-2)) 5px 8px);
  border-radius: 0 5px 5px 0; border-right: 0;
}
.gauge-pct {
  position: absolute; bottom: calc(100% + 5px); left: 0; right: 0; text-align: center;
  font: 800 15px/1 var(--display); color: var(--muted); white-space: nowrap;
}
.gauge-seg.is-on { background: var(--accent); }
.gauge-seg.is-on .gauge-pct { color: var(--accent-text); }
.gauge-top {
  position: absolute; top: calc(100% + 6px); right: 0; transform: translateX(50%);
  font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.gauge-needle {
  position: absolute; top: -6px; bottom: -6px; left: var(--x); width: 4px; margin-left: -2px;
  border-radius: 2px; background: var(--text);
  box-shadow: 0 0 0 2px var(--surface);
  transition: left .35s cubic-bezier(.2, .7, .2, 1);
}

.progress-bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress-bar span {
  display: block; height: 100%; width: var(--x);
  background: repeating-linear-gradient(90deg, var(--accent) 0 18px, color-mix(in srgb, var(--accent) 75%, var(--text)) 18px 20px);
  border-radius: 6px;
  transition: width .35s cubic-bezier(.2, .7, .2, 1);
}
.progress-legend { display: flex; justify-content: space-between; margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.progress-legend b { color: var(--text); font-family: var(--display); font-size: 17px; }

.next {
  padding: 14px; border-radius: 14px;
  border: 1.5px dashed var(--line);
}
.next--hot {
  border: 1.5px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent); } }
.next-head { margin: 0 0 6px; font: 800 20px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.next-head b { color: var(--accent-text); }
.next-body { margin: 0; font-size: 15px; }
.plus { color: var(--ok); }

/* ---------- ajustes ---------- */
.card {
  margin: 0 0 14px; padding: 16px; min-width: 0;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow);
}
.card legend, .legend {
  padding: 0 6px; margin: 0 0 0 -6px;
  font: 800 20px/1 var(--display); text-transform: uppercase; letter-spacing: .03em;
}
.legend { margin: 0 0 6px; padding: 0; }
.rows-head, .row { display: grid; grid-template-columns: 1fr 88px 40px; gap: 8px; align-items: center; }
.rows-head--obj, .row--obj { grid-template-columns: 1fr 110px 40px; }
.rows-head { margin: 10px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rows { display: grid; gap: 8px; margin-bottom: 10px; }
.row .input { min-height: 46px; font-size: 18px; }
.icon-btn--del { font-size: 15px; color: var(--muted); }
.icon-btn--del:hover { color: var(--bad); border-color: var(--bad); }

.sticky-save {
  position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 3;
  margin: 4px 0 18px;
}

.btn {
  display: block; width: 100%; min-height: 54px; padding: 12px 18px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  font: 800 20px/1 var(--display); text-transform: uppercase; letter-spacing: .05em;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .6; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn--ghost { background: transparent; border-style: dashed; }
.btn--danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }

.stack { display: grid; gap: 12px; }

.check { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- login ---------- */
.login { display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  padding: 28px 22px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
.login-card::before {
  content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 4px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 22px, transparent 22px 38px);
}
.login-lead { margin: 12px 0 22px; color: var(--muted); }

/* ---------- aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 10;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 15px;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tipo="bad"] { background: var(--bad); color: #fff; }

@media (min-width: 600px) {
  main { padding-top: 28px; }
  .title { font-size: 48px; }
}
@media (max-width: 360px) {
  .month-label { min-width: 72px; font-size: 16px; }
  .brand-name { font-size: 19px; }
  .key-title { font-size: 23px; }
  .stat-num { font-size: 44px; }
}
