:root {
  --g900: #123d24; --g700: #1f6b3a; --g500: #3f9a57; --g100: #e6f2e8; --g50: #f3f8f4;
  --ink: #1b2a20; --muted: #5d6e62; --line: #dbe5dd; --bg: #f5f7f4; --card: #fff;
  --amber-bg: #fff4d6; --amber: #8a5a00; --red-bg: #fde8e6; --red: #a3261b; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0 0 .25rem; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .5rem; }
.muted, .hint { color: var(--muted); font-size: .86rem; }
.hint { display: block; margin-top: .2rem; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem clamp(1rem, 4vw, 2.5rem); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand strong { display: block; font-size: 1.15rem; color: var(--g900); letter-spacing: .01em; }
.brand small { display: block; color: var(--muted); font-size: .8rem; }
.doclinks { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; justify-content: flex-end; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.langs button { border: 0; background: #fff; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .04em; padding: .3rem .65rem; cursor: pointer; }
.langs button + button { border-left: 1px solid var(--line); }
.langs button[aria-pressed=true] { background: var(--g700); color: #fff; }
.langs button:focus-visible { outline: 3px solid rgba(63, 154, 87, .35); outline-offset: -2px; }
.doclink { color: var(--g700); font-weight: 600; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.doclink:hover { text-decoration: underline; }

.banner { padding: .7rem clamp(1rem, 4vw, 2.5rem); background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid #f0d890; font-size: .92rem; }
.banner.info { background: var(--g50); color: var(--g900); border-color: var(--line); }

main { max-width: 980px; margin: 0 auto; padding: 1.4rem clamp(1rem, 4vw, 1.5rem) 2rem; display: grid; gap: 1.2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: 0 1px 2px rgba(18, 61, 36, .05), 0 6px 20px rgba(18, 61, 36, .04); }

label { display: block; font-weight: 600; font-size: .88rem; margin: .9rem 0 .3rem; }
label.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 400; color: var(--muted); margin: .4rem 0 0; font-size: .86rem; }
input[type=text], input[type=password], input[type=number], input[type=date], select {
  width: 100%; padding: .65rem .75rem; border: 1px solid #c5d3c8; border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, .drop:focus-visible, button:focus-visible { outline: 3px solid rgba(63, 154, 87, .35); outline-offset: 1px; border-color: var(--g500); }
select:disabled { background: #f0f3f0; color: var(--muted); }
.row-key { display: flex; gap: .5rem; }
.under-key { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
#keyMsg.ok { color: var(--g700); } #keyMsg.bad { color: var(--red); }

.tabs { display: flex; gap: .3rem; margin: 1.2rem 0 .9rem; padding: .25rem; background: var(--g50); border: 1px solid var(--line); border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs button { border: 0; background: transparent; padding: .5rem .95rem; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected=true] { background: #fff; color: var(--g900); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.drop { border: 2px dashed #b5cbb9; border-radius: 12px; padding: 1.6rem 1rem; text-align: center; color: var(--g700); background: var(--g50); cursor: pointer; transition: background .15s, border-color .15s; }
.drop p { margin: .3rem 0 0; color: var(--ink); }
.drop .muted { color: var(--muted); }
.drop:hover, .drop.over { background: var(--g100); border-color: var(--g500); }
.drop.has-file { border-style: solid; background: #fff; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } .top { flex-wrap: wrap; } }

button.primary { margin-top: 1.3rem; width: 100%; padding: .85rem 1rem; border: 0; border-radius: 12px; font: inherit; font-weight: 700; color: #fff; background: linear-gradient(180deg, var(--g500), var(--g700)); cursor: pointer; box-shadow: 0 2px 8px rgba(31, 107, 58, .3); }
button.primary:hover:not(:disabled) { filter: brightness(1.06); }
button.primary:disabled { background: #b9c7bc; box-shadow: none; cursor: not-allowed; }
button.ghost { border: 1px solid #c5d3c8; background: #fff; color: var(--g900); padding: .55rem .85rem; border-radius: 10px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
button.ghost:hover { background: var(--g50); }

.loading { display: flex; align-items: center; gap: 1rem; }
.loading p { margin: 0; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--g100); border-top-color: var(--g700); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.alert { padding: .9rem 1.1rem; border-radius: 12px; border: 1px solid; }
.alert.error { background: var(--red-bg); border-color: #f2b8b2; color: var(--red); }
.alert small { display: block; opacity: .75; margin-top: .3rem; }

#results { display: grid; gap: 1.2rem; }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .8rem; }
#map { height: 340px; border-radius: 12px; border: 1px solid var(--line); background: #e9efe9; z-index: 0; }
.legend { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; font-size: .8rem; color: var(--muted); }
.legend i { flex: 0 0 150px; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #eef5d9, #8fc86b, #1f7a46, #0e4d2e); border: 1px solid var(--line); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1rem; }
.lot { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.lot .big { font-size: 2.3rem; font-weight: 800; line-height: 1.1; margin: .7rem 0 .15rem; letter-spacing: -.02em; color: var(--g700); }
.lot .big span { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: .25rem; }
.range { position: relative; height: 10px; border-radius: 6px; background: var(--g100); margin: .9rem 0 .35rem; }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--g500); opacity: .75; }
.range-med { position: absolute; top: -3px; width: 3px; height: 16px; border-radius: 2px; background: var(--g900); transform: translateX(-1px); }
.range-labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.meter { height: 6px; border-radius: 4px; background: var(--g100); margin: .9rem 0 .3rem; overflow: hidden; }
.meter div { height: 100%; background: var(--g700); }
.warn { margin: .6rem 0 0; padding: .55rem .7rem .55rem 1.6rem; background: var(--amber-bg); color: var(--amber); border-radius: 10px; font-size: .84rem; }
.reqid { text-align: right; margin: 0; }
.notes .warn { margin: 0; }

footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 1rem 2rem; }

/* SIEMPRE al final del archivo. Sin esto, reglas como .loading { display: flex } pisan el atributo hidden
   y se ve lo que debería estar oculto (el spinner, los resultados vacíos, los campos de punto y radio). */
[hidden] { display: none !important; }
