:root {
  color-scheme: light;
  --paper: #f6f5ef;
  --white: #fffefa;
  --ink: #19362f;
  --muted: #50655d;
  --line: #d9dfd5;
  --accent: #ad412b;
  --water: #e3efec;
  font: 15px/1.48 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible, .map:focus-visible { outline: 2px solid #145a80; outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }
a { color: #215e53; }
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line);
  background: var(--white); font-size: .73rem; letter-spacing: .14em;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; }
.brand-mark { display: grid; place-items: center; background: var(--ink); color: var(--white); width: 1.75rem; height: 1.75rem; border-radius: 50%; font-size: 1rem; }
.region { color: var(--muted); }
main { max-width: 1620px; margin: auto; padding: 1.65rem clamp(1rem, 4vw, 4rem) 2.5rem; }
.intro { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; column-gap: 3rem; margin-bottom: 1.4rem; }
.eyebrow { display: flex; align-items: center; gap: .5rem; color: var(--accent); font-weight: 750; font-size: .73rem; letter-spacing: .16em; }
.eyebrow span { width: 1.1rem; border-top: 1px solid currentColor; }
h1 { font: 500 clamp(3.4rem, 7.1vw, 6rem)/.97 Georgia, serif; letter-spacing: -.055em; margin: .25rem 0; }
.intro p { max-width: 345px; color: var(--muted); margin: .6rem 0 .3rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 305px); gap: 1rem; align-items: start; }
.map-panel, .panel { border: 1px solid var(--line); border-radius: .85rem; background: var(--white); overflow: hidden; }
.map-header, .map-footer { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .65rem 1rem; }
.map-header strong { font-size: .95rem; }
.status-dot { display: inline-block; margin-right: .55rem; width: .55rem; height: .55rem; border-radius: 50%; background: #4a8067; }
.map-footer { font-size: .72rem; color: var(--muted); }
.map-footer span:last-child { text-align: right; }
.map {
  position: relative; width: 100%; height: clamp(420px, 64vh, 760px);
  border-block: 1px solid #ceded9; background-color: var(--water);
  background-image: radial-gradient(#a2b8b340 1px, transparent 1px); background-size: 16px 16px;
  cursor: grab; overflow: hidden; touch-action: none;
}
.map.dragging { cursor: grabbing; }
.map.placing { cursor: crosshair; }
canvas, .pins { position: absolute; inset: 0; width: 100%; height: 100%; }
.pins { pointer-events: none; }
.pin {
  pointer-events: auto; position: absolute; z-index: 1; transform: translate(-50%, calc(-100% - 3px));
  display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid white;
  background: var(--accent); color: white; border-radius: 50%; box-shadow: 0 2px 5px #18362f70;
}
.pin::after { content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: white; border-bottom: 0; }
.pin span { font-size: .72rem; font-weight: 800; }
.pin[aria-pressed="true"] { background: #682c1b; border-color: #ffda9c; }
.map-controls { position: absolute; right: .8rem; top: .8rem; display: grid; z-index: 2; background: var(--white); border: 1px solid #abc0b6; border-radius: .55rem; overflow: hidden; box-shadow: 0 2px 10px #18362f14; }
.map-controls button { height: 40px; width: 42px; border: 0; background: transparent; color: var(--ink); font-size: 1.55rem; line-height: 1; }
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover:not(:disabled) { background: #e7eee5; }
.compass { position: absolute; left: 1.1rem; top: 1rem; display: grid; justify-items: center; font-size: .7rem; color: #355b52; pointer-events: none; }
.compass span { font-size: .95rem; line-height: 1; }
.scale { position: absolute; left: 1rem; bottom: .8rem; height: 1.25rem; text-align: center; border: 1px solid #52726a; border-top: 0; background: #f9fbf6a0; color: #214a40; font-size: .68rem; pointer-events: none; }
.map-tip, .map-message { position: absolute; z-index: 3; border: 1px solid var(--line); border-radius: .55rem; background: var(--white); box-shadow: 0 2px 12px #18362f16; }
.map-tip { top: 3rem; left: 1rem; max-width: min(70%, 19rem); padding: .45rem .65rem; font-size: .82rem; pointer-events: none; white-space: pre-line; }
.map-message { left: 50%; top: .8rem; transform: translateX(-50%); max-width: 70%; min-width: min(12rem, 70%); padding: .45rem .65rem; font-size: .85rem; text-align: center; pointer-events: none; }
.sidebar { display: grid; gap: .85rem; }
.panel { padding: 1rem; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
h2 { font-size: 1.03rem; margin: 0; }
h3 { font-size: .95rem; margin: 0 0 .6rem; }
.count { min-width: 1.45rem; border-radius: 1rem; background: #e5ede5; padding: .12rem .45rem; text-align: center; color: #355b4c; font-size: .73rem; font-weight: 700; }
.muted, .source { color: var(--muted); font-size: .79rem; }
.storage-note { margin: .65rem 0 0; }
.project-transfer { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.project-transfer button { font-size: .72rem; }
.status:empty, .project-list:empty, .legend:empty, .source:empty { display: none; }
.primary, .small { border: 1px solid var(--line); border-radius: .42rem; padding: .43rem .65rem; color: var(--ink); background: var(--white); font-size: .79rem; font-weight: 700; }
.primary { background: var(--ink); color: var(--white); border-color: var(--ink); }
.primary:hover { background: #2a5146; }
.small:hover { background: #edf0ea; }
#add { width: 100%; margin-top: .15rem; }
.project-list { list-style: none; padding: 0; margin: 0 0 .7rem; max-height: 15rem; overflow: auto; }
.project-list li { display: flex; align-items: center; gap: .35rem; border-bottom: 1px solid var(--line); padding: .25rem 0; }
.project-link { display: flex; align-items: center; gap: .42rem; min-width: 0; flex: 1; border: 0; background: transparent; color: var(--ink); padding: .45rem .2rem; text-align: left; font-weight: 650; overflow-wrap: anywhere; }
.project-link[aria-pressed="true"] { color: #8a311f; }
.project-number { font-variant-numeric: tabular-nums; font-size: .72rem; color: var(--accent); }
form { padding-top: .4rem; }
form label { display: grid; gap: .2rem; min-width: 0; font-size: .77rem; font-weight: 650; }
form input { width: 100%; border: 1px solid #aebcb0; border-radius: .35rem; padding: .35rem .42rem; color: var(--ink); background: white; }
.coordinates, .form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-top: .55rem; }
.locate { width: 100%; margin-top: .5rem; }
.text-button { padding: .3rem 0; border: 0; color: #8a311f; background: transparent; font-size: .78rem; text-decoration: underline; }
.layer-control { display: flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 700; cursor: pointer; margin: .45rem 0 .1rem; }
.layer-control input { accent-color: #2b6852; margin: 0; width: 1.02rem; height: 1.02rem; }
.swatch { flex: 0 0 .8rem; width: .8rem; height: .8rem; border: 1px solid #284c3d38; border-radius: .16rem; }
.pattern { border-color: #8a4830; background: repeating-linear-gradient(135deg, #f6e9cf, #f6e9cf 2px, #99573a 2px, #99573a 3px, #f6e9cf 3px, #f6e9cf 5px); }
.land { background: #9ab187; }
.marine { border-color: #468ba0; background: #b8dbe4; }
.legend, #source-list { list-style: none; padding: 0; margin: .35rem 0 .45rem 1.47rem; font-size: .76rem; }
.legend li { display: flex; align-items: center; gap: .4rem; line-height: 1.27; margin: .3rem 0; }
.source { margin-left: 1.47rem; }
details { margin-top: .65rem; padding-top: .55rem; border-top: 1px solid var(--line); font-size: .79rem; }
summary { cursor: pointer; font-weight: 700; }
#source-list { margin-left: .5rem; }
#source-list li + li { margin-top: .42rem; }
@media (max-width: 780px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: 1fr 1fr; align-items: start; }
  .map { height: clamp(365px, 59vh, 570px); }
}
@media (max-width: 510px) {
  main { padding-top: 1.1rem; }
  .sidebar { grid-template-columns: 1fr; }
  .region { font-size: .59rem; }
  .map-footer { padding-inline: .55rem; }
  .map { height: clamp(320px, 52vh, 470px); }
}

/* ===== Visor AMP: agregados ===== */
h1 em { display: block; font-style: italic; font-size: .42em; letter-spacing: -.02em; color: var(--muted); margin-top: .35rem; }
.map-header { flex-wrap: wrap; }
.view-buttons { display: flex; flex-wrap: wrap; gap: .35rem; }
.view-buttons .small[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.map { height: clamp(460px, 70vh, 820px); background-image: none; background-color: #e8f1f0; }
select, textarea { font: inherit; width: 100%; border: 1px solid #aebcb0; border-radius: .35rem; padding: .35rem .42rem; color: var(--ink); background: white; }
textarea { resize: vertical; min-height: 3.6rem; }
form label.description { margin-top: .55rem; }
.area-list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.area-list li { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: .45rem; padding: .42rem 0; border-bottom: 1px solid var(--line); }
.area-list input { accent-color: #2b6852; margin: 0; width: 1.02rem; height: 1.02rem; }
.area-name { border: 0; background: transparent; padding: 0; text-align: left; color: var(--ink); min-width: 0; }
.area-name strong { display: block; font-size: .85rem; line-height: 1.25; }
.area-name small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.3; }
.area-name[aria-pressed="true"] strong { color: #8a311f; }
.area-list .small { padding: .3rem .5rem; font-size: .72rem; }
.swatch.round { border-radius: 50%; }
.layer-control.context { font-weight: 600; font-size: .8rem; margin-top: .7rem; }
.note { margin: .55rem 0 0; font-size: .74rem; }
.sheet-category { margin: -.25rem 0 .6rem; font-size: .8rem; font-weight: 700; color: #2b6852; }
.sheet-data { display: grid; grid-template-columns: auto 1fr; gap: .25rem .7rem; margin: 0 0 .6rem; font-size: .78rem; }
.sheet-data dt { color: var(--muted); }
.sheet-data dd { margin: 0; font-weight: 600; }
.sheet .muted { font-size: .77rem; }
.sheet-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sheet-actions a { font-size: .78rem; }
.pin.hito { background: #2c5f8f; border-radius: .35rem; transform: translate(-50%, -50%) rotate(45deg); width: 26px; height: 26px; }
.pin.hito span { transform: rotate(-45deg); }
.pin.hito::after { display: none; }
.pin.hito[aria-pressed="true"] { background: #173a5a; }
.project-link .tag { margin-left: auto; font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.project-number.hito { color: #2c5f8f; }
.remove-confirm { color: white; background: #8a311f; border-radius: .35rem; padding: .3rem .5rem; text-decoration: none; }
@media (max-width: 780px) { .view-buttons { width: 100%; } }
.project-link .project-number { flex: 0 0 auto; }
.project-link .tag { flex: 0 0 auto; white-space: nowrap; padding-left: .3rem; }
.panel > details { margin-top: 0; padding-top: 0; border-top: 0; }
.layer-heading { margin: .9rem 0 .1rem; font-size: .82rem; color: var(--muted); }
