:root {
  --mineral: #edf0eb;
  --mineral-bright: #f8f9f5;
  --graphite: #101613;
  --graphite-soft: #344039;
  --graphite-lift: #1b2420;
  --orange: #ff4b2f;
  --orange-dark: #c92d18;
  --datum: #2364e8;
  --datum-light: #a9c5ff;
  --line: rgba(16, 22, 19, 0.22);
  --line-strong: rgba(16, 22, 19, 0.48);
  --line-inverse: rgba(248, 249, 245, 0.24);
  --muted-inverse: #b8c2bc;
  --danger: #ff806b;
  --header-height: 64px;
  --left-width: 326px;
  --right-width: 438px;
  color-scheme: light;
  font-family: "Commissioner", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  overflow-x: hidden;
}

body {
  background: var(--graphite);
  color: var(--graphite);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
summary,
input[type="radio"],
input[type="file"] {
  cursor: pointer;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
label:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
#map:focus-visible {
  outline: 3px solid var(--datum);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  background: var(--mineral-bright);
  color: var(--graphite);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: relative;
  z-index: 1000;
  height: var(--header-height);
  display: grid;
  grid-template-columns: var(--left-width) minmax(260px, 1fr) auto auto;
  align-items: center;
  background: var(--mineral-bright);
  border-bottom: 1px solid var(--graphite);
}

.app-brand {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border-right: 1px solid var(--line);
  text-decoration: none;
  font-family: "Saira Semi Condensed", "Arial Narrow", sans-serif;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.app-brand svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.app-title {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
  padding: 0 20px;
}

.app-title span,
.engine-state,
.coverage-strip span,
.dossier-footer span,
.map-readout span,
.result-state,
.result-identity span,
.study-code,
.map-attribution-note {
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.app-title b {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--graphite-soft);
  white-space: nowrap;
}

.engine-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--graphite-soft);
  white-space: nowrap;
}

.engine-state i,
.polygon-state > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--graphite-soft);
}

.engine-state[data-engine-state="online"] i {
  background: var(--datum);
}

.engine-state[data-engine-state="offline"] {
  color: var(--orange-dark);
}

.engine-state[data-engine-state="offline"] i {
  background: var(--orange);
}

.header-exit {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--graphite);
  color: var(--mineral-bright);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
}

.header-exit span {
  color: var(--orange);
}

.mobile-workflow {
  display: none;
}

.workbench {
  height: calc(100dvh - var(--header-height));
  display: grid;
  grid-template-columns: var(--left-width) minmax(380px, 1fr) var(--right-width);
  overflow: hidden;
}

.query-panel,
.dossier-panel {
  min-width: 0;
  min-height: 0;
}

.query-panel {
  position: relative;
  z-index: 500;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--mineral);
  border-right: 1px solid var(--graphite);
}

.query-scroll,
.dossier-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.query-scroll {
  padding: 28px 24px 34px;
}

.query-heading h1,
.dossier-heading h2,
.dossier-empty h3,
.dossier-loading h3,
.result-summary h3,
.study-section h3,
.evidence-section h3 {
  font-family: "Saira Semi Condensed", "Arial Narrow", sans-serif;
  margin: 0;
  letter-spacing: -0.025em;
}

.query-heading h1 {
  max-width: 9ch;
  font-size: clamp(2.3rem, 3.2vw, 3.35rem);
  line-height: 0.94;
  text-wrap: balance;
}

