*{box-sizing:border-box}
:root{
  --bg:#eef1ea;
  --surface:rgba(255,255,255,.76);
  --ink:#1f2a22;
  --muted:#667166;
  --line:rgba(223,229,220,.82);
  --accent:#6a4508;
  --accent-2:#7aa03a;
  --soft:rgba(237,242,234,.80);
  --warn:#7a5a22;
  --radius:18px;
}
html{min-height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    linear-gradient(rgba(245,247,240,.38), rgba(245,247,240,.42)),
    url('fondo_agroecosistemas.jpg') center center / cover fixed no-repeat;
  color:var(--ink);
  min-height:100vh;
  position:relative;
}
.page-overlay{
  position:fixed;
  inset:0;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.12));
  pointer-events:none;
}
.site-header{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 18px;
  background:rgba(255,255,255,.72);
  backdrop-filter:blur(8px);
  border-bottom:1px solid rgba(223,229,220,.75);
}
.brand{display:flex;align-items:center;gap:12px}
.brand-mark{
  width:44px;height:44px;border-radius:12px;
  display:grid;place-items:center;
  background:rgba(106,69,8,.92);
  overflow:hidden;
  box-shadow:0 2px 10px rgba(0,0,0,.12);
}
.brand-icon{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.brand h1{font-size:1.05rem;margin:0;color:var(--accent)}
.brand p{margin:2px 0 0;color:var(--muted);font-size:.85rem}
.header-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  min-width:0;
}
.pi-auth-status{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:36px;
  padding:7px 10px;
  border:1px solid rgba(106,69,8,.14);
  border-radius:12px;
  background:rgba(255,255,255,.58);
  color:var(--accent);
  font-size:.82rem;
  font-weight:650;
  max-width:310px;
}
.pi-auth-status.authenticated{
  border-color:rgba(122,160,58,.42);
  background:rgba(237,242,234,.76);
}
.pi-auth-status.error{
  border-color:rgba(150,74,60,.30);
  background:rgba(255,244,241,.76);
  color:#7d4036;
}
#piAuthText{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.pi-signin-button{
  flex:0 0 auto;
  padding:7px 10px;
  border-radius:9px;
  background:var(--accent);
  color:#fff;
  font-size:.78rem;
}
.app-shell{position:relative;z-index:1;width:min(920px,calc(100% - 28px));margin:28px auto 44px}
.card{
  background:var(--surface);
  border:1px solid rgba(223,229,220,.75);
  border-radius:var(--radius);
  padding:24px;
  box-shadow:0 12px 32px rgba(31,42,34,.10);
  margin-bottom:18px;
  backdrop-filter:blur(5px);
}
.intro-card{text-align:center}
.hero-logo{
  display:block;
  width:min(100%,820px);
  margin:0 auto 14px;
  height:auto;
}
.hidden{display:none!important}
.eyebrow{
  display:inline-block;
  font-size:.78rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--accent);
  font-weight:700;
  margin-bottom:10px;
}
h2{font-size:clamp(1.55rem,5vw,2.3rem);line-height:1.12;margin:0 0 14px;color:var(--accent)}
h3{margin-top:0;color:var(--accent)}
p{line-height:1.6}
.notice{
  margin:20px 0;
  padding:14px 16px;
  background:var(--soft);
  border-left:4px solid var(--accent-2);
  border-radius:12px;
  color:#4c5a4c;
  font-size:.92rem;
}
button{
  border:0;
  border-radius:12px;
  padding:13px 18px;
  font:inherit;
  font-weight:700;
  cursor:pointer;
}
button:disabled{cursor:not-allowed;opacity:.45}
.primary-button{background:var(--accent);color:white}
.secondary-button{background:var(--soft);color:var(--accent)}
.ghost-button{background:transparent;color:var(--accent);padding:8px 10px}
.progress-wrap{margin-bottom:26px}
.progress-meta{
  display:flex;justify-content:space-between;gap:12px;
  color:var(--muted);font-size:.9rem;margin-bottom:8px
}
.progress-track{height:9px;background:rgba(232,236,230,.82);border-radius:999px;overflow:hidden}
.progress-bar{height:100%;width:0;background:var(--accent-2);transition:width .25s ease}
.question-tag{
  display:inline-block;padding:6px 9px;border-radius:999px;
  background:var(--soft);color:var(--accent);font-size:.78rem;font-weight:700
}
.question-title{font-size:1.35rem;line-height:1.35;margin:12px 0 18px;color:var(--accent)}
.options{display:grid;gap:10px}
.option{
  display:flex;align-items:flex-start;gap:12px;
  border:1px solid var(--line);border-radius:14px;padding:14px;
  cursor:pointer;background:rgba(255,255,255,.74);
}
.option:hover{border-color:#b9c8b5}
.option input{margin-top:4px}
.option.selected{border-color:var(--accent-2);background:rgba(237,242,234,.88)}
.option strong{display:block;margin-bottom:3px;color:var(--accent)}
.option span{color:var(--muted);font-size:.9rem;line-height:1.4}
.nav-row{display:flex;justify-content:space-between;gap:12px;margin-top:24px}
.nav-row button{min-width:115px}
.score-hero{
  display:flex;align-items:center;justify-content:space-between;
  gap:16px;padding:18px 0 4px
}
.score-label{display:block;color:var(--muted);font-size:.9rem}
#globalScore{font-size:3.8rem;line-height:1;color:var(--accent)}
.score-max{font-size:1.25rem;color:var(--muted)}
.status-pill{
  padding:10px 14px;border-radius:999px;background:var(--soft);color:var(--accent);font-weight:800
}
.dimension-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:18px}
.dimension-card{border:1px solid var(--line);border-radius:14px;padding:16px;background:rgba(255,255,255,.70)}
.dimension-card .row{display:flex;justify-content:space-between;gap:14px;align-items:center}
.dimension-card h4{margin:0;color:var(--accent)}
.dimension-score{font-size:1.6rem;font-weight:800;color:var(--accent)}
.mini-track{height:8px;background:rgba(237,240,235,.82);border-radius:999px;overflow:hidden;margin-top:12px}
.mini-bar{height:100%;background:var(--accent-2)}
.recommendation{
  border-left:4px solid var(--accent-2);
  padding:12px 14px;
  background:rgba(250,251,248,.78);
  border-radius:0 12px 12px 0;
  margin-bottom:12px
}
.recommendation h4{margin:0 0 5px;color:var(--accent)}
.recommendation p{margin:0;color:var(--muted)}
.actions-card{display:flex;justify-content:flex-end;gap:12px}
.site-footer{
  position:relative;
  z-index:1;
  text-align:center;color:#3f4e3f;font-size:.82rem;
  padding:0 18px 34px
}
@media (max-width:640px){
  .site-header{padding:12px 14px;align-items:flex-start}
  .header-actions{flex-direction:column;align-items:flex-end;gap:4px}
  .pi-auth-status{max-width:190px;padding:6px 8px;font-size:.76rem}
  .pi-signin-button{padding:6px 8px;font-size:.74rem}
  .ghost-button{display:none}
  .app-shell{width:min(100% - 18px,920px);margin-top:14px}
  .card{padding:19px;border-radius:15px}
  .dimension-grid{grid-template-columns:1fr}
  .score-hero{align-items:flex-start;flex-direction:column}
  .actions-card{flex-direction:column}
  .actions-card button{width:100%}
}
@media print{
  .site-header,.site-footer,.actions-card,#intro,#questionnaire{display:none!important}
  body{background:white}
  .page-overlay{display:none}
  .app-shell{width:100%;margin:0}
  .card{box-shadow:none;break-inside:avoid;background:white}
}


/* Pestañas de navegación */
.app-tabs{
  display:flex;
  gap:8px;
  width:max-content;
  max-width:100%;
  margin:0 auto 18px;
  padding:6px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(223,229,220,.75);
  border-radius:14px;
  box-shadow:0 8px 22px rgba(31,42,34,.08);
  backdrop-filter:blur(6px);
}
.tab-button{
  min-width:130px;
  padding:10px 18px;
  background:transparent;
  color:var(--accent);
  border-radius:10px;
}
.tab-button.active{
  background:var(--accent);
  color:#fff;
}
.nav-hidden{display:none!important}
.references-card{max-width:920px}
.references-intro{margin-bottom:22px}
.references-list{
  margin:0;
  padding-left:1.5rem;
  display:grid;
  gap:20px;
}
.references-list li{
  line-height:1.65;
  padding-left:.35rem;
}
.references-list a{
  display:inline-block;
  margin-top:4px;
  color:var(--accent);
  font-weight:650;
  overflow-wrap:anywhere;
}
.references-list a:hover{text-decoration-thickness:2px}
@media (max-width:640px){
  .app-tabs{width:100%}
  .tab-button{flex:1;min-width:0}
}
