:root {
  --bg: #0d0d0d;
  --surface: #181818;
  --surface-2: #222222;
  --line: #2c2c2c;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --yellow: #ffcc00;
  --green: #2fbf71;
  --red: #ff6b5e;
  --radius: 16px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 16px; line-height: 1.45; min-height: 100vh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.hidden { display: none !important; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot svg { width: 56px; height: 56px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* Layout */
.screen { max-width: 560px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 96px); }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(13, 13, 13, .92); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; max-width: 560px; margin: 0 auto; }
.topbar h1 { font-size: 1.25rem; }
.sync { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.sync.pending::before { background: var(--yellow); }
.sync.offline::before { background: var(--red); }

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.yellow { background: var(--yellow); color: #111; border-color: var(--yellow); }
.card.yellow .muted, .card.yellow .label, .card.yellow dt { color: #5c4a00; }
.card.yellow dd { color: #111; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.tile .label { font-size: .75rem; color: var(--muted); }
.tile b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.big { font-size: 2.6rem; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.label { font-size: .8rem; color: var(--muted); }

.progress { height: 8px; background: rgba(0, 0, 0, .15); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.card:not(.yellow) .progress { background: var(--surface-2); }
.progress span { display: block; height: 100%; background: #111; border-radius: 99px; transition: width .4s; }
.card:not(.yellow) .progress span { background: var(--yellow); }

.alert { display: block; text-decoration: none; color: var(--yellow); background: #1c1907; border: 1px solid #4d3f05; border-radius: 12px; padding: 10px 14px; font-size: .9rem; font-weight: 600; }
.alert::before { content: "⏰ "; }
.alert.late { color: var(--red); background: #241210; border-color: #4a2522; }
.card.live { border: 2px solid var(--yellow); background: #1c1907; }
.card.live .label { color: var(--yellow); font-weight: 700; }
.card.live .big { margin: 4px 0 2px; }
.btn.primary.stop { background: var(--red); color: #fff; }
.ride-sum { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.shift { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* Buttons */
.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text); min-height: 50px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--yellow); color: #111; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #4a2522; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: .9rem; border-radius: 12px; }
.btn[disabled] { opacity: .5; }
.link { background: none; border: 0; color: var(--yellow); padding: 0; font-weight: 600; }

.fab-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 6; pointer-events: none; }
.fab-bar .inner { max-width: 560px; margin: 0 auto; padding: 12px 16px; display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.fab-bar .btn { pointer-events: auto; min-height: 58px; font-size: 1.05rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8); }

/* Bottom nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; background: rgba(17, 17, 17, .96); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav .inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: .7rem; }
.nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active { color: var(--yellow); }

/* Segmented / chips */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; padding: 9px 6px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: .9rem; color: var(--text); }
.chip.on { background: var(--yellow); color: #111; border-color: var(--yellow); }
.pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 6px; font-weight: 700; display: grid; gap: 4px; justify-items: center; }
.pay button span { font-size: 1.4rem; }
.pay button.on { background: var(--yellow); color: #111; border-color: var(--yellow); }

/* Forms */
.field { display: grid; gap: 6px; }
.field label { font-size: .85rem; color: var(--muted); }
.input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 1rem; }
.input:focus { outline: 2px solid var(--yellow); outline-offset: -1px; }
.money { position: relative; }
.money input { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; padding: 14px 52px 14px 16px; text-align: left; }
.money span { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; font-weight: 700; color: var(--muted); }
details.more summary { color: var(--yellow); font-weight: 600; cursor: pointer; list-style: none; padding: 4px 0; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 10px; }
.error { color: var(--red); font-size: .9rem; min-height: 1.2em; }
.notice { background: rgba(47, 191, 113, .12); color: var(--green); border-radius: 12px; padding: 12px 14px; font-size: .95rem; }

/* Lists */
.list { display: grid; gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.item { background: var(--surface); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; width: 100%; text-align: left; border: 0; }
.item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.item .meta { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; background: var(--surface-2); color: var(--text); border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
.day-head { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin: 18px 4px 6px; text-transform: capitalize; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: .95rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; color: var(--text); }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; font-size: .85rem; }
.bar-row .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-row .track span { display: block; height: 100%; background: var(--yellow); }
.section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 4px 8px; }

/* Sheet (modal desde abajo) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #141414; border: 1px solid var(--line); border-bottom: 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); animation: up .2s ease; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 99px; background: #444; margin: 0 auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.close { background: var(--surface-2); border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; color: var(--muted); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); transform: translateX(-50%) translateY(-20px); background: var(--text); color: #111;
  padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: .9rem; opacity: 0; transition: .25s; z-index: 30; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Auth */
.auth { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 48px) 20px 40px; display: grid; gap: 18px; }
.auth .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.6rem; }
.auth .logo svg { width: 40px; height: 40px; }
.lang-switch { display: flex; gap: 6px; justify-content: flex-end; }
.lang-switch button { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: .8rem; }
.lang-switch button.on { background: var(--yellow); color: #111; border-color: var(--yellow); font-weight: 700; }

@media (min-width: 600px) {
  .screen { padding-top: 8px; }
}
