:root {
  color-scheme: light dark;
  --bg: #f4f5f0;
  --surface: #fff;
  --ink: #1c3029;
  --muted: #66746d;
  --line: #dbe2da;
  --brand: #215b42;
  --soft: #e5eddf;
  --red: #b23c37;
  --red-bg: #fbe9e5;
  --yellow: #866019;
  --yellow-bg: #fff4d5;
  --green: #2a6744;
  --green-bg: #e5f3e4;
  --shadow: 0 8px 30px #23372b06;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    15px/1.55 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 12px;
  min-height: 46px;
  cursor: pointer;
  font-weight: 550;
}
button:hover {
  border-color: var(--brand);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button.danger {
  color: var(--red);
}
a {
  color: var(--brand);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -1.3px;
  font-weight: 650;
}
h2 {
  font-size: 21px;
  letter-spacing: -0.45px;
}
h3 {
  font-size: 16px;
}
p + p {
  margin-top: 10px;
}
small,
.muted {
  color: var(--muted);
}
.app-header {
  max-width: 1080px;
  margin: auto;
  padding: 25px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  font-size: 23px;
  letter-spacing: -0.6px;
  font-weight: 750;
}
.brand-sub {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--muted);
}
.brand-mark {
  display: grid;
  gap: 3px;
  padding: 7px 9px;
  border-radius: 10px;
  background: #142921;
}
.brand-mark i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dc776b;
}
.brand-mark i:nth-child(2) {
  background: #e4c45d;
}
.brand-mark i:nth-child(3) {
  background: #89bc81;
}
.connection {
  font-size: 12px;
  background: transparent;
}
.connection::before {
  content: "●";
  color: var(--brand);
  margin-right: 7px;
}
main {
  max-width: 1080px;
  margin: auto;
  padding: 20px 28px 120px;
  outline: none;
}
.heading {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 24px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 9px;
}
.heading p {
  color: var(--muted);
  margin-top: 10px;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.hero {
  padding: 24px 28px;
  background: var(--soft);
  border-radius: 18px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  gap: 30px;
}
.hero p {
  color: var(--muted);
  max-width: 560px;
  margin-top: 8px;
}
.hero summary {
  cursor: pointer;
  font-weight: 650;
}
.hero[open] summary {
  margin-bottom: 10px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 24px;
}
.stat {
  border-left: 2px solid var(--line);
  padding: 8px 16px;
}
.stat strong {
  font-size: 28px;
  font-weight: 650;
  display: block;
  line-height: 1.2;
}
.stat span {
  font-size: 12px;
  color: var(--muted);
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar input {
  flex: 1;
  min-width: 190px;
}
.toolbar select {
  width: auto;
  max-width: 220px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.card h2 {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.card small {
  display: block;
  margin-top: 4px;
}
.card .actions {
  margin-top: auto;
}
.card .actions button:first-child {
  flex: 1;
}
.badge {
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand);
  white-space: nowrap;
}
.badge.revisar {
  background: var(--yellow-bg);
  color: var(--yellow);
}
.progress {
  display: flex;
  gap: 5px;
}
.progress span {
  width: 30px;
  height: 4px;
  border-radius: 3px;
  background: var(--line);
}
.progress .done {
  background: var(--brand);
}
.empty {
  padding: 45px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  grid-column: 1/-1;
}
.empty h2 {
  color: var(--ink);
  margin-bottom: 10px;
}
.empty button {
  margin-top: 20px;
}
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 1000;
}
.bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-width: 130px;
  font-size: 20px;
}
.bottom-nav button span {
  font-size: 12px;
  margin-left: 7px;
}
.bottom-nav button[aria-current="page"] {
  background: var(--soft);
  color: var(--brand);
}
input,
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  min-height: 46px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 6px;
}
label input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  vertical-align: middle;
  margin-right: 7px;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
