/* Estilo iOS (listas agrupadas) con el violeta de Fedelivery como color de acción. Claro y oscuro según el sistema. */
:root {
  --bg: #f2f2f7;
  --cell: #ffffff;
  --text: #000000;
  --muted: #6c6c70;
  --sep: #c6c6c8;
  --fill: #e5e5ea;
  --accent: #7c3aed;
  --green: #1c7c3a;
  --red: #d70015;
  --orange: #b25000;
  --bar: rgba(249, 249, 249, .94);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --cell: #1c1c1e;
    --text: #ffffff;
    --muted: #98989f;
    --sep: #38383a;
    --fill: #2c2c2e;
    --accent: #c4b5fd;
    --green: #30d158;
    --red: #ff6961;
    --orange: #ffb340;
    --bar: rgba(22, 22, 24, .94);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; font-size: 17px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.muted { color: var(--muted); }
.ok { color: var(--green); }
.warn { color: var(--orange); }

/* Encabezados */
.big { padding: max(16px, env(safe-area-inset-top)) 20px 4px; }
.big h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.4px; }
.big p { margin: 2px 0 0; font-size: 15px; }
.nav { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: .5px solid var(--sep); }
.nav b { font-size: 17px; font-weight: 600; text-align: center; }
.nav .link:last-child { justify-self: end; }
.link { color: var(--accent); min-height: 44px; }
.link.strong { font-weight: 600; }
.link.small { font-size: 13px; min-height: 0; margin-left: 4px; text-decoration: underline; }

.main { padding: 8px 16px calc(110px + env(safe-area-inset-bottom)); }
.main.form { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
h2 { margin: 22px 16px 6px; font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--muted); letter-spacing: .2px; }
.foot { margin: 6px 16px 0; font-size: 13px; color: var(--muted); line-height: 1.35; }

/* Listas agrupadas */
.group { background: var(--cell); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 16px; position: relative; }
.row + .row::before, .item + .item::before, .row + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.row .lbl { flex: 0 0 auto; }
.row input, .row select { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; outline: none; text-align: right; padding: 10px 0;
  color: var(--text); font-size: 17px; }
.row input[type="date"], .row input[type="time"] { color: var(--accent); -webkit-appearance: none; appearance: none; min-height: 24px; }
.row input::-webkit-date-and-time-value { text-align: right; }
.row select { -webkit-appearance: none; appearance: none; color: var(--accent); direction: rtl; }
.row input::placeholder { color: var(--muted); opacity: .8; }
.row .unit { color: var(--muted); }
#total { margin-left: auto; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px 10px 16px; text-align: left; position: relative; }
.item .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .grow small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.item small { font-size: 14px; }
.item .chev { color: var(--sep); display: flex; }
.item.add { color: var(--accent); }
.none { margin: 0; padding: 16px; color: var(--muted); font-size: 15px; text-align: center; }

/* Tarjetas de envíos en curso */
.card { background: var(--cell); border-radius: 14px; margin-bottom: 12px; overflow: hidden; border: 2px solid transparent; }
.card.running { border-color: var(--accent); }
.card-body { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px 16px 10px; text-align: left; }
.card-top { display: flex; justify-content: space-between; gap: 8px; }
.card-top span { font-size: 15px; }
.addr { font-size: 16px; }
.card-money { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 12px 16px; border-top: .5px solid var(--sep); }
.timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); }
.timer.on { color: var(--accent); font-size: 22px; font-weight: 600; }
.pill { min-height: 44px; padding: 0 22px; border-radius: 22px; color: #fff; font-weight: 600; }
.pill.violet { background: #7c3aed; }
.pill.green { background: #1c7c3a; }
.banner { background: var(--cell); border-radius: 12px; padding: 12px 16px; margin-top: 8px; display: flex; align-items: center; gap: 8px; }

/* Botones */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; border-radius: 14px;
  background: #7c3aed; color: #fff; font-size: 17px; font-weight: 600; text-decoration: none; margin-top: 12px; }
.btn:active, .pill:active, .item:active, .card-body:active { opacity: .7; }
.btn.ghost { background: var(--cell); color: var(--accent); }
.btn.danger { background: var(--cell); color: var(--red); }
.stack { margin-top: 12px; }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.bar { position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); padding: 0 16px 10px; max-width: 560px; margin: 0 auto; }
.bar .btn { margin: 0; box-shadow: 0 6px 20px rgba(124, 58, 237, .3); }

.empty { text-align: center; padding: 48px 24px 8px; color: var(--muted); }
.empty p { margin: 8px 0; }
.empty p:first-of-type { color: var(--text); font-size: 19px; font-weight: 600; }

/* Jornada */
.daynav { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.daynav input { flex: 1 1 auto; min-width: 0; border: 0; border-radius: 10px; background: var(--fill); padding: 10px 12px; color: var(--text); min-height: 44px; -webkit-appearance: none; appearance: none; }
.icon { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.icon:disabled { opacity: .3; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--cell); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Barra de pestañas */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 4px 0 env(safe-area-inset-bottom); background: var(--bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-top: .5px solid var(--sep); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 52px; justify-content: center; color: var(--muted); font-size: 10px; font-weight: 500; }
.tabbar button.on { color: var(--accent); }

.toast { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translate(-50%, -150%); z-index: 10; max-width: 90vw;
  background: rgba(30, 30, 32, .94); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 15px; transition: transform .25s; text-align: center; }
.toast.show { transform: translate(-50%, 0); }
