/* Motomamis — interfaz funcional estilo app de reparto/conductores.
   Un mismo diseño con 6 pieles (data-theme): uber, rappi, doordash, cabify, glovo, respiro. */
:root, [data-theme="uber"] {
  --bg: #ffffff; --card: #ffffff; --surface: #f3f3f3; --line: #e6e6e6;
  --ink: #000000; --ink-2: #333333; --muted: #6b6b6b;
  --primary: #000000; --on-primary: #ffffff; --primary-soft: #eeeeee; --primary-ink: #000000;
  --cta: #000000; --on-cta: #ffffff;
  --head-bg: #ffffff; --head-ink: #000000; --head-sub: #6b6b6b;
  --ok: #05944f; --ok-bg: #e6f4ec; --warn: #b25e09; --warn-bg: #fff3e0; --bad: #c4291c; --bad-bg: #fdecea;
  --live: #276ef1; --live-bg: #e7efff;
  --radius: 12px; --radius-sm: 8px; --btn-radius: 8px; --chip-radius: 999px;
  --heavy: 700; --title: 22px;
}
[data-theme="rappi"] {
  --bg: #ffffff; --card: #ffffff; --surface: #fff3ef; --line: #f1e4df;
  --ink: #2e2e2e; --ink-2: #4a4a4a; --muted: #8a8380;
  --primary: #ff441f; --on-primary: #ffffff; --primary-soft: #ffe9e3; --primary-ink: #e0350f;
  --cta: #ff441f; --on-cta: #ffffff;
  --head-bg: #ff441f; --head-ink: #ffffff; --head-sub: #ffe1d8;
  --ok: #18a058; --ok-bg: #e5f6ed; --live: #ff441f; --live-bg: #ffe9e3;
  --radius: 20px; --radius-sm: 14px; --btn-radius: 999px; --heavy: 800;
}
[data-theme="doordash"] {
  --bg: #ffffff; --card: #ffffff; --surface: #f6f6f6; --line: #e7e7e7;
  --ink: #191919; --ink-2: #494949; --muted: #767676;
  --primary: #eb1700; --on-primary: #ffffff; --primary-soft: #fde8e6; --primary-ink: #c71400;
  --cta: #eb1700; --on-cta: #ffffff;
  --head-bg: #ffffff; --head-ink: #191919; --head-sub: #767676;
  --live: #eb1700; --live-bg: #fde8e6;
  --radius: 10px; --radius-sm: 8px; --btn-radius: 999px; --heavy: 800;
}
[data-theme="cabify"] {
  --bg: #f7f5fd; --card: #ffffff; --surface: #efebfb; --line: #e4def6;
  --ink: #1f1b33; --ink-2: #47406a; --muted: #827ba3;
  --primary: #7145d6; --on-primary: #ffffff; --primary-soft: #ece5fc; --primary-ink: #5b33bb;
  --cta: #7145d6; --on-cta: #ffffff;
  --head-bg: #f7f5fd; --head-ink: #1f1b33; --head-sub: #827ba3;
  --live: #7145d6; --live-bg: #ece5fc;
  --radius: 18px; --radius-sm: 12px; --btn-radius: 14px; --heavy: 700;
}
[data-theme="glovo"] {
  --bg: #ffffff; --card: #ffffff; --surface: #f4f4f4; --line: #e9e9e9;
  --ink: #1d1d1d; --ink-2: #444444; --muted: #7a7a7a;
  --primary: #00a082; --on-primary: #ffffff; --primary-soft: #e0f4ef; --primary-ink: #008a70;
  --cta: #00a082; --on-cta: #ffffff;
  --head-bg: #ffc244; --head-ink: #1d1d1d; --head-sub: #5c4a1c;
  --live: #00a082; --live-bg: #e0f4ef;
  --radius: 16px; --radius-sm: 12px; --btn-radius: 999px; --heavy: 800;
}
[data-theme="respiro"] {
  --bg: #fbf7f3; --card: #fffdfb; --surface: #f5eae5; --line: #ecdfd9;
  --ink: #2a1e21; --ink-2: #4d3b3f; --muted: #8e7c7f;
  --primary: #b76e79; --on-primary: #ffffff; --primary-soft: #f7e6e6; --primary-ink: #9c5762;
  --cta: #2a1e21; --on-cta: #fbf7f3;
  --head-bg: #fbf7f3; --head-ink: #2a1e21; --head-sub: #8e7c7f;
  --ok: #5f7f66; --ok-bg: #e9f0e8; --warn: #a5683a; --warn-bg: #f9ece0; --bad: #a2414b; --bad-bg: #f8e4e4;
  --live: #b76e79; --live-bg: #f7e6e6;
  --radius: 14px; --radius-sm: 10px; --btn-radius: 12px; --heavy: 700;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.caps { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ===== Estructura ===== */
.screen { max-width: 560px; margin: 0 auto; padding: 0 0 calc(var(--safe-bottom) + 84px); }
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--head-bg); color: var(--head-ink);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--safe-top) + 12px) var(--gutter) 12px; border-bottom: 1px solid var(--line);
}
.topbar .hello { font-size: var(--title); font-weight: var(--heavy); }
.topbar .sub { font-size: 13px; color: var(--head-sub); }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden; background: var(--primary-soft); color: var(--primary-ink); display: grid; place-items: center; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px var(--gutter) 4px; }
.summary .box { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.summary .box .v { font-size: 24px; font-weight: var(--heavy); font-variant-numeric: tabular-nums; }
.summary .box .l { font-size: 13px; color: var(--muted); }

.section { padding: 20px var(--gutter) 8px; font-size: 18px; font-weight: var(--heavy); display: flex; justify-content: space-between; align-items: baseline; }
.section .count { font-size: 14px; font-weight: 500; color: var(--muted); }

/* ===== Tarjeta del servicio ===== */
.job { margin: 8px var(--gutter) 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.job.active { border: 2px solid var(--primary); }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job .when { font-size: 28px; font-weight: var(--heavy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.job .rel { font-size: 14px; color: var(--muted); margin-top: 2px; }
.job .client { font-size: 18px; font-weight: 600; margin-top: 12px; }
.job .service { font-size: 14px; color: var(--primary-ink); font-weight: 600; margin-top: 1px; }
.job .addr { font-size: 15px; color: var(--ink-2); margin-top: 4px; }

.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); color: var(--ink-2); white-space: nowrap; }
.tags { display: inline-flex; gap: 4px; flex: none; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.live { background: var(--primary); color: var(--on-primary); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.quick a, .quick button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 6px; background: var(--surface); border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.quick svg { width: 20px; height: 20px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0 12px; }
.steps div { font-size: 12px; font-weight: 600; color: var(--muted); }
.steps div::before { content: ""; display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 6px; }
.steps div.done { color: var(--ink); }
.steps div.done::before { background: var(--primary); }

.row { display: flex; align-items: center; gap: 12px; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); cursor: pointer; }
.row .t { font-weight: var(--heavy); font-variant-numeric: tabular-nums; min-width: 72px; }
.row .grow, .hrow .grow { flex: 1; min-width: 0; }
.row .name, .hrow .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta, .hrow .meta { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amount { font-weight: var(--heavy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hrow { display: flex; align-items: flex-start; gap: 12px; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); cursor: pointer; }
.hrow .line1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hrow .quote { margin-top: 6px; font-size: 14px; color: var(--ink-2); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 10px; }
.pair { display: flex; gap: 2px; flex: none; }
.pair img, .pair .ph { width: 40px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--surface); }

/* ===== Botones ===== */
.cta {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 0 18px;
  border-radius: var(--btn-radius); background: var(--cta); color: var(--on-cta); font-size: 17px; font-weight: var(--heavy);
  transition: transform 0.1s ease, opacity 0.2s ease;
}
.cta:active { transform: scale(0.98); }
.cta:disabled { opacity: 0.3; pointer-events: none; }
.cta.primary { background: var(--primary); color: var(--on-primary); }
.cta.danger { background: var(--bad); color: #fff; }
.cta.quiet { background: var(--surface); color: var(--ink); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.text-link { display: block; width: 100%; text-align: center; margin-top: 10px; padding: 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.btn-small { flex: none; padding: 9px 14px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 600; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 8px -4px; padding: 4px; }

.notice { margin: 12px var(--gutter) 0; padding: 12px 14px; border-radius: var(--radius); background: var(--primary-soft); display: flex; align-items: center; gap: 12px; }
.notice .txt { flex: 1; font-size: 14px; color: var(--ink-2); }
.notice .txt b { display: block; font-size: 15px; color: var(--ink); }

.empty { padding: 48px var(--gutter); text-align: center; color: var(--muted); }
.empty h3 { font-size: 18px; color: var(--ink); margin: 0 0 6px; }
.empty p { margin: 0; }

/* ===== Navegación inferior ===== */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.nav-inner { max-width: 560px; margin: 0 auto; display: flex; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; font-size: 11px; font-weight: 600; color: var(--muted); }
.nav button svg { width: 24px; height: 24px; }
.nav button.on { color: var(--primary-ink); }

/* ===== Ganancias / historial ===== */
.big-number { padding: 10px var(--gutter) 4px; }
.big-number .v { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-number .l { font-size: 15px; color: var(--muted); }
.month-switch { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--gutter) 4px; }
.month-switch .m { font-size: 17px; font-weight: var(--heavy); }
.month-switch button { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.month-switch button:disabled { opacity: 0.3; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px var(--gutter) 8px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 12px; }
.stat .n { font-size: 22px; font-weight: var(--heavy); }
.stat .l { font-size: 13px; color: var(--muted); }

/* ===== Hoja deslizable ===== */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.42); opacity: 0; transition: opacity 0.2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; max-height: 92dvh;
  overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 8px var(--gutter) calc(var(--safe-bottom) + 18px); transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open { transform: translateY(0); }
.sheet-backdrop.open { opacity: 1; }
.sheet .grabber { width: 36px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-size: 22px; font-weight: var(--heavy); margin: 4px 0 4px; }
.sheet .lede { color: var(--muted); margin: 0; font-size: 15px; }
.sheet .block { margin-top: 20px; }
.block-label, .sheet .block > label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; font-weight: var(--heavy); margin-bottom: 10px; }
.block-label .muted, .sheet .block > label .muted { font-size: 13px; font-weight: 500; }
.sheet .actions { margin-top: 22px; display: grid; gap: 8px; position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }

.options { display: grid; gap: 8px; margin-top: 16px; }
.option { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.option .ico { font-size: 24px; width: 32px; text-align: center; flex: none; }
.option .txt { flex: 1; display: flex; flex-direction: column; }
.option .txt b { font-size: 16px; }
.option .txt span { font-size: 13px; color: var(--muted); }
.option svg { color: var(--muted); }
.option:active { background: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 14px; border-radius: var(--chip-radius); border: 1.5px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.who { font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.bubble { margin-top: 8px; background: #dcf8c6; color: #1f2c1a; border-radius: 4px 14px 14px 14px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }
.bubble.urgent { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-sm); }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice button { min-height: 50px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--card); font-weight: 600; }
.choice button.on { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }

textarea { width: 100%; min-height: 80px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 10px 12px; outline: 0; font-size: 16px; }
textarea:focus { border-color: var(--primary); background: var(--card); }

.stars { display: flex; gap: 4px; }
.stars button { width: 48px; height: 48px; display: grid; place-items: center; color: var(--line); }
.stars button.on { color: var(--primary); }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos .ph, .photos .add { aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); position: relative; }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.photos .add { border: 2px dashed var(--line); background: var(--card); color: var(--primary-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-size: 13px; font-weight: 600; }
.photos .add .plus { font-size: 30px; line-height: 1; }

.days { display: flex; gap: 6px; overflow-x: auto; margin: 12px calc(var(--gutter) * -1) 0; padding: 0 var(--gutter); scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.days button { flex: none; width: 58px; padding: 8px 0; border-radius: var(--radius-sm); background: var(--surface); text-align: center; }
.days button .d { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.days button .n { font-size: 20px; font-weight: 700; }
.days button.on { background: var(--primary); color: var(--on-primary); }
.days button.on .d { color: var(--on-primary); opacity: 0.8; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.slots button { min-height: 44px; border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; }
.slots button.on { background: var(--primary); color: var(--on-primary); }

.earn { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding: 14px; border-radius: var(--radius); background: var(--primary-soft); }
.earn .what { font-weight: 700; color: var(--primary-ink); }
.earn .note { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.earn .amount { font-size: 24px; font-weight: 800; color: var(--primary-ink); font-variant-numeric: tabular-nums; }
.done-note { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.done-note .mark { color: var(--primary-ink); font-weight: 800; }
.success { text-align: center; padding-top: 10px; }
.success .check { width: 64px; height: 64px; border-radius: 50%; margin: 6px auto 12px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 32px; font-weight: 800; }

.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ba figure { margin: 0; position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.ba img { width: 100%; height: 100%; object-fit: cover; }
.ba figcaption { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 700; }
.install-hero { display: grid; place-items: center; margin: 4px 0 12px; }
.install-hero img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.ios-steps { list-style: decimal; padding-left: 20px; margin: 14px 0 0; }
.ios-steps li { padding: 8px 0; }
.ios-steps svg { vertical-align: -4px; }

/* ===== Login ===== */
.login { min-height: 100dvh; max-width: 480px; margin: 0 auto; padding: calc(var(--safe-top) + 40px) var(--gutter) calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; }
.login .logo { height: 30px; width: auto; align-self: flex-start; margin-bottom: 36px; }
.login h1 { font-size: 28px; font-weight: var(--heavy); margin: 0 0 6px; }
.login .lede { color: var(--muted); margin: 0 0 24px; }
.login label.caps { display: block; margin-bottom: 8px; }
.field { display: flex; align-items: center; gap: 8px; border-radius: var(--radius-sm); background: var(--surface); padding: 0 14px; border: 2px solid transparent; }
.field:focus-within { border-color: var(--primary); background: var(--card); }
.field span { font-weight: 600; color: var(--muted); }
.field select { border: 0; background: transparent; font-size: 16px; font-weight: 600; color: var(--ink-2); padding: 0 4px 0 0; outline: 0; }
.field input { flex: 1; min-width: 0; height: 56px; border: 0; outline: 0; background: transparent; font-size: 20px; font-variant-numeric: tabular-nums; }
.code-input { width: 100%; height: 64px; border-radius: var(--radius-sm); border: 2px solid transparent; background: var(--surface); text-align: center; font-size: 30px; font-weight: 700; letter-spacing: 0.4em; padding-left: 0.4em; outline: 0; }
.code-input:focus { border-color: var(--primary); background: var(--card); }
.login .cta { margin-top: 16px; background: var(--primary); color: var(--on-primary); }
.login .error { color: var(--bad); font-size: 14px; margin: 10px 0 0; min-height: 20px; }
.login .fine { margin-top: auto; padding-top: 24px; text-align: center; font-weight: 500; }
.login .notice { margin: 16px 0 0; }
.login .switch { display: flex; justify-content: space-between; }
.login .switch .text-link { width: auto; }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 80px); z-index: 60; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; max-width: calc(100% - 32px); text-align: center; transition: all 0.2s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.skeleton { height: 120px; margin: 12px var(--gutter); border-radius: var(--radius); background: linear-gradient(90deg, var(--surface), var(--bg), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Estrellas de la calificación (solo las ve el equipo administrador) */
.stars-txt { color: #C9956B; letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.stars-txt span { color: var(--line); }
.stat .n { font-size: 20px; line-height: 1.2; }
.block input:not([type]) { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 10px 12px; outline: 0; font-size: 16px; }
.block input:not([type]):focus { border-color: var(--primary); background: var(--card); }
