/*
  Versión: 2.7 — 16/10/2026 12:15 (hora de Madrid)
  Cambios: vacaciones: días de vacaciones en verde en el calendario, aviso de vacaciones y alertas.
  Versión: 2.6 — 15/10/2026 13:45 (hora de Madrid)
  Cambios: botón destacado (Transferencia) en el cobro de una semana de plan fijo.
  Versión: 2.4 — 15/10/2026 12:45 (hora de Madrid)
  Cambios: pantalla de entrada con Google y botón Salir (web externa app.patsprettypups.com).
  Versión: 2.3 — 15/10/2026 13:00 (hora de Madrid)
  Cambios: icono de Rover como imagen (.om-img).
  Versión: 2.2 — 15/10/2026 12:30 (hora de Madrid)
  Cambios: insignias de origen (huella Rover / casa Directo), bloque Hoy y Mañana, ocupación en el
           calendario, selector de método de cobro, historial de correos de Rover.
  Versión: 2.0 — 13/10/2026 09:45 (hora de Madrid)
  Cambios: estilos de la Fase 1 (agenda, clientes, informes, hojas de edición).
*/
:root {
    --bg: #fbf6f1; --card: #ffffff; --ink: #2f2528; --muted: #8a7b7f; --line: #eee2e6;
    --pink: #d9577f; --pink-soft: #fbe3ea; --green: #2f8f6b; --green-soft: #e1f3ea;
    --amber: #b7791f; --amber-soft: #fdf0d9; --grey-soft: #f1ecee; --rover-soft: #ddf4f4; --rover: #007a7a;
    --radius: 16px; --shadow: 0 1px 2px rgba(60,30,40,.06), 0 4px 14px rgba(60,30,40,.06);
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Nunito Sans', system-ui, sans-serif; font-size: 16px; }
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.locked { overflow: hidden; }
  header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
  header .in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
  header .logo { width: 36px; height: 36px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-size: 19px; flex: none; }
  header h1 { font-size: 18px; margin: 0; font-weight: 800; }
  header small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
  main { max-width: 720px; margin: 0 auto; padding: 12px 16px; }
  h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; font-weight: 800; }
  h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
  .card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
  .card.tap { cursor: pointer; }
  .card.tap:active { transform: scale(.995); }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stats.four { grid-template-columns: repeat(2, 1fr); }
  @media (min-width: 560px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }
  .stat { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; min-width: 0; }
  .stat b { display: block; font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
  .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
  .who { font-weight: 800; font-size: 16px; }
  .price { font-weight: 800; white-space: nowrap; }
  .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
  .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
  .badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--grey-soft); color: var(--muted); }
  .b-rover { background: var(--rover-soft); color: var(--rover); }
  .b-directo { background: var(--pink-soft); color: var(--pink); }
  .b-ok { background: var(--green-soft); color: var(--green); }
  .b-warn { background: var(--amber-soft); color: var(--amber); }
  .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
  .empty { color: var(--muted); text-align: center; padding: 18px; font-size: 14px; }
  button { font: inherit; border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer; background: var(--grey-soft); color: var(--ink); }
  button.primary { background: var(--pink); color: #fff; }
  button.ghost { background: transparent; color: var(--pink); padding-left: 4px; padding-right: 4px; }
  button.danger { background: #fde8e8; color: #a12a2a; }
  button.small { padding: 7px 11px; font-size: 14px; }
  button.on { background: var(--pink); color: #fff; }
  button:disabled { opacity: .5; }
  label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 2px 6px; }
  input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); }
  .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .row3 select { font-size: 14px; padding: 9px 8px; }
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--grey-soft); border-radius: 12px; padding: 4px; gap: 4px; }
  .seg button { background: transparent; padding: 9px 6px; font-size: 14px; }
  .seg button.on { background: #fff; box-shadow: var(--shadow); color: var(--pink); }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip { padding: 8px 13px; border-radius: 99px; background: #fff; border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; }
  .chip.on { background: var(--pink); border-color: var(--pink); color: #fff; }
  .hint { font-size: 13px; color: var(--muted); margin: 6px 2px 0; }
  .check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 700; color: var(--ink); font-size: 15px; }
  .check input { width: 22px; height: 22px; accent-color: var(--pink); }
  .err { background: #fde8e8; color: #a12a2a; border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-weight: 600; font-size: 14px; }
  .toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
  .toolbar input { flex: 1; }
  .list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .list-item .sub { color: var(--muted); font-size: 14px; }
  .pill-count { background: var(--grey-soft); border-radius: 99px; padding: 2px 9px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
  table.rep { width: 100%; border-collapse: collapse; font-size: 14px; }
  table.rep th, table.rep td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
  table.rep th:first-child, table.rep td:first-child { text-align: left; }
  table.rep th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
  table.rep tr.total td { font-weight: 800; border-bottom: 0; }
  .scroll-x { overflow-x: auto; }
  /* Calendario */
  .cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .cal-head b { font-size: 17px; text-transform: capitalize; }
  .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .cal .dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); padding: 4px 0; }
  .cal .day { aspect-ratio: 1 / 1; border-radius: 10px; background: #fff; border: 1.5px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; cursor: pointer; padding: 0; }
  .cal .day.out { opacity: .35; }
  .cal .day.today { border-color: var(--pink); }
  .cal .day.sel { background: var(--pink); color: #fff; }
  .cal .dots { display: flex; gap: 2px; height: 6px; margin-top: 3px; }
  .cal .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
  .cal .dot.r { background: #00a8a8; }
  .cal .day.sel .dot { background: #fff; }
  /* Barra inferior */
  nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px max(6px, calc(50% - 360px)) calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  nav button { background: transparent; display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 6px 2px; }
  nav button .ic { font-size: 21px; line-height: 1; }
  nav button.on { color: var(--pink); background: transparent; }
  nav button.add { gap: 4px; }
  nav button.add .ic { background: var(--pink); color: #fff; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-top: -26px; box-shadow: 0 0 0 4px #fff, var(--shadow); font-size: 26px; }
  /* Hoja de edición (modal) */
  .sheet-bg { position: fixed; inset: 0; background: rgba(40,20,28,.35); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
  .sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  @media (min-width: 720px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }
  .sheet .sheet-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
  .sheet .sheet-top b { font-size: 18px; font-weight: 800; }
  .toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 40; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; text-align: center; }
  .toast.show { opacity: 1; }
  .loading { text-align: center; color: var(--muted); padding: 60px 0; }
  .suggest { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; margin-top: 6px; overflow: hidden; }
  .suggest div { padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
  .suggest div:last-child { border-bottom: 0; }
  .suggest .new { color: var(--pink); font-weight: 700; }
  .hidden { display: none !important; }
  /* Entrada (web externa) */
  .login { max-width: 420px; margin: 60px auto 0; text-align: center; padding: 28px 20px; }
  .login .logo-big { width: 84px; height: 84px; border-radius: 50%; background: var(--pink); display: grid; place-items: center; margin: 0 auto 14px; }
  .login .logo-big img { width: 84px; height: 84px; border-radius: 50%; }
  .login h3 { margin-bottom: 6px; }
  .login p { color: var(--muted); margin: 0 0 18px; }
  #gbtn { display: flex; justify-content: center; min-height: 44px; }
  header .out { margin-left: auto; font-size: 13px; padding: 7px 11px; }
  body.signed-out nav, body.signed-out header .out { display: none; }
  /* Insignias de origen */
  .om { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; vertical-align: -5px; margin-right: 6px; }
  .om svg { width: 14px; height: 14px; fill: #fff; }
  .om-r { background: #00a8a8; }
  .om-d { background: var(--pink); }
  img.om-img { display: inline-block; border-radius: 6px; background: #fff; object-fit: contain; box-shadow: 0 0 0 1px var(--line); }
  .om.sm { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
  .om.sm svg { width: 10px; height: 10px; }
  .who-line { display: flex; align-items: center; min-width: 0; }
  .who-line .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Hoy y mañana */
  .day-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .day-sum .stat b { font-size: 22px; }
  .mini { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 8px; cursor: pointer; }
  .mini .tag { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
  .mini .tag.in { background: var(--green-soft); color: var(--green); }
  .mini .tag.out { background: var(--amber-soft); color: var(--amber); }
  .mini .tag.stay { background: var(--grey-soft); color: var(--muted); }
  .mini .txt { flex: 1; min-width: 0; }
  .mini .txt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini .txt span { font-size: 13px; color: var(--muted); }
  .mini .time { font-weight: 800; font-size: 14px; white-space: nowrap; }
  .newline { display: flex; align-items: center; gap: 8px; background: var(--rover-soft); color: var(--rover); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 14px; margin-top: 12px; }
  .newline a { color: var(--rover); }
  /* Ocupación del calendario */
  .cal .occ { font-size: 10px; font-weight: 800; color: var(--muted); line-height: 1; margin-top: 2px; display: flex; align-items: center; gap: 2px; }
  .cal .occ i { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); display: inline-block; }
  .cal .occ i.r { background: #00a8a8; }
  .cal .day.sel .occ { color: #fff; }
  .cal .day.busy { background: #fff6f8; }
  .cal .day.sel, .cal .day.busy.sel { background: var(--pink); color: #fff; }
  /* Vacaciones */
  .cal .day.vac { background: var(--green-soft); color: var(--green); }
  .cal .day.vac.sel { background: var(--green); color: #fff; }
  .vac-card { background: var(--green-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; color: #1f5f47; font-size: 15px; }
  .vac-card b { color: var(--green); }
  .vac-card .actions { margin-top: 8px; }
  .alert { background: #fde2e2; color: #9b1c1c; border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 14px; margin-top: 8px; }
  /* Selector de método de cobro */
  .pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  .pay-grid button { padding: 16px 10px; font-size: 16px; background: #fff; border: 1.5px solid var(--line); }
  .pay-grid button.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
  /* Historial de Rover */
  details.log { margin-top: 8px; }
  details.log summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 8px 4px; }
  .log-row { display: flex; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
  .log-row .d { color: var(--muted); white-space: nowrap; }
  .log-row .s { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
