body { background: var(--bg-soft); font-size: 17px; padding-bottom: env(safe-area-inset-bottom); min-height: 100vh; }

#bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); min-height: 60px;
}
#back { background: none; border: 1px solid var(--line-2); border-radius: 2px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink); padding: 0; }
#title { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#title .logo b { font-size: 14px; }
.net {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 11px; background: #fff;
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.net::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #b0b0b8; }
.net.on::before { background: var(--ok); }
.net.pending { border-color: var(--accent); color: var(--accent); }
.net.pending::before { background: var(--accent); }

main { padding: 18px 16px 40px; max-width: 640px; margin: 0 auto; }
h2 { font-size: 24px; margin: 4px 0 12px; font-weight: 700; letter-spacing: -.01em; }
p { margin: 8px 0; line-height: 1.45; }
.muted { color: var(--muted); font-size: 14px; }
.eyebrow { display: block; margin: 22px 0 10px; }

/* acciones grandes */
.big {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 80px;
  background: #fff; color: var(--ink); border: 1px solid var(--line-2); border-radius: 4px;
  padding: 14px 16px; margin-bottom: 10px; font: inherit; font-size: 19px; font-weight: 700; text-align: left;
}
.big:active { background: var(--lav); border-color: var(--accent); }
.big .i { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; color: var(--accent); flex: none; }
.big small { display: block; font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.big .go { margin-left: auto; color: var(--line-2); }
.big.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.big.primary .i { background: #ffffff1f; border-color: #ffffff40; color: #fff; }
.big.primary small { color: #ffffffb3; }
.big.primary .go { color: #ffffff99; }
.big.center { justify-content: center; text-align: center; }

.submit {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; margin-top: 8px;
  background: var(--accent); color: #fff; border: 0; border-radius: 2px;
  font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.submit:active { background: var(--accent-ink); }
.submit[disabled] { opacity: .5; }

/* cuadrícula de actividades */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act {
  background: #fff; border: 1px solid var(--line-2); border-radius: 4px; min-height: 112px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); text-align: center;
}
.act .ico { color: var(--ink); }
.act:active { background: var(--lav); border-color: var(--accent); }
.act:active .ico { color: var(--accent); }
.act small { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); }

.target { background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 14px 16px; margin-bottom: 6px; }
.target .code { background: none; border: 0; padding: 0; font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.target .desc { color: var(--muted); font-size: 14px; margin-top: 2px; }
.target .t-head { display: flex; gap: 12px; align-items: center; }
.target .t-head .ico { color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 2px; margin-top: 12px; }
.seg button { flex: 1; border: 0; padding: 13px 6px; font: inherit; font-size: 15px; font-weight: 600; background: #fff; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--ink); color: #fff; }

/* formulario */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
input, select, textarea { font-size: 19px; padding: 14px; border-radius: 2px; }
textarea { min-height: 90px; }

.picker { display: grid; gap: 6px; }
.picker button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 2px; font: inherit; font-size: 17px; text-align: left; color: var(--ink);
}
.picker button .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; }
.picker button.on { border-color: var(--accent); background: var(--lav); font-weight: 600; }
.picker button .dot .ico { opacity: 0; }
.picker button.on .dot { border-color: var(--accent); background: var(--accent); color: #fff; }
.picker button.on .dot .ico { opacity: 1; }
.picker button small { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.picker.row { grid-template-columns: repeat(3, 1fr); }
.picker.row button { justify-content: center; }
.picker.row button .dot { display: none; }
.prod .dose { margin-top: 6px; margin-bottom: 4px; }
.prod.on .dose { border-color: var(--accent); }
.picker-empty { border: 1px dashed var(--line-2); padding: 14px; font-size: 14px; color: var(--muted); border-radius: 2px; background: #fff; }

.dose { display: flex; border: 1px solid var(--line-2); border-radius: 2px; background: #fff; }
.dose input { border: 0; flex: 1; min-width: 0; }
.dose input:focus { box-shadow: none; }
.dose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--lav-2); }
.dose .unit { display: grid; place-items: center; padding: 0 16px; border-left: 1px solid var(--line); font-family: var(--mono); font-size: 14px; color: var(--muted); background: var(--bg-soft); min-width: 90px; }

.photo-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border: 1px dashed var(--line-2); border-radius: 2px; background: #fff; font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 18px; }
.photo-prev { position: relative; margin-bottom: 18px; }
.photo-prev img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 2px; display: block; }
.photo-prev button { position: absolute; top: 8px; right: 8px; border: 0; border-radius: 2px; background: #111114cc; color: #fff; padding: 8px 10px; display: flex; gap: 6px; align-items: center; font-family: var(--mono); font-size: 11px; text-transform: uppercase; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.keypad button { min-height: 68px; font-family: var(--mono); font-size: 26px; font-weight: 500; border-radius: 2px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); display: grid; place-items: center; }
.keypad button:active { background: var(--lav); }
.keypad button.ok { background: var(--accent); color: #fff; border-color: var(--accent); font-size: 18px; letter-spacing: .08em; }
.num-display { font-family: var(--mono); font-size: 44px; text-align: center; font-weight: 700; background: #fff; border-radius: 2px; padding: 12px; border: 1px solid var(--line-2); min-height: 76px; }

.list-row { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line-2); border-radius: 2px; padding: 12px; margin-bottom: 8px; }
.list-row .i { color: var(--ink); }
.list-row .b { flex: 1; min-width: 0; }
.list-row .err { color: var(--danger); font-size: 13px; margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.list-row img { width: 54px; height: 54px; object-fit: cover; border-radius: 2px; }
.list-row button { border: 1px solid #f0c4bb; background: #fff; color: var(--danger); border-radius: 2px; width: 44px; height: 44px; display: grid; place-items: center; }

#reader { width: 100%; border-radius: 2px; overflow: hidden; background: var(--ink); margin-bottom: 14px; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--ink); color: #fff; font-size: 17px; font-weight: 600; padding: 16px; border-radius: 2px;
  display: flex; gap: 10px; align-items: center; justify-content: center;
}
#toast.err { background: var(--danger); }
.center-box { text-align: center; padding: 28px 0 12px; }
.login-mark { width: 72px; height: 72px; display: inline-grid; place-items: center; background: var(--accent); color: #fff; border-radius: 4px; }
.manual { display: flex; gap: 8px; }
.manual input { text-transform: uppercase; font-family: var(--mono); }
.manual button { border: 0; background: var(--ink); color: #fff; border-radius: 2px; padding: 0 20px; font-family: var(--mono); font-weight: 700; letter-spacing: .06em; }
