[hidden] { display: none !important; }
@font-face { font-family: 'Atkinson'; src: url('fonts/Atkinson-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('fonts/Atkinson-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #FBF8F1; --ink: #1A1A17; --muted: #4A4A44; --line: #E4DED0; --line2: #C9C2B2;
  --green: #2F6B3A; --green-d: #1F4A27; --green-l: #E6F0E4; --amber: #C77700; --gold: #F2C14E;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'Atkinson', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 20px; line-height: 1.3; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
#app.dark { background: #111410; color: #fff; max-width: none; }
body.dark { background: #111410; }
h1 { margin: 0; font-size: 32px; line-height: 1.15; }
h2 { margin: 0; font-size: 26px; }
.muted { color: var(--muted); }
.small { font-size: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.push { margin-top: auto; }
svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Botones */
.btn { border: 3px solid var(--ink); background: #fff; color: var(--ink); border-radius: 18px; min-height: 64px; padding: 10px 16px; font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-d); }
.btn-primary:active { box-shadow: 0 2px 0 var(--green-d); }
.btn-primary[disabled] { background: #9FB3A2; border-color: #9FB3A2; box-shadow: none; }
.btn-xl { min-height: 76px; font-size: 28px; }
.btn-soft { background: #F1E7D4; border-color: #F1E7D4; color: #5A3A0A; }
.btn-link { border: 0; background: none; text-decoration: underline; color: var(--green-d); }
.back { width: 56px; height: 56px; min-height: 56px; padding: 0; border-width: 2px; border-color: var(--line2); border-radius: 14px; font-size: 28px; }

.seg { min-height: 60px; border-radius: 16px; border: 3px solid var(--line2); background: #fff; font-size: 22px; font-weight: 700; padding: 6px; }
.seg.on { background: var(--green); border-color: var(--green); color: #fff; }

.hero { display: flex; align-items: center; gap: 18px; background: var(--green); color: #fff; border: 0; border-radius: 22px; padding: 24px 22px; box-shadow: 0 6px 0 var(--green-d); text-align: left; width: 100%; }
.hero .t { font-size: 30px; font-weight: 700; display: block; }
.hero .s { font-size: 18px; color: #DCEBD8; display: block; }
.hero svg.i { font-size: 64px; }
.hero.alt { background: #fff; color: var(--ink); border: 3px solid var(--ink); box-shadow: none; padding: 18px 22px; }
.hero.alt .t { font-size: 26px; } .hero.alt .s { color: var(--muted); } .hero.alt svg.i { font-size: 50px; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; font-size: 16px; font-weight: 700; background: var(--green-l); color: var(--green-d); }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.pill.off { background: #F6E3CF; color: #6B3D00; } .pill.off .dot { background: var(--amber); }

/* Actividades */
.act { min-height: 100px; border: 0; border-radius: 18px; color: #fff; font-size: 23px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; }
.act svg.i { font-size: 36px; }
.act.light { background: #fff !important; color: var(--ink); border: 3px solid var(--ink); }
.opt { min-height: 64px; border-radius: 16px; border: 3px solid var(--line2); background: #fff; font-size: 21px; font-weight: 700; padding: 6px; }

/* Contador */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .lbl { width: 86px; font-size: 22px; font-weight: 700; }
.stepper button { width: 64px; height: 64px; border-radius: 14px; border: 2px solid var(--ink); background: #fff; font-size: 34px; font-weight: 700; line-height: 1; }
.stepper .val { flex: 1; text-align: center; font-size: 36px; font-weight: 700; }
.stepper .val small { font-size: 20px; color: var(--muted); }

/* Planta */
.plant-head { background: var(--green-d); color: #fff; border-radius: 20px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; }
.plant-head .big { font-size: 38px; font-weight: 700; line-height: 1.05; }
.plant-head .code { font-size: 16px; color: #CFE3CB; letter-spacing: 1px; }
.band { border-radius: 20px; padding: 14px 18px; color: #fff; display: flex; flex-direction: column; }
.band .big { font-size: 36px; font-weight: 700; }

textarea { width: 100%; min-height: 90px; border-radius: 14px; border: 2px solid var(--line2); padding: 12px; font-size: 20px; background: #fff; resize: vertical; }

/* Mapa 3D */
.scene { position: relative; height: 280px; border-radius: 20px; background: #E9EFE3; overflow: hidden; perspective: 900px; display: flex; align-items: center; justify-content: center; }
.plane { transform: rotateX(56deg) rotateZ(-28deg); transform-style: preserve-3d; background: #CFE0C6; padding: 6px; box-shadow: 8px 8px 0 #A9C39D; display: flex; flex-direction: column; gap: 4px; }
.plane.km { width: 170px; height: 400px; }
.plane.dur { width: 230px; height: 300px; gap: 8px; padding: 8px; }
.bld { display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #3a2e1a; }
.area { flex: 1; display: flex; gap: 2px; padding: 4px; }
.area.inactive { opacity: .45; }
.area.active { outline: 2px dashed var(--green-d); }
.rowbar { border: 0; padding: 0; background: #3E8A4A; box-shadow: 2px 2px 0 var(--green-d); background-image: radial-gradient(circle, rgba(255,255,255,.55) 1px, transparent 1.5px); background-size: 6px 6px; }
.rowbar.v { flex: 1; } .rowbar.h { height: 9px; width: 100%; }
.rowbar.sel { background-color: var(--amber); box-shadow: 2px 2px 0 #7A4A00; }
.legend { position: absolute; left: 12px; bottom: 10px; background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.legend span { width: 14px; height: 14px; background: var(--amber); border-radius: 3px; }

/* Escáner */
.cam { position: relative; flex: 1; min-height: 360px; border-radius: 24px; overflow: hidden; background: #2B3A2A; }
.cam video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.frame div { width: 240px; height: 240px; border: 8px solid var(--gold); border-radius: 22px; box-shadow: 0 0 0 2000px rgba(0,0,0,.35); }
.cam .msg { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 18px; color: #fff; text-shadow: 0 1px 3px #000; }
.btn-dark { background: #2A2F29; border-color: #2A2F29; color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* Guardado */
.ok-circle { align-self: center; width: 150px; height: 150px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 14px #CFE3CB; margin-top: 30px; }
.ok-circle svg.i { font-size: 90px; stroke-width: 3; }

/* Teclado numérico */
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.keypad button { min-height: 64px; border-radius: 14px; border: 2px solid var(--ink); background: #fff; font-size: 30px; font-weight: 700; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 14px; font-size: 20px; font-weight: 700; transition: transform .25s, opacity .25s; opacity: 0; pointer-events: none; max-width: 90vw; text-align: center; z-index: 10; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
