/* Vuelos AYCF - departure board meets a calm instrument.
   Neutral slate with a slight blue bias, one cobalt accent, semantic
   good / warning / critical colors reserved for flight and system states. */

:root {
  color-scheme: light dark;

  --bg: #eef1f4;
  --bg-glass: rgba(238, 241, 244, 0.86);
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --surface-3: #e7ebf0;
  --line: #dfe4ea;
  --line-strong: #c4ccd6;

  --ink: #111820;
  --ink-2: #455161;
  --ink-3: #5a6676;

  --accent: #1d5fd0;
  --accent-press: #174fb0;
  --accent-ink: #ffffff;
  --accent-soft: #e3ecfc;
  --accent-line: #a9c3f2;

  --good: #0b7a3e;
  --good-soft: #dff3e7;
  --good-line: #a8dcbc;
  --good-mark: #14a150;
  --warn: #8a5800;
  --warn-soft: #fcefd3;
  --warn-line: #efd08e;
  --warn-mark: #d99700;
  --crit: #b3261e;
  --crit-soft: #fbe5e2;
  --crit-line: #f0b9b2;
  --crit-mark: #d6402f;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e6eaef;
  --axis: #c4ccd6;

  --hq0: #eef4fd;
  --hq1: #d3e4fb;
  --hq2: #adcdf6;
  --hq3: #7fb0ee;
  --hq4: #4a8fe3;
  --hq5: #2563c0;
  --hq6: #173f86;
  --hq-ink-lo: #111820;
  --hq-ink-hi: #ffffff;

  --focus: #1d5fd0;
  --shadow: 0 1px 2px rgba(17, 24, 32, 0.05);
  --toast-shadow: 0 10px 28px rgba(17, 24, 32, 0.2);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --tab-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e12;
    --bg-glass: rgba(11, 14, 18, 0.86);
    --surface: #141920;
    --surface-2: #1a2029;
    --surface-3: #232b36;
    --line: #262e39;
    --line-strong: #3a4553;

    --ink: #edf1f5;
    --ink-2: #a9b3c1;
    --ink-3: #8592a3;

    --accent: #72a1fa;
    --accent-press: #8db3fb;
    --accent-ink: #07101f;
    --accent-soft: #172642;
    --accent-line: #2f4a7a;

    --good: #55d68f;
    --good-soft: #10291c;
    --good-line: #1f5236;
    --good-mark: #2fbf6c;
    --warn: #f1c35a;
    --warn-soft: #2c2310;
    --warn-line: #5c4715;
    --warn-mark: #e2a534;
    --crit: #ff8e80;
    --crit-soft: #35181b;
    --crit-line: #6a2d2c;
    --crit-mark: #ee5a4a;

    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #222a34;
    --axis: #3a4553;

    --hq0: #172231;
    --hq1: #1a3252;
    --hq2: #1d4679;
    --hq3: #245fa8;
    --hq4: #3b87e4;
    --hq5: #6aa6ee;
    --hq6: #a8cbf6;
    --hq-ink-lo: #edf1f5;
    --hq-ink-hi: #07101f;

    --focus: #8db3fb;
    --shadow: none;
    --toast-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  }
}

/* ------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.ico {
  flex: none;
  display: block;
}

.muted {
  color: var(--ink-3);
}

.center {
  text-align: center;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

.skip:focus {
  left: 12px;
}

.noscript {
  padding: 40px 20px;
  text-align: center;
}

/* ------------------------------------------------------------ top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.topbar.scrolled {
  border-bottom-color: var(--line);
}

.topbar-in {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
}

.tb-titles {
  flex: 1;
  min-width: 0;
}

.tb-title {
  font-size: 26px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tb-sub {
  margin-top: 2px;
  min-height: 1.3em;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-sub.is-err {
  color: var(--warn);
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.icon-btn:active {
  background: var(--surface-3);
}

.icon-btn.is-busy .ico {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------ pull to refresh */