.query-heading p {
  max-width: 31ch;
  margin: 16px 0 0;
  color: var(--graphite-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.objective-list {
  margin: 30px 0 0;
  padding: 0;
  border: 0;
}

.objective-list legend,
.polygon-inputs h2 {
  width: 100%;
  margin: 0 0 9px;
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.objective-list label {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 11px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.objective-list label:last-child {
  border-bottom: 1px solid var(--line);
}

.objective-list input {
  appearance: none;
  width: 14px;
  height: 14px;
  margin: 4px 0 0;
  border: 1px solid var(--graphite);
  border-radius: 50%;
  background: transparent;
}

.objective-list input:checked {
  border: 4px solid var(--graphite);
  background: var(--orange);
}

.objective-list span {
  display: grid;
  gap: 2px;
}

.objective-list b {
  font-size: 0.9rem;
}

.objective-list small {
  color: var(--graphite-soft);
  font-size: 0.72rem;
  line-height: 1.4;
}

.polygon-inputs {
  margin-top: 30px;
}

.polygon-inputs > p {
  margin: 0 0 13px;
  color: var(--graphite-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.action,
.file-action,
.text-action,
.download-actions button {
  border-radius: 0;
}

.action {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--graphite);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-weight: 650;
}

.action-draw {
  background: var(--mineral-bright);
  color: var(--graphite);
}

.action-draw span {
  color: var(--datum);
  font-size: 1.1rem;
}

.action-analyze {
  margin-top: 14px;
  background: var(--graphite);
  color: var(--mineral-bright);
}

.action-analyze span:last-child {
  color: var(--orange);
  font-size: 1.2rem;
}

.action:disabled,
.map-toolbar button:disabled,
.file-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.action:not(:disabled):hover,
.header-exit:hover,
.download-actions button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 6px 14px rgba(16, 22, 19, 0.2);
}

.file-action {
  width: 100%;
  display: grid;
  gap: 3px;
  margin-top: 8px;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: inherit;
  text-align: left;
}

.file-action span {
  font-size: 0.82rem;
  font-weight: 650;
}

.file-action small {
  color: var(--graphite-soft);
  font-size: 0.65rem;
}

#polygon-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.paste-disclosure {
  margin-top: 9px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.paste-disclosure summary,
.evidence-section summary,
.other-studies summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 11px 0;
  font-size: 0.76rem;
  font-weight: 650;
}

.paste-disclosure label {
  display: block;
  margin-top: 3px;
  font-size: 0.7rem;
  color: var(--graphite-soft);
}

.paste-disclosure textarea {
  width: 100%;
  margin-top: 7px;
  padding: 9px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--mineral-bright);
  color: var(--graphite);
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.67rem;
  line-height: 1.45;
}

.text-action {
  min-height: 44px;
  margin: 8px 0 11px;
  padding: 8px 11px;
  border: 1px solid var(--graphite);
  background: transparent;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 650;
}

.polygon-state {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.polygon-state > i {
  margin-top: 5px;
}

.polygon-state[data-polygon-state="ready"] > i {
  background: var(--datum);
}

.polygon-state[data-polygon-state="error"] > i {
  background: var(--orange);
}

.polygon-state div {
  display: grid;
  gap: 3px;
}

.polygon-state b {
  font-size: 0.78rem;
}

.polygon-state span {
  color: var(--graphite-soft);
  font-size: 0.69rem;
  line-height: 1.45;
}

.privacy-copy {
  margin: 10px 0 0;
  color: var(--graphite-soft);
  font-size: 0.65rem;
  line-height: 1.45;
}

.coverage-strip,
.dossier-footer {
  min-height: 51px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 22px;
  border-top: 1px solid;
}

.coverage-strip {
  background: var(--mineral-bright);
  border-color: var(--graphite);
}

.coverage-strip b {
  font-size: 0.69rem;
  line-height: 1.35;
}

.map-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #dce2dc;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #dce2dc;
}

.map-panel[data-map-state="unavailable"] {
  background: var(--mineral);
}

.map-panel[data-map-state="unavailable"] #map {
  opacity: 0;
}

.leaflet-container {
  font-family: "Commissioner", "Segoe UI", sans-serif;
}

.leaflet-control-zoom {
  border: 1px solid var(--graphite) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.leaflet-control-zoom a {
  border-radius: 0 !important;
  color: var(--graphite) !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
}

.leaflet-control-attribution {
  margin: 0 !important;
  padding: 3px 5px !important;
  background: rgba(248, 249, 245, 0.92) !important;
  font-size: 9px !important;
}

.map-toolbar {
  position: absolute;
  z-index: 450;
  top: 16px;
  left: 58px;
  display: flex;
  background: var(--mineral-bright);
  border: 1px solid var(--graphite);
  box-shadow: 6px 8px 18px rgba(16, 22, 19, 0.2);
}

.map-toolbar button {
  min-height: 44px;
  padding: 8px 11px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--graphite);
  font-size: 0.68rem;
  font-weight: 650;
}

.map-toolbar button:last-child {
  border-right: 0;
}

.map-toolbar button:not(:disabled):hover,
.map-toolbar button[aria-pressed="true"] {
  background: var(--graphite);
  color: var(--mineral-bright);
}

.draw-instruction {
  position: absolute;
  z-index: 430;
  top: 70px;
  left: 58px;
  max-width: 300px;
  padding: 10px 12px;
  background: var(--orange);
  color: var(--graphite);
  box-shadow: 6px 8px 18px rgba(16, 22, 19, 0.2);
}

.draw-instruction b,
.draw-instruction span {
  display: block;
}

.draw-instruction b {
  font-size: 0.74rem;
}

.draw-instruction span {
  margin-top: 2px;
  font-size: 0.66rem;
  line-height: 1.4;
}

.map-readout {
  position: absolute;
  z-index: 420;
  left: 16px;
  bottom: 28px;
  max-width: min(410px, calc(100% - 32px));
  padding: 10px 13px;
  background: var(--graphite);
  color: var(--mineral-bright);
  box-shadow: 6px 8px 18px rgba(16, 22, 19, 0.24);
}

.map-readout span,
.map-readout b {
  display: block;
}

.map-readout span {
  color: var(--datum-light);
}

.map-readout b {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.map-attribution-note {
  position: absolute;
  z-index: 410;
  right: 6px;
  bottom: 20px;
  max-width: 260px;
  padding: 3px 5px;
  background: rgba(248, 249, 245, 0.9);
  color: var(--graphite-soft);
  text-align: right;
  font-size: 0.48rem;
}

.map-panel.is-drawing #map {
  cursor: crosshair;
}

.map-fallback {
  position: absolute;
  inset: 20px;
  z-index: 500;
  padding: 20px;
  background: var(--mineral-bright);
  color: var(--graphite);
  border: 1px solid var(--graphite);
  box-shadow: 6px 8px 18px rgba(16, 22, 19, 0.2);
}

.map-fallback b {
  display: block;
  font-family: "Saira Semi Condensed", "Arial Narrow", sans-serif;
  font-size: 1.55rem;
  line-height: 1;
}

.map-fallback p {
  max-width: 42ch;
  margin: 10px 0 0;
  color: var(--graphite-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.dossier-panel {
  position: relative;
  z-index: 500;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: var(--graphite);
  color: var(--mineral-bright);
  border-left: 1px solid var(--graphite);
}

.dossier-scroll {
  padding: 24px 25px 36px;
}

.dossier-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-inverse);
}

.dossier-heading h2 {
  font-size: 1.65rem;
  line-height: 1;
}

.dossier-heading p {
  margin: 6px 0 0;
  color: var(--muted-inverse);
  font-size: 0.7rem;
}

.result-state {
  padding: 5px 7px;
  border: 1px solid var(--line-inverse);
  color: var(--muted-inverse);
  white-space: nowrap;
}

.result-state[data-result-state="ready"] {
  border-color: var(--orange);
  color: var(--orange);
}

.result-state[data-result-state="loading"] {
  border-color: var(--datum-light);
  color: var(--datum-light);
}

.result-state[data-result-state="error"] {
  border-color: var(--danger);
  color: var(--danger);
}

.dossier-empty,
.dossier-loading,
.dossier-error {
  min-height: calc(100% - 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 34px 5px;
}

.dossier-empty svg {
  width: min(250px, 80%);
  height: auto;
  margin: 0 auto 28px;
  fill: rgba(169, 197, 255, 0.07);
  stroke: var(--orange);
  stroke-width: 2;
}

.dossier-empty svg circle {
  fill: var(--graphite);
  stroke: var(--orange);
}

.dossier-empty svg .water-line {
  fill: none;
  stroke: var(--datum-light);
  stroke-width: 1.5;
}

.dossier-empty h3,
.dossier-loading h3 {
  max-width: 13ch;
  font-size: 2.05rem;
  line-height: 0.98;
}

.dossier-empty p,
.dossier-loading p,
.dossier-error p {
  max-width: 42ch;
  margin: 13px 0 0;
  color: var(--muted-inverse);
  font-size: 0.81rem;
  line-height: 1.55;
}

.loading-track {
  position: relative;
  width: 100%;
  height: 2px;
  margin-bottom: 29px;
  overflow: hidden;
  background: var(--line-inverse);
}

.loading-track i {
  position: absolute;
  top: 0;
  left: 0;
  width: 34%;
  height: 100%;
  background: var(--orange);
  animation: loading-scan 1.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes loading-scan {
  from { transform: translateX(-110%); }
  to { transform: translateX(310%); }
}

.dossier-error {
  color: var(--danger);
}

.dossier-error b {
  font-family: "Saira Semi Condensed", "Arial Narrow", sans-serif;
  font-size: 1.45rem;
}

.dossier-error .text-action {
  border-color: var(--danger);
  color: var(--mineral-bright);
}

.result-summary {
  padding: 27px 0 29px;
  border-bottom: 1px solid var(--line-inverse);
}

.result-summary h3,
.study-section h3,
.evidence-section h3 {
  font-size: 1.5rem;
  line-height: 1;
}

.result-summary > p,
.study-section header p {
  margin: 11px 0 0;
  color: var(--muted-inverse);
  font-size: 0.75rem;
  line-height: 1.5;
}

.metric-ledger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 24px 0 0;
  border-top: 1px solid var(--line-inverse);
  border-left: 1px solid var(--line-inverse);
}

.metric-ledger div {
  min-width: 0;
  padding: 13px 12px;
  border-right: 1px solid var(--line-inverse);
  border-bottom: 1px solid var(--line-inverse);
}

.metric-ledger dt {
  color: var(--muted-inverse);
  font-size: 0.62rem;
}

.metric-ledger dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--mineral-bright);
}