.field {
  margin-bottom: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.stack {
  display: grid;
  gap: 18px;
}
.back {
  background: none;
  border: 0;
  padding-left: 0;
  color: var(--muted);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}
.live {
  text-align: center;
  padding: 32px;
}
.live .counter {
  font-size: 56px;
  letter-spacing: -3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.live small {
  display: block;
  margin-top: 12px;
}
.lights {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px auto 24px;
  background: #142921;
  padding: 15px 20px;
  width: max-content;
  border-radius: 40px;
}
.light {
  width: 26px;
  height: 26px;
  background: #3b4940;
  border-radius: 50%;
}
.light.on.rojo {
  background: #ee7c6c;
}
.light.on.amarillo {
  background: #edc05b;
}
.light.on.verde {
  background: #83bf82;
}
.phase-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 85px;
  font-size: 23px;
  border-radius: 16px;
  margin-bottom: 10px;
  padding: 18px 24px;
}
.phase-button::before {
  content: "●";
  margin-right: 10px;
}
.phase-button.rojo {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red);
}
.phase-button.amarillo {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: var(--yellow);
}
.phase-button.verde {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green);
}
.phase-button.intermitente {
  font-size: 17px;
  height: 55px;
}
.capture {
  max-width: 560px;
  margin: auto;
}
.capture-clock {
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.capture .mode {
  background: var(--soft);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 20px;
}
.notice {
  padding: 13px 16px;
  background: var(--yellow-bg);
  color: var(--yellow);
  border-radius: 10px;
  font-size: 13px;
}
.history-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.history-row:last-child {
  border: 0;
}
.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
}
.swatch.rojo {
  background: var(--red);
}
.swatch.verde {
  background: var(--green);
}
.swatch.amarillo,
.swatch.intermitente {
  background: var(--yellow);
}
details > summary {
  cursor: pointer;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  padding: 10px 6px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.table-scroll {
  overflow: auto;
}
#map {
  height: 58vh;
  min-height: 330px;
  border-radius: 16px;
  background: var(--soft);
}
.map-legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin: 12px 0;
  font-size: 12px;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 550px);
  background: var(--ink);
  color: var(--surface);
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: 0 10px 40px #0003;
  z-index: 3000;
}
#demo-banner {
  padding: 10px 24px;
  background: var(--yellow-bg);
  color: var(--yellow);
  text-align: center;
  font-size: 13px;
}
#demo-banner button {
  background: transparent;
  min-height: 32px;
  padding: 3px 10px;
  color: inherit;
  border-color: currentColor;
}
.skip {
  position: fixed;
  top: -80px;
  left: 10px;
  z-index: 9999;
  background: var(--surface);
  padding: 10px;
}
.skip:focus {
  top: 10px;
}
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 4px;
}
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--ink);
}
.leaflet-popup-content button {
  margin-top: 10px;
}
[hidden] {
  display: none !important;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121b17;
    --surface: #1c2821;
    --ink: #e6ece3;
    --muted: #a0afa3;
    --line: #34473a;
    --brand: #98c69f;
    --soft: #273b2b;
    --red: #efaa9b;
    --red-bg: #3c2723;
    --yellow: #e1c77d;
    --yellow-bg: #38331f;
    --green: #a3c99b;
    --green-bg: #273e2c;
  }
  button.primary {
    background: #386344;
    border-color: #386344;
  }
  .brand-mark {
    background: #293b2e;
  }
}
@media (max-width: 650px) {
  .app-header {
    padding: 18px 16px;
  }
  .brand {
    font-size: 21px;
  }
  .brand-sub {
    font-size: 7px;
  }
  main {
    padding: 12px 16px 115px;
  }
  .heading {
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }
  .heading h1 {
    font-size: 30px;
  }
  .hero {
    padding: 20px;
  }
  .grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .stats {
    gap: 0;
  }
  .stat {
    padding: 6px 12px;
  }
  .stat strong {
    font-size: 24px;
  }
  .card,
  .panel {
    padding: 18px;
  }
  .bottom-nav {
    gap: 0;
    padding: 8px 5px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-nav button {
    min-width: 0;
    flex: 1;
    padding: 5px 2px;
  }
  .bottom-nav button span {
    display: block;
    margin: 0;
    font-size: 10px;
  }
  .toolbar select {
    flex: 1;
    max-width: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .connection {
    max-width: 150px;
    font-size: 11px;
    padding: 8px;
  }
  .capture .heading h1 {
    font-size: 25px;
  }
  .capture-clock {
    font-size: 25px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

main:focus-visible {
  outline: none;
}
details.hero {
  display: block;
}