.ptr {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 58px);
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(var(--pull, 0px) - 44px));
  transition: opacity 0.15s, transform 0.2s;
}

.ptr.on {
  opacity: 1;
  transition: none;
}

.ptr-pill {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  box-shadow: var(--toast-shadow);
}

.ptr-pill .ico {
  transform: rotate(var(--rot, 0deg));
}

.ptr.ready .ptr-pill {
  color: var(--accent);
  border-color: var(--accent-line);
}

/* ------------------------------------------------------------ layout */

.views {
  max-width: 680px;
  margin: 0 auto;
  padding: 2px max(16px, env(safe-area-inset-right)) calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px) max(16px, env(safe-area-inset-left));
  outline: none;
}

.boot {
  display: grid;
  place-items: center;
  padding: 96px 0;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 170px));
  justify-content: center;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tab-h);
  color: var(--ink-3);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 10px;
}

.tab[aria-current="page"] {
  color: var(--accent);
}

.tab:focus-visible {
  outline-offset: -3px;
}

/* ------------------------------------------------------------ type blocks */

.sec-h,
.sec-h-in {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.sec-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 2px 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.route-h {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 2px 4px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sub-h {
  margin: 14px 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.foot-line {
  margin: 14px 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------ cards */

.card {
  margin: 12px 0;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-sub {
  margin: 3px 0 10px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.best {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.best .card-title {
  color: var(--accent);
}

.best-text {
  margin: 8px 0 4px;
  font-size: 16px;
  line-height: 1.42;
  font-weight: 550;
}

.best .card-sub {
  margin-bottom: 2px;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.tile {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tile-label {
  font-size: 12.5px;
  color: var(--ink-2);
}

.tile-value {
  margin-top: 2px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tile-sub {
  font-size: 12px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------ banners and notes */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.banner .ico {
  margin-top: 1px;
}

.banner-text {
  min-width: 0;
}

.banner-title {
  font-size: 15px;
  font-weight: 700;
}

.banner-body {
  margin-top: 2px;
  font-size: 14px;
}

.banner.t-crit {
  background: var(--crit-soft);
  border-color: var(--crit-line);
}

.banner.t-crit .ico,
.banner.t-crit .banner-title {
  color: var(--crit);
}

.banner.t-warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.banner.t-warn .ico,
.banner.t-warn .banner-title {
  color: var(--warn);
}

.banner.t-info {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.banner.t-info .ico,
.banner.t-info .banner-title {
  color: var(--accent);
}

.note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 2px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.note .ico {
  margin-top: 2px;
}

.note.t-info .ico {
  color: var(--accent);
}

.note.t-warn .ico {
  color: var(--warn-mark);
}

.note.t-crit {
  color: var(--crit);
}

.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 44px 16px;
  text-align: center;
  color: var(--ink-2);
}

.state-title {
  font-weight: 650;
  color: var(--ink);
}

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.empty-line {
  margin: 8px 0 4px;
  font-size: 14px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:not(:disabled):active {
  background: var(--accent-press);
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--ink);
}

.btn-secondary:not(:disabled):active {
  background: var(--line-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

.btn-quiet {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger {
  background: var(--crit-mark);
  color: #ffffff;
}

.btn-danger-quiet {
  background: var(--crit-soft);
  color: var(--crit);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  position: relative;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 14px;
  white-space: nowrap;
}

/* invisible hit extension so small buttons still offer a 44px target */
.btn-sm::after {
  content: "";
  position: absolute;
  inset: -4px -2px;
}

.btn-sm.icon-only {
  width: 40px;
  padding: 0;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.span2 {
  grid-column: span 2;
}

.actions {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

/* ------------------------------------------------------------ chips (state encoded by form and color) */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chip::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* FREE: solid dot */
.chip.st-FREE {
  background: var(--good-soft);
  border-color: var(--good-line);
  color: var(--good);
}

.chip.st-FREE::before {
  background: var(--good-mark);
}

/* PAID_ONLY: solid diamond */
.chip.st-PAID_ONLY,
.chip.st-SOLD_OUT {
  background: var(--warn-soft);
  color: var(--warn);
}

.chip.st-PAID_ONLY::before {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--warn-mark);
  transform: rotate(45deg);
}

/* SOLD_OUT: hollow diamond */
.chip.st-SOLD_OUT::before {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--warn-mark);
  transform: rotate(45deg);
}

/* NOT_LISTED and unknown: hollow ring */
.chip.st-NOT_LISTED,
.chip.st-NONE {
  background: var(--surface-3);
  color: var(--ink-2);
}

.chip.st-NOT_LISTED::before,
.chip.st-NONE::before {
  background: transparent;
  box-shadow: inset 0 0 0 2px currentColor;
}

.chip.st-NONE {
  color: var(--ink-3);
}

/* PRE_WINDOW / opened but unchecked: outlined, half-filled dot */
.chip.st-PRE_WINDOW,
.chip.st-UNCHECKED {
  background: transparent;
  border-color: var(--accent-line);
  color: var(--accent);
}

.chip.st-PRE_WINDOW::before,
.chip.st-UNCHECKED::before {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  box-shadow: inset 0 0 0 1.5px currentColor;
}

/* CLOSED: short bar */
.chip.st-CLOSED {
  background: var(--surface-3);
  color: var(--ink-3);
}

.chip.st-CLOSED::before {
  width: 8px;
  height: 2px;
  border-radius: 1px;
}

/* CANCELLED: slash */
.chip.st-CANCELLED {
  background: var(--crit-soft);
  border-color: var(--crit-line);
  color: var(--crit);
}

.chip.st-CANCELLED::before {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--crit-mark);
  transform: rotate(-50deg);
}

/* BLACKOUT: solid square */
.chip.st-BLACKOUT {
  background: var(--crit-soft);
  color: var(--crit);
}

.chip.st-BLACKOUT::before {
  border-radius: 1px;
  background: var(--crit-mark);
}

.chip-count {
  height: 22px;
  padding: 0 8px 0 7px;
  font-size: 12px;
}

.chip-count::before {
  width: 7px;
  height: 7px;
}

.chip-sm {
  height: 20px;
  padding: 0 7px 0 6px;
  font-size: 11.5px;
  vertical-align: 1px;
}

.chip-sm::before {
  width: 6px;
  height: 6px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------ collapsibles */

.fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold .sum-in {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.fold .chev {
  display: grid;
  place-items: center;
  color: var(--ink-3);
  transition: transform 0.18s;
}

.fold[open] > summary .chev {
  transform: rotate(90deg);
}

.fold > summary:focus-visible {
  outline-offset: -2px;
  border-radius: 8px;
}

.sec-fold {
  margin-top: 16px;
}

.sec-fold > summary {
  padding: 0 2px;
}

.planb {
  margin: 10px 0 2px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.planb[open] {
  padding-bottom: 10px;
}

.planb-title {
  font-size: 14.5px;
  font-weight: 650;
}

.planb-note {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.planb-moved {
  color: var(--accent);
  font-weight: 600;
}

.planb-actions {
  margin-top: 8px;
}

.hours-fold {
  margin: 12px 0 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hours-fold > summary {
  font-weight: 650;
  font-size: 14.5px;
}

.hours-fold .muted {
  font-weight: 400;
  font-size: 13px;
}

.hours-fold[open] {
  padding-bottom: 10px;
}

/* ------------------------------------------------------------ Ahora */

.dir-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.dir-titles {
  min-width: 0;
}

.dir-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.codes {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  white-space: nowrap;
}

.dir-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
}

.flights {
  margin: 0;
  padding: 0;
  list-style: none;
}

.flight {
  --rail: var(--line-strong);
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  column-gap: 12px;
  padding: 11px 0 11px 12px;
  border-top: 1px solid var(--line);
}

.flight::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 2px;
  background: var(--rail);
}

.flight.st-FREE {
  --rail: var(--good-mark);
}

.flight.st-PAID_ONLY,
.flight.st-SOLD_OUT {
  --rail: var(--warn-mark);
}

.flight.st-CANCELLED,
.flight.st-BLACKOUT {
  --rail: var(--crit-mark);
}

.flight.st-PRE_WINDOW,
.flight.st-UNCHECKED {
  --rail: var(--accent-line);
}

.flight.st-CLOSED {
  --rail: var(--line);
  opacity: 0.62;
}

.f-time {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.hm {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.day {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
}

.flight.st-CANCELLED .hm {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.f-main {
  min-width: 0;
}

.f-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 26px;
}

.fno {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.watched {
  display: inline-flex;
  color: var(--accent);
}

.f-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.f-meta > span + span::before {
  content: "\00b7";
  margin: 0 6px;
  color: var(--ink-3);
}

.m-strong {
  color: var(--ink);
  font-weight: 600;
}

.m-urgent {
  color: var(--crit);
  font-weight: 700;
}

.m-accent {
  color: var(--accent);
  font-weight: 600;
}

.m-stale {
  color: var(--warn);
}

.gone-line {
  margin: 4px 0 0 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------ segmented, pickers */

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  margin: 8px 0 12px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-3);
}

.seg-btn {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.seg-btn[aria-checked="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 24, 32, 0.1), 0 0 0 1px var(--line);
}

.chips-row {
  display: flex;
  gap: 6px;
  margin: 0 -16px;
  padding: 4px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips-row::-webkit-scrollbar {
  display: none;
}

.pick {
  position: relative;
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.pick::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

.pick.is-backup {
  border-style: dashed;
}

.pick[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  border-style: solid;
  color: var(--surface);
}

/* ------------------------------------------------------------ heatmap */

.heat-scroll {
  margin: 4px -4px 0;
  padding: 0 4px 2px;
  overflow-x: auto;
}

.heat {
  display: grid;
  grid-template-columns: 34px repeat(5, minmax(40px, 1fr)) 4px minmax(40px, 1fr);
  gap: 3px;
  min-width: 300px;
}

.hh {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 3px;
  font-size: 11.5px;
  line-height: 1.15;
  color: var(--ink-2);
}

.hh b {
  font-weight: 600;
}

.hh small {
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.hrow {
  display: flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.hsep {
  grid-column: 1 / -1;
  height: 3px;
}

.hcell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 2px;
  border: 0;
  border-radius: 6px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.hcell b {
  font-size: 13px;
  font-weight: 650;
}

.hcell small {
  font-size: 10px;
  opacity: 0.78;
}

.hcell.sel {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
}

.hc-none {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: default;
}

.hc-thin {
  background: var(--surface-3);
  color: var(--ink-3);
}

.hc-q0 { background: var(--hq0); color: var(--hq-ink-lo); }
.hc-q1 { background: var(--hq1); color: var(--hq-ink-lo); }
.hc-q2 { background: var(--hq2); color: var(--hq-ink-lo); }
.hc-q3 { background: var(--hq3); color: var(--hq-ink-lo); }
.hc-q4 { background: var(--hq4); color: var(--hq-ink-lo); }
.hc-q5 { background: var(--hq5); color: var(--hq-ink-hi); }
.hc-q6 { background: var(--hq6); color: var(--hq-ink-hi); }

@media (prefers-color-scheme: dark) {
  .hc-q4 { color: var(--hq-ink-hi); }
}

.heat-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.hl-ramp {
  display: inline-flex;
  gap: 2px;
}

.hl-sw {
  display: inline-block;
  width: 16px;
  height: 10px;
  border-radius: 2px;
}

.hl-thin {
  margin-left: 10px;
}

/* ------------------------------------------------------------ charts */

.chart {
  margin: 6px 0 0;
}

.chart svg {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
}

.readout {
  min-height: 2.9em;
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.chart .grid {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart .axis {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart .ref {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--ink-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .tick.strong {
  fill: var(--ink-2);
  font-weight: 600;
}

.chart .axis-title {
  fill: var(--ink-3);
  font-size: 11px;
}

.chart .vlabel {
  fill: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart .dlabel {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.chart .band.s1 {
  fill: var(--series-1);
  fill-opacity: 0.14;
}

.chart .area.s1 {
  fill: var(--series-1);
  fill-opacity: 0.1;
}

.chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .line.s1 {
  stroke: var(--series-1);
}

.chart .dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.chart .dot.s1 {
  fill: var(--series-1);
}

.chart .dot.s2 {
  fill: var(--series-2);
}

.chart .dot.sel {
  stroke: var(--ink);
}

.chart .col.s1 {
  fill: var(--series-1);
  transition: opacity 0.15s;
}

.chart-cols svg:has(.col.sel) .col:not(.sel) {
  opacity: 0.45;
}

.chart .conn {
  stroke: var(--line-strong);
  stroke-width: 2;
  stroke-linecap: round;
}

.chart .db-row.sel .tick {
  fill: var(--ink);
  font-weight: 700;
}

.chart .cross {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.chart .hit {
  fill: transparent;
  cursor: pointer;
  outline: none;
}

.chart .hit:focus-visible {
  stroke: var(--focus);
  stroke-width: 2;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 2px 0 4px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.lg-dot.s1 {
  background: var(--series-1);
}

.lg-dot.s2 {
  background: var(--series-2);
}

.tableview {
  margin-top: 6px;
}

.tableview > summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  list-style: none;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.tableview > summary::-webkit-details-marker {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

tbody th {
  font-weight: 500;
}

/* horizontal bars */

.hbars {
  display: grid;
  gap: 8px;
  margin: 6px 0 8px;
}

.hbar {
  display: grid;
  grid-template-columns: minmax(96px, 36%) minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.hbar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.hbar-track {
  height: 10px;
}

.hbar-fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.hbar-val {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hbar-fill.t-s1,
.meter-fill.t-s1 {
  background: var(--series-1);
}

.hbar-fill.t-good,
.meter-fill.t-good {
  background: var(--good-mark);
}

.hbar-fill.t-warn,
.meter-fill.t-warn {
  background: var(--warn-mark);
}

.hbar-fill.t-crit,
.meter-fill.t-crit {
  background: var(--crit-mark);
}

.hbar-fill.t-muted {
  background: var(--line-strong);
}

/* meters */

.meter {
  margin: 6px 0 2px;
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-3);
}

.meter-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.meter-band {
  position: relative;
  height: 9px;
  margin-top: 2px;
}

.meter-whisker {
  position: absolute;
  top: 4px;
  height: 2px;
  background: var(--ink-3);
}

.meter-whisker::before,
.meter-whisker::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 2px;
  height: 8px;
  background: var(--ink-3);
}

.meter-whisker::before {
  left: 0;
}

.meter-whisker::after {
  right: 0;
}

/* ------------------------------------------------------------ Planificar */

.plan-form .seg {
  margin-top: 0;
}

.field {
  display: block;
  margin: 12px 0;
}

.field-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  font-size: 14.5px;
  font-weight: 650;
}

.field-h .field-label {
  margin-bottom: 0;
}

.field-hint {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
}

.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.daychip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 50px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.day-wd {
  font-size: 11px;
  color: var(--ink-3);
}

.day-n {
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.daychip.wkend .day-wd {
  color: var(--ink-2);
  font-weight: 600;
}

.daychip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.daychip.on .day-wd {
  color: var(--accent-ink);
  opacity: 0.85;
}

.time-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 14px;
}

.time-label {
  color: var(--ink-2);
}

.time-and {
  color: var(--ink-3);
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.input-time {
  padding: 0 8px;
  text-align: center;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin: 8px 0 12px;
  cursor: pointer;
}

.switch-title {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
}

.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background 0.18s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  transform: translateX(20px);
}

.hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 8px;
}

.hero-n {
  font-size: 54px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.hero-l {
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-2);
}

.leg {
  margin: 12px 0;
}

.leg-h {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.leg-name {
  font-weight: 650;
}

.leg-dates {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink-3);
}

.leg-p {
  font-size: 18px;
  font-weight: 700;
}

.leg-sub {
  font-size: 12.5px;
  color: var(--ink-3);
}

.notes {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.notes li {
  margin: 4px 0;
}

.cands {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  column-gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.cand:first-child {
  border-top: 0;
}

.cand-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.cand-p {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cand .meter {
  margin: 6px 0 0;
}

.cand .meter-track {
  height: 6px;
}

.cand-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.cand.is-backup .hm {
  color: var(--ink-2);
}

.cand-planb {
  margin: 10px 0 4px;
  padding: 10px 12px 2px;
  border: 1px solid var(--warn-line);
  border-radius: 11px;
  background: var(--surface-2);
}

.cand-planb-h {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--warn);
}

.cand-planb > .cand-sub {
  margin: 2px 0 4px;
}

.timeline {
  position: relative;
  margin: 4px 0 12px;
  padding: 0 0 0 20px;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--line);
}

.tl {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 6px 0 10px;
}

.tl::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface);
}

.tl.is-backup::before {
  border-radius: 2px;
  background: var(--warn-mark);
}

.tl-what .tag {
  margin-left: 6px;
  vertical-align: 1px;
}

.tl.is-past {
  opacity: 0.5;
}

.tl.is-past::before {
  background: var(--line-strong);
}

.tl-when {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.tl-what {
  font-size: 13px;
  color: var(--ink-2);
}

.tl-why {
  font-size: 13px;
  color: var(--ink-3);
}

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.row:first-child {
  border-top: 0;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 14.5px;
  font-weight: 600;
}

.row-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.is-dim {
  opacity: 0.55;
}

/* ------------------------------------------------------------ Sistema */

.kvs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 14px;
  margin: 10px 0 6px;
}

.kv {
  display: contents;
}

.kv dt {
  font-size: 13.5px;
  color: var(--ink-2);
}

.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kv dd.m-urgent {
  color: var(--crit);
}

.kv dd.m-stale {
  color: var(--warn);
}

.budget {
  margin-top: 12px;
}

.budget-h {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-2);
}

.budget-n {
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.form .btn {
  width: 100%;
  margin-top: 4px;
}

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  box-shadow: var(--toast-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.toast.t-crit {
  background: var(--crit);
}

.toast.t-good {
  background: var(--good);
}

.toast-btn {
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ------------------------------------------------------------ login */

body.is-login .topbar,
body.is-login .tabbar,
body.is-login .views,
body.is-login .ptr {
  display: none;
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.login {
  width: 100%;
  max-width: 380px;
}

.login .brand {
  display: block;
  margin-bottom: 18px;
}

.brand-bg {
  fill: var(--accent);
}

.brand-fg-stroke {
  stroke: var(--accent-ink);
}

.brand-fg-fill {
  fill: var(--accent-ink);
}

.login-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-lead {
  margin: 4px 0 26px;
  color: var(--ink-2);
}

.login-text {
  margin-bottom: 16px;
  font-size: 16px;
}

.login-form .field-label {
  margin-bottom: 6px;
}

.input-code {
  min-height: 60px;
  margin-bottom: 12px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0.4em;
  text-align: center;
}

.login .btn-ghost {
  margin-top: 8px;
}

.login-msg {
  min-height: 1.4em;
  margin-top: 14px;
  font-size: 14px;
}

.login-msg.t-crit {
  color: var(--crit);
}

.login-msg.t-good {
  color: var(--good);
}

/* ------------------------------------------------------------ wider screens */

@media (min-width: 560px) {
  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .tiles {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ------------------------------------------------------------ accessibility */

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

@media (forced-colors: active) {
  .chip,
  .hcell,
  .daychip,
  .pick {
    border: 1px solid CanvasText;
  }

  .flight::before,
  .meter-fill,
  .hbar-fill {
    background: CanvasText;
  }
}