.result-identity {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  margin-top: 18px;
}

.result-identity span {
  color: var(--datum-light);
}

.result-identity b {
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.66rem;
  overflow-wrap: anywhere;
}

.study-section,
.evidence-section {
  padding: 30px 0;
  border-bottom: 1px solid var(--line-inverse);
}

.study-list,
.other-studies > div {
  margin-top: 20px;
}

.study-record {
  border-top: 1px solid var(--line-inverse);
}

.study-record:last-child {
  border-bottom: 1px solid var(--line-inverse);
}

.study-record summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
}

.study-record summary::-webkit-details-marker {
  display: none;
}

.study-record summary::after {
  content: "+";
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--orange);
  font-size: 1.25rem;
}

.study-record[open] summary::after {
  content: "−";
}

.study-summary-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.study-summary-main b {
  font-family: "Saira Semi Condensed", "Arial Narrow", sans-serif;
  font-size: 1.05rem;
  line-height: 1.06;
}

.study-summary-state {
  justify-self: end;
  padding: 4px 6px;
  border: 1px solid var(--line-inverse);
  color: var(--muted-inverse);
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.study-summary-state[data-study-state="disponible"] {
  border-color: var(--datum-light);
  color: var(--datum-light);
}

.study-summary-state[data-study-state="fuentes_pendientes"] {
  border-color: var(--orange);
  color: var(--orange);
}

.study-record-content {
  padding: 3px 0 22px;
}

.study-question {
  margin: 0;
  color: var(--mineral-bright);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.45;
}

.study-description,
.study-scope {
  margin: 8px 0 0;
  color: var(--muted-inverse);
  font-size: 0.72rem;
  line-height: 1.5;
}

.study-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 18px;
}

