/* The platform. "Ría azul" (navy ink, ocean-blue accent, sand), Inter and IBM Plex Mono, as
   the landing and the bulletin (web/assets/bulletin.css): one product. Red is for risk only. */
:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --page: #f7f5f0; --card: #ffffff; --sand: #f4f1ea; --ink: #0d1f2d; --ink-2: #3a4b57;
  --muted: #5b6b75; --line: #e3e6e8; --line-2: #8f9ca4; --link: #1b5e8c; --mine: #1b5e8c;
  --tint: #eaf1f6;
  --open-bg: #e2efe9; --open-ink: #1d5a47; --closed-bg: #0d1f2d; --closed-ink: #ffffff;
  --r0: #eceae4; --r0-ink: #3b474c; --r1: #fad4ca; --r1-ink: #1b2328;
  --r2: #ef9179; --r2-ink: #1b2328; --r3: #ce4928; --r3-ink: #ffffff;
  --r4: #902201; --r4-ink: #ffffff;
  --top: 64px; --content: 1240px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100dvh;
  display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
p a, li a { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, .h2 { line-height: 1.15; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.viewas, .muted { overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 1.4rem + 1.8vw, 2.75rem); font-weight: 400; letter-spacing: -0.035em;
  line-height: 1.08; }
h2, .h2 { font-size: 1.125rem; font-weight: 500; letter-spacing: -0.015em; color: var(--ink); }
h3 { font-size: 1rem; font-weight: 500; margin-top: 8px; }
p { margin: 0; }
.small { font-size: 0.85rem; color: var(--muted); }
.muted { color: var(--ink-2); }
.kicker { font: 400 0.75rem/1.5 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); }
.lead { font-size: 1.125rem; font-weight: 400; line-height: 1.5; color: var(--ink); max-width: 60rem; }
.error { background: #fde8e4; color: #8a1c0a; padding: 10px 12px; border-radius: 10px; }
.notice { background: var(--sand); border: 1px solid var(--line); border-left: 3px solid var(--link);
  padding: 14px 16px; border-radius: 10px; display: grid; gap: 4px; color: var(--ink-2); }
code { font: 500 1rem var(--mono); background: #fff; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--line); }
table, .kv dd, .lvl, .hcell .v { font-variant-numeric: tabular-nums; }

/* Top bar: same height, mark and spacing as the landing */
.top { height: var(--top); display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 24px; background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000; backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: 1.0625rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; color: var(--ink); }
.brand span { font-weight: 400; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); }
.top nav { display: flex; gap: 24px; align-items: center; font-size: 0.9375rem; overflow-x: auto; }
.top nav a { color: var(--muted); white-space: nowrap; }
.top nav a:hover { color: var(--ink); text-decoration: none; }
.top nav a[aria-current=page] { color: var(--ink); font-weight: 500; }
.top nav form { margin: 0; padding-left: 16px; border-left: 1px solid var(--line); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linklike:hover { color: var(--ink); }
.viewas { background: var(--tint); color: var(--ink); border-bottom: 1px solid #cfdde8; padding: 8px 24px;
  font-size: 0.9rem; }
.foot { margin-top: auto; padding: 20px 24px; font-size: 0.8rem; color: var(--muted); display: grid; gap: 4px;
  border-top: 1px solid var(--line); }
.foot p { max-width: var(--content); width: 100%; margin: 0 auto; }

/* Forms, buttons and cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  display: grid; gap: 12px; align-content: start; box-shadow: 0 1px 2px rgba(13, 31, 45, 0.04); }
.narrow .auth { width: min(420px, 100% - 32px); margin: 72px auto 48px; }
.auth h1 { font-size: 1.75rem; }
.auth .brandmark { width: 28px; height: 28px; color: var(--ink); }
.auth h2 { margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.stack { display: grid; gap: 14px; }
.stack > button, .stack > .button { justify-self: start; }
.auth .stack > button { justify-self: stretch; }
label { display: grid; gap: 6px; font-size: 0.875rem; font-weight: 500; color: var(--ink-2); }
input[type=email], input[type=password], input[type=text], input[type=search], select {
  font: inherit; font-weight: 400; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: var(--link); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background: #fff
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6b75' stroke-width='1.5' fill='none'/%3E%3C/svg%3E")
  no-repeat right 14px center / 10px; }
input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
button, .button { font: inherit; font-weight: 500; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer;
  display: inline-block; line-height: 1.3; transition: background .15s, border-color .15s; }
button:hover, .button:hover { border-color: #b3bec3; text-decoration: none; }
button.primary, .button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--link); border-color: var(--link); }
button.danger { color: #8a1c0a; border-color: #ecc3b8; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
details.card > summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: 1fr auto;
  gap: 4px 16px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ""; width: 8px; height: 8px; grid-row: 1 / 3; grid-column: 2;
  align-self: center; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s; }
details[open].card > summary::after { transform: rotate(225deg); }
.picker { display: block; columns: 4 210px; column-gap: 12px; }
.picker fieldset { break-inside: avoid; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin: 0 0 12px; display: grid; gap: 6px; }
.picker legend { font-weight: 500; font-size: 0.875rem; padding: 0 4px; color: var(--ink); }
ul.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 0.92rem; }
label.chk { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 400; }

/* Pills, tags, levels */
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.75rem;
  font-weight: 600; letter-spacing: 0.005em; white-space: nowrap; }
.pill.open { background: var(--open-bg); color: var(--open-ink); }
.pill.closed { background: var(--closed-bg); color: var(--closed-ink); }
.pill.unknown { background: var(--line); color: var(--ink-2); }
.pill.partial { background: #fbe9c9; color: #6a4300; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px;
  font: 500 0.75rem/1.65 var(--mono); color: var(--ink-2); background: #fff; }
.tag.mine { background: var(--tint); border-color: transparent; color: var(--link);
  font: 600 0.75rem/1.6 var(--font); }
.levels { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; }
.lvl { display: inline-flex; gap: 5px; align-items: center; border-radius: 999px;
  padding: 1px 8px 1px 2px; background: var(--page); color: var(--ink-2); }
.lvl i { font-style: normal; border-radius: 999px; padding: 0 7px; font-weight: 600; }
.r0 { background-color: var(--r0); color: var(--r0-ink); }
.r1 { background-color: var(--r1); color: var(--r1-ink); }
.r2 { background-color: var(--r2); color: var(--r2-ink); }
.r3 { background-color: var(--r3); color: var(--r3-ink); }
.r4 { background-color: var(--r4); color: var(--r4-ink); }
.na { background-color: var(--line); color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.8rem; color: var(--ink-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.sw { width: 16px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid #9aa6aa; }

/* Dashboard: an intro band, a sticky toolbar, then one card per ría (satellite map + table) */
.wide { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.stack-lg { display: grid; gap: 20px; padding-top: 22px; padding-bottom: 40px; }
.band { background: var(--card); border-bottom: 1px solid var(--line); }
.intro { display: grid; gap: 10px; padding-top: 28px; padding-bottom: 24px; max-width: 1240px; }
.intro h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); letter-spacing: -0.035em; }
.intro .lead { max-width: 62rem; }
.note { color: var(--ink-2); max-width: 46rem; }
.meta { font-size: 0.875rem; color: var(--muted); }
.system { display: grid; gap: 4px; padding: 12px 14px; background: var(--sand); border-radius: 10px;
  border: 1px solid var(--line); max-width: 62rem; }
.mine-summary { display: grid; gap: 10px; max-width: 62rem; }
.mine-sentence { font-size: 1.125rem; }
.mine-table { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.mine-table td.p { min-width: 3.4rem; }
a.quiet { color: var(--ink-2); }
.seg-group { display: inline-flex; align-items: center; gap: 8px; }
#modes-wrap { gap: 16px; }
.toolbar { position: sticky; top: var(--top); z-index: 900; background: rgba(247, 245, 240, 0.92);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line); }
.toolbar-in { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; padding-top: 10px;
  padding-bottom: 10px; }
.tool { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool-end { margin-left: auto; }
.tool-label { font: 400 0.75rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); }
.tool input[type=search] { width: 13rem; padding: 7px 10px; font-size: 0.9rem; }
.tool select { width: auto; max-width: 15rem; padding: 7px 10px; font-size: 0.9rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: #ece9e1;
  border-radius: 10px; }
.seg button { padding: 5px 11px; border-radius: 8px; border: 0; background: transparent;
  font-size: 0.88rem; font-weight: 500; color: var(--ink-2); display: inline-flex; gap: 5px;
  align-items: baseline; }
.seg button small { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
.seg button[aria-pressed=true] small { color: #d6dcde; }
.legend .key { width: 16px; height: 10px; border-radius: 3px; border: 2.5px solid; display: inline-block;
  background: transparent; box-shadow: 0 0 0 1px rgba(13, 31, 45, 0.15); }
.legend .key.solid { background: #0d1f2d; }
.legend .key.mine { border-width: 3px; }
.ghost { justify-self: start; background: transparent; border: 1px dashed #b9c4c7; color: var(--ink-2); }

.rias { display: grid; gap: 20px; }
.ria { padding: 0; overflow: hidden; gap: 0; }
.ria-head { display: grid; gap: 6px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.ria-title { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.ria-title h2 { font-size: 1.25rem; }
.ria-sentence { color: var(--ink-2); }
.ria-body { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.ria-map { min-height: 400px; height: 100%; background: #233544; }
.ria-body .table-wrap { max-height: 520px; overflow: auto; border-left: 1px solid var(--line); }
.ptable { font-size: 0.88rem; }
.ptable thead th { position: sticky; top: 0; background: var(--card); z-index: 1; padding-top: 10px; }
.ptable th small { display: block; font-weight: 400; color: var(--muted); }
.ptable tr.group th { padding-top: 10px; padding-bottom: 0; border-bottom: 0; font-size: 0.7rem;
  font-weight: 500; letter-spacing: 0.02em; color: var(--muted); }
.ptable thead tr.group + tr th { padding-top: 2px; }
.ptable thead tr.group th { position: static; }
.ptable th.late, .ptable td.late { color: var(--muted); font-weight: 400; white-space: nowrap;
  text-align: center; }
.ptable td, .ptable th { padding: 7px 10px; }
.ptable td.name { font-weight: 600; white-space: nowrap; }
.ptable td.name a { color: var(--ink); text-decoration: none; }
.ptable td.name a:hover { color: var(--link); text-decoration: underline; }
.ptable td.name .tag { margin-left: 6px; }
.ptable td.st { white-space: nowrap; }
.ptable td.st .tag { margin-left: 4px; }
.ptable td.p { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums;
  border: 2px solid var(--card); border-radius: 6px; min-width: 3.2rem; }
.ptable td.p.na { background: transparent; color: var(--muted); font-weight: 400; }
.ptable tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--mine); }
.ptable tbody tr:hover td.name, .ptable tbody tr:hover td.st { background: #f3f6f8; }
.rias[data-mode="7"] th.c7, .rias[data-mode="14"] th.c14, .rias[data-mode="21"] th.c21,
.rias[data-mode="28"] th.c28 { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.clist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }

/* Leaflet */
.leaflet-container { font-family: var(--font); }
.tiles-names { opacity: 0.9; }
.leaflet-control-layers, .leaflet-bar { border: 0 !important; box-shadow: 0 1px 4px rgba(13, 31, 45, 0.3) !important;
  border-radius: 8px !important; }
.leaflet-control-attribution { font-size: 0.75rem; }
.maptip { font-family: var(--font); font-size: 0.82rem; line-height: 1.45; border-radius: 8px;
  border: 0; box-shadow: 0 4px 14px rgba(13, 31, 45, 0.25); padding: 6px 10px; }
.maptip span { color: var(--muted); }

@media (max-width: 560px) {
  .brand span, .wide-only { display: none; }
  .top { position: static; height: auto; flex-wrap: wrap; padding: 10px 14px; row-gap: 2px; }
  .top nav { overflow: visible; flex-wrap: wrap; width: 100%; gap: 0 18px; }
  .top nav form { padding-left: 12px; }
  .toolbar { position: static; }
  .ptable td.name { position: sticky; left: 0; background: var(--card); z-index: 1; }
  .wide { padding: 0 14px; }
  .tool-end { margin-left: 0; width: 100%; }
  .tool input[type=search], .tool select { flex: 1; min-width: 0; }
}
@media (max-width: 900px) {
  .ria-body { grid-template-columns: 1fr; }
  .ria-map { min-height: 280px; height: 280px; order: 2; }
  .ria-body .table-wrap { border-left: 0; border-bottom: 1px solid var(--line); max-height: none; order: 1; }
  .ptable th.late, .ptable td.late { display: none; }
  .ptable td.p { min-width: 2.6rem; }
  .ptable td, .ptable th { padding: 6px 6px; }
}

/* Polygon page */
.page { max-width: var(--content); margin: 0 auto; padding: 24px 20px 48px; display: grid; gap: 18px; }
.page > .muted { max-width: 62ch; }
.crumbs { font-size: 0.9rem; }
.crumbs a { color: var(--muted); }
.phead { display: grid; gap: 4px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-map { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.side-stack { display: grid; gap: 16px; align-content: start; }
.map-card { padding: 0; overflow: hidden; }
.pmap { min-height: 420px; height: 100%; background: #233544; }
.pad { padding: 16px; color: #dfe6ea; }
@media (max-width: 900px) {
  .grid-map { grid-template-columns: 1fr; }
  .pmap { height: 320px; min-height: 320px; }
}
.big { display: flex; gap: 8px; align-items: center; font-size: 1.1rem; }
.big .pill { font-size: 1rem; padding: 3px 12px; }
.kv { display: grid; gap: 8px; margin: 0; font-size: 0.92rem; }
.kv div { display: flex; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.kv div:last-child { border: 0; padding-bottom: 0; }
.kv dt { color: var(--muted); min-width: 8rem; }
.kv dd { margin: 0; }
.hcells { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.later { color: var(--muted); }
.explain { font-size: 0.92rem; color: var(--ink-2); padding: 10px 12px; background: var(--sand);
  border-radius: 10px; }
.since { font-size: 0.95rem; color: var(--ink-2); }
.hcell { border-radius: 10px; padding: 12px 8px; display: grid; gap: 2px; text-align: center; }
.hcell .d { font-size: 0.8rem; }
.hcell .v { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
.hcell .w { font-size: 0.8rem; font-weight: 500; }
.hcell small { font-size: 0.75rem; }
.why { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 0.92rem; }
.cal { overflow-x: auto; }
.cal svg { width: 100%; height: auto; min-width: 640px; }
.cal rect.o { fill: #e2efe9; }
.cal rect.c { fill: var(--ink); }
.cal-m, .axis { font: 500 10px var(--font); fill: var(--muted); }
#evo svg { width: 100%; height: auto; max-width: 560px; }
#evo .grid { stroke: var(--line); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 0.78rem; color: var(--muted); }

/* Touch screens: every control at least 44px tall to hit with a thumb */
@media (pointer: coarse) {
  .seg button { min-height: 44px; padding: 8px 12px; }
  .top nav a, .linklike { display: inline-block; padding: 12px 0; }
  .tool input[type=search], .tool select, .tool button { min-height: 44px; }
  .crumbs a, .ptable td.name a { display: inline-block; padding: 12px 0; }
  details.card > summary { padding: 10px 0; }
  label.chk { min-height: 44px; }
  input[type=checkbox] { width: 22px; height: 22px; }
}
.cal:focus-visible { outline: 2px solid var(--link); }
.viewas-form { display: inline-flex; gap: 6px; }