.study-detail-grid h4,
.study-block h4 {
  margin: 0 0 7px;
  color: var(--datum-light);
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.study-detail-grid ul,
.study-block ul,
.evidence-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-detail-grid li,
.study-block li,
.evidence-section li {
  position: relative;
  padding: 5px 0 5px 12px;
  color: var(--muted-inverse);
  font-size: 0.68rem;
  line-height: 1.45;
}

.study-detail-grid li::before,
.study-block li::before,
.evidence-section li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 4px;
  height: 4px;
  background: var(--orange);
}

.study-block {
  margin-top: 18px;
}

.layer-ledger {
  border-top: 1px solid var(--line-inverse);
}

.layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6.5rem, 9rem);
  column-gap: 16px;
  row-gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-inverse);
}

.layer-identity {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.layer-identity b,
.layer-identity > a {
  font-size: 0.67rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.layer-identity > a {
  color: var(--datum-light);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.layer-identity > small {
  color: var(--muted-inverse);
  font-size: 0.61rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trace-facts {
  display: grid;
  gap: 7px 12px;
  margin: 8px 0 0;
}

.layer-trace-facts,
.foundation-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trace-fact {
  min-width: 0;
}

.trace-fact-wide {
  grid-column: 1 / -1;
}

.trace-fact dt {
  color: var(--muted-inverse);
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.52rem;
  letter-spacing: 0.035em;
  line-height: 1.3;
  text-transform: uppercase;
}

.trace-fact dd {
  margin: 2px 0 0;
  color: var(--mineral-bright);
  font-size: 0.62rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.layer-status-stack {
  align-self: start;
  display: grid;
  gap: 5px;
  justify-items: end;
  min-width: 0;
}

.layer-operational-state,
.trace-state,
.emission-state {
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.55rem;
  line-height: 1.35;
  color: var(--muted-inverse);
  text-align: right;
  overflow-wrap: anywhere;
}

.layer-operational-state[data-layer-state="validada"],
.layer-operational-state[data-layer-state="validada_con_reparaciones"],
.trace-state[data-trace-state="completa"],
.emission-state[data-emission-ready="true"] {
  color: var(--datum-light);
}

.layer-operational-state[data-layer-state="pendiente_descarga"],
.layer-operational-state[data-layer-state="descargada"],
.layer-operational-state[data-layer-state="rechazada"],
.layer-operational-state[data-layer-state="no_registrada"],
.trace-state[data-trace-state="incompleta"],
.emission-state[data-emission-ready="false"] {
  color: var(--orange);
}

.trace-state::before,
.emission-state::before,
.verification-state strong::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-inline-end: 5px;
  background: currentColor;
  vertical-align: 0.12em;
}

.trace-note {
  grid-column: 1 / -1;
  max-width: 70ch;
  margin: 0;
  color: var(--orange);
  font-size: 0.62rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.foundation-list > ul {
  border-top: 1px solid var(--line-inverse);
}

.foundation-list .foundation-record {
  padding: 11px 0;
  border-bottom: 1px solid var(--line-inverse);
}

.foundation-list .foundation-record::before {
  display: none;
}

.foundation-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.foundation-heading > a,
.foundation-heading > b {
  min-width: 0;
  color: var(--datum-light);
  font-size: 0.68rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.foundation-kind {
  max-width: 11rem;
  color: var(--muted-inverse);
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.53rem;
  line-height: 1.35;
  text-align: right;
  overflow-wrap: anywhere;
}

.verification-state {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin: 9px 0 0;
  color: var(--muted-inverse);
  line-height: 1.4;
}

.verification-state strong {
  color: var(--datum-light);
  font-family: "Sometype Mono", Consolas, monospace;
  font-size: 0.58rem;
  font-weight: 600;
}

.verification-state span {
  font-size: 0.61rem;
  overflow-wrap: anywhere;
}

.verification-state[data-verification-state="pendiente"] strong {
  color: var(--orange);
}

.verification-note {
  max-width: 70ch;
  margin: 7px 0 0;
  color: var(--muted-inverse);
  font-size: 0.63rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.verification-note[data-verification-pending="true"] {
  color: var(--mineral-bright);
}

.foundation-list a {
  color: var(--datum-light);
  text-underline-offset: 3px;
}

.foundation-secondary-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.61rem;
  line-height: 1.4;
}

.other-studies {
  margin-top: 18px;
}

.other-studies > summary {
  color: var(--muted-inverse);
}

.evidence-section > h3 {
  margin-bottom: 17px;
}

.empty-evidence {
  padding: 14px 0;
  border-top: 1px solid var(--line-inverse);
  color: var(--muted-inverse);
  font-size: 0.71rem;
  line-height: 1.5;
}

.finding-row,
.source-row {
  padding: 11px 0;
  border-top: 1px solid var(--line-inverse);
}

.finding-row:last-child,
.source-row:last-child {
  border-bottom: 1px solid var(--line-inverse);
}

.finding-row b,
.source-row b {
  display: block;
  font-size: 0.72rem;
}

.finding-row span,
.source-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted-inverse);
  font-size: 0.64rem;
  line-height: 1.45;
}

.evidence-section details {
  border-top: 1px solid var(--line-inverse);
}

.evidence-section details:last-child {
  border-bottom: 1px solid var(--line-inverse);
}

.evidence-section summary {
  color: var(--mineral-bright);
}

.download-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 25px;
}

.download-actions button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-inverse);
  background: transparent;
  color: var(--mineral-bright);
  font-size: 0.68rem;
  font-weight: 650;
  text-align: left;
}

.download-actions button:first-child {
  border-color: var(--orange);
}

.download-actions span {
  color: var(--orange);
}

.dossier-footer {
  background: var(--graphite-lift);
  border-color: var(--line-inverse);
}

.dossier-footer span {
  color: var(--orange);
}

.dossier-footer b {
  color: var(--mineral-bright);
  font-size: 0.66rem;
  line-height: 1.35;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1320px) {
  :root {
    --left-width: 300px;
    --right-width: 390px;
  }

  .query-scroll {
    padding-inline: 20px;
  }

  .dossier-scroll {
    padding-inline: 21px;
  }

  .app-title b {
    display: none;
  }

  .map-toolbar button {
    padding-inline: 9px;
  }
}

@media (max-width: 1040px) {
  :root {
    --header-height: 58px;
  }

  body {
    overflow: auto;
  }

  .app-header {
    position: sticky;
    top: 0;
    grid-template-columns: auto 1fr auto;
  }

  .app-brand {
    padding-inline: 15px;
  }

  .app-title {
    padding-inline: 14px;
  }

  .engine-state {
    padding-inline: 14px;
  }

  .header-exit {
    display: none;
  }

  .mobile-workflow {
    position: sticky;
    z-index: 900;
    top: var(--header-height);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 47px;
    background: var(--mineral-bright);
    border-bottom: 1px solid var(--graphite);
  }

  .mobile-workflow button {
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--graphite);
    font-size: 0.72rem;
    font-weight: 650;
  }

  .mobile-workflow button:last-child {
    border-right: 0;
  }

  .mobile-workflow button[aria-pressed="true"] {
    background: var(--graphite);
    color: var(--mineral-bright);
  }

  .workbench {
    height: calc(100dvh - var(--header-height) - 47px);
    display: block;
    overflow: hidden;
  }

  .query-panel,
  .map-panel,
  .dossier-panel {
    width: 100%;
    height: 100%;
    border: 0;
  }

  body[data-mobile-view="definir"] .map-panel,
  body[data-mobile-view="definir"] .dossier-panel,
  body[data-mobile-view="mapa"] .query-panel,
  body[data-mobile-view="mapa"] .dossier-panel,
  body[data-mobile-view="resultado"] .query-panel,
  body[data-mobile-view="resultado"] .map-panel {
    display: none;
  }

  .query-panel,
  .dossier-panel {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .query-heading h1 {
    max-width: 13ch;
    font-size: 3rem;
  }

  .objective-list {
    max-width: 640px;
  }

  .polygon-inputs,
  .polygon-state,
  .action-analyze,
  .privacy-copy {
    max-width: 640px;
  }

  .dossier-empty,
  .dossier-loading,
  .dossier-error,
  .dossier-result {
    max-width: 760px;
    margin-inline: auto;
  }
}

@media (max-width: 620px) {
  .app-brand span {
    display: none;
  }

  .app-brand svg {
    width: 26px;
  }

  .app-title {
    padding-left: 10px;
  }

  .app-title span {
    font-size: 0.57rem;
  }

  .engine-state {
    min-width: 0;
    max-width: 132px;
    padding-inline: 8px;
    gap: 6px;
    line-height: 1.1;
    white-space: normal;
  }

  .engine-state span {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
  }

  .query-scroll,
  .dossier-scroll {
    padding: 22px 17px 30px;
  }

  .query-heading h1 {
    font-size: 2.65rem;
  }

  .map-toolbar {
    top: 10px;
    right: 10px;
    left: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
  }

  .map-toolbar button {
    min-width: 0;
    padding: 8px 5px;
    font-size: 0.57rem;
  }

  .draw-instruction {
    top: 60px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .map-readout {
    right: 10px;
    bottom: 34px;
    left: 10px;
    max-width: none;
  }

  .map-attribution-note {
    right: 5px;
    bottom: 17px;
    max-width: 210px;
  }

  .dossier-heading {
    display: grid;
  }

  .result-state {
    justify-self: start;
  }

  .metric-ledger,
  .study-detail-grid,
  .download-actions {
    grid-template-columns: 1fr;
  }

  .study-record summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .study-summary-state {
    justify-self: start;
  }

  .layer-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .layer-status-stack {
    justify-items: start;
  }

  .layer-operational-state,
  .trace-state,
  .emission-state {
    text-align: left;
  }

  .foundation-heading {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .foundation-kind {
    max-width: none;
    text-align: left;
  }

  .coverage-strip,
  .dossier-footer {
    padding-inline: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
