:root {
  --navy-950: #081b2c;
  --navy-900: #102a43;
  --navy-800: #163b5c;
  --blue-700: #1f5f99;
  --blue-100: #eaf3fb;
  --cyan-500: #21a6b5;
  --green-700: #16794b;
  --green-100: #e6f6ee;
  --amber-700: #986714;
  --amber-100: #fff4d9;
  --red-700: #b42318;
  --red-100: #fdecea;
  --slate-900: #17212b;
  --slate-700: #465666;
  --slate-600: #5c6c7a;
  --slate-500: #738291;
  --slate-300: #cbd5df;
  --slate-200: #dde5ec;
  --slate-100: #eef3f7;
  --white: #ffffff;
  --surface: #f4f7fa;
  --shadow: 0 12px 32px rgba(16, 42, 67, 0.09);
  --radius: 16px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
  color: var(--slate-900);
  font-family: var(--font-sans);
  line-height: 1.45;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 85% -10%, rgba(33, 166, 181, 0.11), transparent 28rem),
    var(--surface);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  color: var(--white);
  background: var(--navy-950);
  transform: translateY(-160%);
}

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

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  color: var(--white);
  background: rgba(8, 27, 44, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1920px);
  min-height: 72px;
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 2.5vw, 2.5rem);
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.8rem;
}

.brand__mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(33, 166, 181, 0.28), rgba(31, 95, 153, 0.22));
}

.brand__mark svg {
  width: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.4;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 0.1rem;
  overflow: hidden;
  color: #b9c9d7;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
}

.primary-nav a {
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  color: #d9e5ee;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--white);
  background: rgba(255, 255, 255, 0.09);
  outline: none;
}

.page-shell {
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: clamp(1.1rem, 2vw, 2rem) clamp(0.75rem, 2.5vw, 2.5rem) 2rem;
}

.overview {
  margin-bottom: 1.25rem;
}

.overview__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--blue-700);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.25rem;
  color: var(--navy-950);
  font-size: clamp(1.65rem, 2.8vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.overview__description {
  margin-bottom: 0;
  color: var(--slate-600);
  font-size: 0.94rem;
}

.connection {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  margin-top: 0.35rem;
  padding: 0.48rem 0.72rem;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  color: var(--slate-700);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.78rem;
  font-weight: 750;
  gap: 0.45rem;
}

.connection__dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--slate-500);
  box-shadow: 0 0 0 4px rgba(115, 130, 145, 0.12);
}

.connection[data-state="online"] {
  color: var(--green-700);
  border-color: #bce3cd;
  background: var(--green-100);
}

.connection[data-state="online"] .connection__dot {
  background: #20a464;
  box-shadow: 0 0 0 4px rgba(32, 164, 100, 0.13);
}

.connection[data-state="error"] {
  color: var(--red-700);
  border-color: #f2c6c2;
  background: var(--red-100);
}

.connection[data-state="error"] .connection__dot {
  background: #d92d20;
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.12);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 0.7fr)) minmax(260px, 1.5fr);
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 18px rgba(16, 42, 67, 0.04);
}

.metric {
  min-width: 0;
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--slate-200);
}

.metric:last-child {
  border-right: 0;
}

.metric__label,
.metric__value {
  display: block;
}

.metric__label {
  margin-bottom: 0.18rem;
  color: var(--slate-600);
  font-size: 0.72rem;
  font-weight: 700;
}

.metric__value {
  color: var(--navy-950);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.metric__value--time {
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-panel {
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.data-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem 0.9rem;
  gap: 1rem;
}

.data-panel__header h2 {
  margin-bottom: 0.08rem;
  color: var(--navy-950);
  font-size: 1.05rem;
}

.data-panel__header p {
  margin-bottom: 0;
  color: var(--slate-600);
  font-size: 0.78rem;
}

.refresh-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0.56rem 0.78rem;
  border: 1px solid var(--slate-300);
  border-radius: 0.58rem;
  color: var(--navy-800);
  background: var(--white);
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  gap: 0.42rem;
}

.refresh-button svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.refresh-button:hover,
.refresh-button:focus-visible {
  border-color: var(--blue-700);
  color: var(--blue-700);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 95, 153, 0.12);
}

.refresh-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.refresh-button.is-refreshing svg {
  animation: rotate 0.8s linear infinite;
}

.controls {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) minmax(145px, 0.55fr) minmax(165px, 0.65fr) auto;
  align-items: end;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--slate-100);
  background: #f9fbfc;
  gap: 0.75rem;
}

.field {
  display: grid;
  min-width: 0;
  gap: 0.28rem;
}

.field__label {
  color: var(--slate-700);
  font-size: 0.68rem;
  font-weight: 750;
}

.field input,
.field select {
  width: 100%;
  height: 2.35rem;
  border: 1px solid var(--slate-300);
  border-radius: 0.55rem;
  color: var(--slate-900);
  background: var(--white);
  font-size: 0.8rem;
}

.field select {
  padding: 0 2rem 0 0.7rem;
}

.search-box {
  position: relative;
  display: block;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 0.72rem;
  width: 1rem;
  fill: none;
  stroke: var(--slate-500);
  stroke-linecap: round;
  stroke-width: 2;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  padding: 0 0.75rem 0 2.25rem;
}

.field input:focus,
.field select:focus {
  border-color: var(--blue-700);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 95, 153, 0.12);
}

.active-view {
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 2.35rem;
  padding: 0.42rem 0.65rem;
  border: 1px solid #bdd6ea;
  border-radius: 0.55rem;
  color: var(--blue-700);
  background: var(--blue-100);
  font-size: 0.75rem;
  gap: 0.42rem;
}

.active-view[hidden] {
  display: none;
}

.active-view a {
  margin-left: 0.2rem;
  font-weight: 750;
}

.notice {
  margin: 0.85rem 1.15rem 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid #f1c6c2;
  border-radius: 0.55rem;
  color: var(--red-700);
  background: var(--red-100);
  font-size: 0.78rem;
}

.notice[hidden] {
  display: none;
}

.scroll-hint {
  display: none;
  margin: 0;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--slate-200);
  color: var(--slate-600);
  background: #f9fbfc;
  font-size: 0.7rem;
}

.table-frame {
  max-height: calc(100vh - 300px);
  min-height: 250px;
  overflow: auto;
  border-top: 1px solid var(--slate-200);
  scrollbar-color: #9fb0bf #eef3f7;
  scrollbar-width: thin;
}

.table-frame:focus-visible {
  outline: 3px solid rgba(31, 95, 153, 0.18);
  outline-offset: -3px;
}

table {
  width: 100%;
  min-width: 2180px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.75rem;
}

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

th,
td {
  padding: 0.56rem 0.6rem;
  border-right: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-100);
  overflow: hidden;
  vertical-align: middle;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  position: sticky;
  z-index: 4;
  top: 0;
  height: 42px;
  color: #dbe7f0;
  background: var(--navy-900);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.015em;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
}

th:first-child {
  z-index: 6;
  background: var(--navy-950);
}

td:first-child {
  z-index: 2;
  background: var(--white);
  box-shadow: 6px 0 12px -12px rgba(8, 27, 44, 0.75);
}

tbody tr:nth-child(even) td {
  background: #f9fbfc;
}

tbody tr:nth-child(even) td:first-child {
  background: #f9fbfc;
}

tbody tr:hover td {
  background: #edf5fb;
}

tbody tr:hover td:first-child {
  background: #edf5fb;
}

tr.row--progress td {
  background: #edf8fb;
}

tr.row--progress td:first-child {
  background: #edf8fb;
  box-shadow: inset 3px 0 0 var(--cyan-500), 6px 0 12px -12px rgba(8, 27, 44, 0.75);
}

tr.row--lost td:first-child {
  box-shadow: inset 3px 0 0 #d92d20, 6px 0 12px -12px rgba(8, 27, 44, 0.75);
}

th:nth-child(1), td:nth-child(1) { width: 156px; }
th:nth-child(2), td:nth-child(2) { width: 132px; }
th:nth-child(3), td:nth-child(3) { width: 92px; }
th:nth-child(4), td:nth-child(4) { width: 58px; text-align: center; }
th:nth-child(5), td:nth-child(5) { width: 112px; }
th:nth-child(6), td:nth-child(6) { width: 94px; }
th:nth-child(7), td:nth-child(7) { width: 94px; }
th:nth-child(8), td:nth-child(8) { width: 92px; }
th:nth-child(9), td:nth-child(9) { width: 74px; }
th:nth-child(10), td:nth-child(10) { width: 152px; }
th:nth-child(11), td:nth-child(11) { width: 82px; }
th:nth-child(12), td:nth-child(12) { width: 112px; }
th:nth-child(13), td:nth-child(13) { width: 104px; }
th:nth-child(14), td:nth-child(14) { width: 130px; }
th:nth-child(15), td:nth-child(15) { width: 134px; }
th:nth-child(16), td:nth-child(16) { width: 145px; }
th:nth-child(17), td:nth-child(17) { width: 210px; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.chip,
.state-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 1.45rem;
  padding: 0.15rem 0.43rem;
  border: 1px solid transparent;
  border-radius: 0.38rem;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1;
}

.chip--blue {
  color: #174f80;
  border-color: #c2d9eb;
  background: #e9f3fb;
}

.chip--green {
  color: var(--green-700);
  border-color: #bce3cd;
  background: var(--green-100);
}

.chip--amber {
  color: var(--amber-700);
  border-color: #ead5a1;
  background: var(--amber-100);
}

.chip--red {
  color: var(--red-700);
  border-color: #f0c3bf;
  background: var(--red-100);
}

.state-pill::before {
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.state-pill--progress {
  color: var(--green-700);
  background: var(--green-100);
}

.state-pill--lost {
  color: var(--red-700);
  background: var(--red-100);
}

.state-pill--ended {
  color: var(--slate-600);
  background: var(--slate-100);
}

.signal {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.signal__bars {
  display: inline-flex;
  align-items: end;
  height: 14px;
  gap: 1px;
}

.signal__bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: var(--slate-300);
}

.signal__bars i:nth-child(1) { height: 4px; }
.signal__bars i:nth-child(2) { height: 7px; }
.signal__bars i:nth-child(3) { height: 10px; }
.signal__bars i:nth-child(4) { height: 14px; }
.signal[data-level="1"] i:nth-child(-n+1),
.signal[data-level="2"] i:nth-child(-n+2),
.signal[data-level="3"] i:nth-child(-n+3),
.signal[data-level="4"] i:nth-child(-n+4) { background: var(--blue-700); }

.signal__text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.message-row td {
  height: 180px;
  color: var(--slate-600);
  text-align: center;
  background: var(--white) !important;
}

.message-row td:first-child {
  position: static;
  box-shadow: none;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.45rem;
  border: 2px solid var(--slate-300);
  border-top-color: var(--blue-700);
  border-radius: 50%;
  vertical-align: -0.2rem;
  animation: rotate 0.8s linear infinite;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  color: var(--slate-600);
  background: #f9fbfc;
  border-top: 1px solid var(--slate-200);
  font-size: 0.7rem;
  gap: 1rem;
}

.site-footer {
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: 0.3rem clamp(1rem, 2.5vw, 2.5rem) 1.5rem;
  color: var(--slate-600);
  font-size: 0.7rem;
  text-align: center;
}

.site-footer p {
  margin-bottom: 0.2rem;
}

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

@media (max-width: 850px) {
  .site-header__inner {
    min-height: 64px;
  }

  .primary-nav a {
    padding: 0.48rem 0.55rem;
    font-size: 0.75rem;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric:nth-child(3) {
    border-right: 0;
  }

  .metric--wide {
    grid-column: 1 / -1;
    border-top: 1px solid var(--slate-200);
  }

  .controls {
    grid-template-columns: minmax(220px, 1fr) 1fr 1fr;
  }

  .active-view {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .scroll-hint {
    display: block;
  }

  .table-frame {
    max-height: calc(100vh - 390px);
  }
}

@media (max-width: 600px) {
  .brand__mark {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    font-size: 0.88rem;
  }

  .brand small {
    max-width: 165px;
    font-size: 0.68rem;
  }

  .primary-nav a:first-child {
    display: none;
  }

  .overview__heading,
  .data-panel__header {
    align-items: stretch;
  }

  .overview__heading {
    display: block;
  }

  .connection {
    margin-top: 0.75rem;
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric {
    padding: 0.72rem 0.65rem;
  }

  .metric__value {
    font-size: 1.05rem;
  }

  .metric__value--time {
    font-size: 0.78rem;
  }

  .data-panel__header {
    padding: 0.9rem;
  }

  .refresh-button {
    align-self: center;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
    padding: 0.8rem 0.9rem;
  }

  .field--search {
    grid-column: 1 / -1;
  }

  .table-frame {
    max-height: calc(100vh - 420px);
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }
}

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

/* BEGIN LASTHEARD FIT DESKTOP */
@media (min-width: 1100px) {
  .page-shell {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .table-frame {
    overflow-x: hidden;
  }

  table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: clamp(0.58rem, 0.62vw, 0.72rem);
  }

  th,
  td {
    padding: 0.46rem 0.32rem;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.18;
    text-overflow: clip;
  }

  th {
    height: 44px;
    font-size: clamp(0.53rem, 0.56vw, 0.65rem);
  }

  /*
   * A primeira coluna deixa de ficar fixa em computador,
   * porque já não existe deslocamento horizontal.
   */
  th:first-child,
  td:first-child {
    position: static;
  }

  td:first-child {
    box-shadow: none;
  }

  /*
   * Distribuição proporcional das 17 colunas.
   * O total corresponde a 100% da largura disponível.
   */
  th:nth-child(1),
  td:nth-child(1) {
    width: 6.92%;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 6.61%;
  }

  th:nth-child(3),
  td:nth-child(3) {
    width: 5.51%;
  }

  th:nth-child(4),
  td:nth-child(4) {
    width: 2.68%;
  }

  th:nth-child(5),
  td:nth-child(5) {
    width: 5.66%;
  }

  th:nth-child(6),
  td:nth-child(6) {
    width: 5.66%;
  }

  th:nth-child(7),
  td:nth-child(7) {
    width: 5.11%;
  }

  th:nth-child(8),
  td:nth-child(8) {
    width: 5.11%;
  }

  th:nth-child(9),
  td:nth-child(9) {
    width: 4.33%;
  }

  th:nth-child(10),
  td:nth-child(10) {
    width: 8.26%;
  }

  th:nth-child(11),
  td:nth-child(11) {
    width: 4.33%;
  }

  th:nth-child(12),
  td:nth-child(12) {
    width: 5.98%;
  }

  th:nth-child(13),
  td:nth-child(13) {
    width: 5.51%;
  }

  th:nth-child(14),
  td:nth-child(14) {
    width: 5.90%;
  }

  th:nth-child(15),
  td:nth-child(15) {
    width: 6.29%;
  }

  th:nth-child(16),
  td:nth-child(16) {
    width: 6.69%;
  }

  th:nth-child(17),
  td:nth-child(17) {
    width: 9.44%;
  }

  .mono,
  .chip,
  .state-pill,
  .signal__text {
    font-size: clamp(0.54rem, 0.55vw, 0.66rem);
  }

  .chip,
  .state-pill {
    min-height: 1.28rem;
    padding: 0.12rem 0.3rem;
    white-space: nowrap;
  }

  .state-pill::before {
    width: 0.32rem;
    height: 0.32rem;
    margin-right: 0.25rem;
  }

  .signal {
    align-items: flex-start;
    gap: 0.22rem;
  }

  .signal__text {
    white-space: normal;
    line-height: 1.12;
  }
}
/* END LASTHEARD FIT DESKTOP */

/* BEGIN LASTHEARD VIEWPORT DESKTOP */

/*
 * Em ecrãs de computador com altura suficiente, toda a página
 * fica contida na área visível do navegador.
 *
 * Quando existem muitos registos, apenas a tabela terá
 * deslocamento vertical.
 */
@media (min-width: 1100px) and (min-height: 700px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .site-header {
    flex: 0 0 auto;
  }

  .page-shell {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding-top: 0.75rem;
    padding-bottom: 0.45rem;
  }

  .overview {
    flex: 0 0 auto;
    margin-bottom: 0.75rem;
  }

  .metrics {
    margin-top: 0.7rem;
  }

  .metric {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .data-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  .data-panel__header,
  .controls,
  .notice,
  .scroll-hint,
  .table-footer {
    flex: 0 0 auto;
  }

  .data-panel__header {
    padding-top: 0.75rem;
    padding-bottom: 0.7rem;
  }

  .controls {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .table-frame {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .site-footer {
    flex: 0 0 auto;
    padding-top: 0.25rem;
    padding-bottom: 0.55rem;
  }

  .site-footer p {
    margin-bottom: 0.1rem;
  }
}

/*
 * Em ecrãs com menor altura, mantém-se o comportamento normal
 * para evitar que algum conteúdo fique inacessível.
 */
@media (min-width: 1100px) and (max-height: 699px) {
  html,
  body {
    height: auto;
    overflow-y: auto;
  }
}

/* END LASTHEARD VIEWPORT DESKTOP */

/* BEGIN LASTHEARD READABLE TABLE */

@media (min-width: 1100px) {
  /*
   * Aumenta a legibilidade geral da tabela.
   */
  table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: clamp(0.68rem, 0.67vw, 0.78rem);
  }

  th {
    height: 54px;
    padding: 0.42rem 0.28rem;
    font-size: clamp(0.62rem, 0.61vw, 0.72rem);
    line-height: 1.12;
    vertical-align: middle;
    white-space: normal;
  }

  th .th-lines {
    display: inline-block;
    line-height: 1.12;
  }

  td {
    padding: 0.52rem 0.34rem;
    font-size: inherit;
    line-height: 1.24;
    vertical-align: middle;
  }

  /*
   * Colunas textuais que podem ocupar duas linhas.
   */
  td:nth-child(1),
  td:nth-child(2),
  td:nth-child(5),
  td:nth-child(10),
  td:nth-child(14),
  td:nth-child(16),
  td:nth-child(17) {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    text-overflow: clip;
  }

  /*
   * Campos técnicos que devem permanecer compactos.
   */
  td:nth-child(3),
  td:nth-child(4),
  td:nth-child(6),
  td:nth-child(7),
  td:nth-child(8),
  td:nth-child(9),
  td:nth-child(11),
  td:nth-child(12),
  td:nth-child(13),
  td:nth-child(15) {
    white-space: nowrap;
  }

  /*
   * Redistribuição das 17 colunas.
   * Total: 100%.
   */
  th:nth-child(1),
  td:nth-child(1) {
    width: 6.8%;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 7%;
  }

  th:nth-child(3),
  td:nth-child(3) {
    width: 5.3%;
  }

  th:nth-child(4),
  td:nth-child(4) {
    width: 2.7%;
  }

  th:nth-child(5),
  td:nth-child(5) {
    width: 5.3%;
  }

  th:nth-child(6),
  td:nth-child(6) {
    width: 5.4%;
  }

  th:nth-child(7),
  td:nth-child(7) {
    width: 4.8%;
  }

  th:nth-child(8),
  td:nth-child(8) {
    width: 5%;
  }

  th:nth-child(9),
  td:nth-child(9) {
    width: 4.3%;
  }

  th:nth-child(10),
  td:nth-child(10) {
    width: 7.7%;
  }

  th:nth-child(11),
  td:nth-child(11) {
    width: 4.4%;
  }

  th:nth-child(12),
  td:nth-child(12) {
    width: 5.5%;
  }

  th:nth-child(13),
  td:nth-child(13) {
    width: 5.1%;
  }

  th:nth-child(14),
  td:nth-child(14) {
    width: 6%;
  }

  th:nth-child(15),
  td:nth-child(15) {
    width: 5.8%;
  }

  th:nth-child(16),
  td:nth-child(16) {
    width: 6.6%;
  }

  th:nth-child(17),
  td:nth-child(17) {
    width: 12.3%;
  }

  /*
   * Mantém IDs, etiquetas e estados legíveis,
   * sem os reduzir excessivamente.
   */
  .mono {
    font-size: clamp(0.65rem, 0.62vw, 0.73rem);
  }

  .chip,
  .state-pill {
    min-height: 1.4rem;
    padding: 0.16rem 0.36rem;
    font-size: clamp(0.61rem, 0.58vw, 0.69rem);
    line-height: 1;
    white-space: nowrap;
  }

  .signal {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: 0.3rem;
  }

  .signal__text {
    font-size: clamp(0.62rem, 0.59vw, 0.7rem);
    line-height: 1.15;
    white-space: normal;
  }

  /*
   * A data deverá ocupar naturalmente duas linhas:
   * primeira linha para a data e segunda para a hora.
   */
  td:nth-child(1) {
    font-variant-numeric: tabular-nums;
  }
}

/* END LASTHEARD READABLE TABLE */

/* BEGIN LASTHEARD DATE AND FONT FIX */

@media (min-width: 1100px) {
  /*
   * Aumento moderado da letra, mantendo as larguras
   * anteriormente definidas para as 17 colunas.
   */
  table {
    font-size: clamp(0.74rem, 0.72vw, 0.84rem);
  }

  th {
    font-size: clamp(0.68rem, 0.66vw, 0.76rem);
    line-height: 1.14;
  }

  td {
    font-size: inherit;
    line-height: 1.26;
  }

  .mono {
    font-size: clamp(0.69rem, 0.66vw, 0.78rem);
  }

  .chip,
  .state-pill {
    font-size: clamp(0.66rem, 0.63vw, 0.74rem);
  }

  .signal__text {
    font-size: clamp(0.67rem, 0.64vw, 0.75rem);
  }

  /*
   * Todos os cabeçalhos permanecem visíveis durante
   * o deslocamento vertical da tabela.
   */
  thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #102f49;
  }

  /*
   * Correção específica da coluna Date.
   * Fica fixa verticalmente, mas não horizontalmente.
   */
  thead th:first-child {
    position: sticky !important;
    top: 0;
    left: auto !important;
    z-index: 5;
    background: #102f49;
    box-shadow: none;
  }

  /*
   * As células da coluna Date continuam a deslocar-se
   * normalmente com as restantes linhas.
   */
  tbody td:first-child {
    position: static !important;
    top: auto !important;
    left: auto !important;
    z-index: auto;
    box-shadow: none;
  }

  /*
   * Data e hora mantidas em duas linhas legíveis.
   */
  tbody td:first-child {
    font-size: clamp(0.69rem, 0.67vw, 0.78rem);
    line-height: 1.22;
    font-variant-numeric: tabular-nums;
  }
}

/* END LASTHEARD DATE AND FONT FIX */

/* BEGIN LASTHEARD DESTINATION CALL FIX */

@media (min-width: 1100px) {
  /*
   * A coluna Destination Call passa de 5,8% para 6,6%.
   * A diferença é retirada de Talker Alias.
   */
  th:nth-child(15),
  td:nth-child(15) {
    width: 6.6%;
  }

  th:nth-child(17),
  td:nth-child(17) {
    width: 11.5%;
  }

  /*
   * Aproveitamento adicional do espaço interior da coluna.
   */
  td:nth-child(15) {
    padding-right: 0.2rem;
    padding-left: 0.2rem;
  }

  td:nth-child(15) .chip {
    display: inline-flex;
    max-width: 100%;
    padding-right: 0.28rem;
    padding-left: 0.28rem;
    justify-content: center;
    white-space: nowrap;
    letter-spacing: -0.01em;
  }
}

/* END LASTHEARD DESTINATION CALL FIX */

/* BEGIN LASTHEARD COMPACT TOP */

@media (min-width: 1100px) and (min-height: 700px) {
  /*
   * Redução moderada do espaço vertical superior.
   * A área libertada passa automaticamente para a tabela.
   */
  .page-shell {
    padding-top: 0.38rem;
    padding-bottom: 0.25rem;
  }

  .overview {
    margin-bottom: 0.48rem;
  }

  .overview .eyebrow {
    margin-top: 0;
    margin-bottom: 0.12rem;
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .overview h1 {
    margin-top: 0;
    margin-bottom: 0.12rem;
    font-size: clamp(1.95rem, 2.55vw, 2.35rem);
    line-height: 1.02;
  }

  .overview > p,
  .overview__description {
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.22;
  }

  /*
   * Indicadores resumidos mais compactos.
   */
  .metrics {
    margin-top: 0.42rem;
  }

  .metric {
    min-height: 58px;
    padding-top: 0.46rem;
    padding-bottom: 0.46rem;
  }

  .metric__label,
  .metric > span:first-child {
    margin-bottom: 0.12rem;
    line-height: 1.1;
  }

  .metric__value,
  .metric strong {
    line-height: 1.05;
  }

  /*
   * Cabeçalho do painel Last Heard.
   */
  .data-panel__header {
    min-height: 54px;
    padding-top: 0.48rem;
    padding-bottom: 0.46rem;
  }

  .data-panel__header h2 {
    margin-top: 0;
    margin-bottom: 0.1rem;
    line-height: 1.08;
  }

  .data-panel__header p {
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.15;
  }

  .data-panel__header .button,
  .data-panel__header button {
    min-height: 38px;
    padding-top: 0.42rem;
    padding-bottom: 0.42rem;
  }

  /*
   * Área dos filtros.
   */
  .controls {
    padding-top: 0.48rem;
    padding-bottom: 0.52rem;
    gap: 0.62rem;
  }

  .controls label {
    margin-bottom: 0.18rem;
    line-height: 1.1;
  }

  .controls input,
  .controls select {
    min-height: 38px;
    height: 38px;
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
  }

  /*
   * Pequeno ajuste do rodapé para maximizar a tabela.
   */
  .site-footer {
    padding-top: 0.12rem;
    padding-bottom: 0.28rem;
  }

  .site-footer p {
    margin-top: 0;
    margin-bottom: 0.04rem;
    line-height: 1.15;
  }
}

/* END LASTHEARD COMPACT TOP */

/* BEGIN LASTHEARD COMPACT CONTROLS */

@media (min-width: 1100px) and (min-height: 700px) {
  /*
   * Compactação da área de pesquisa e filtros.
   */
  .controls {
    padding-top: 0.32rem;
    padding-bottom: 0.34rem;
    gap: 0.55rem;
  }

  .controls > div,
  .controls .control,
  .controls .form-group {
    gap: 0.12rem;
  }

  .controls label {
    margin: 0 0 0.1rem;
    font-size: 0.66rem;
    line-height: 1;
  }

  .controls input,
  .controls select {
    height: 32px;
    min-height: 32px;
    padding-top: 0.24rem;
    padding-bottom: 0.24rem;
    font-size: 0.78rem;
    line-height: 1.1;
    border-radius: 8px;
  }

  .controls input {
    padding-left: 2rem;
  }

  .controls select {
    padding-left: 0.65rem;
    padding-right: 1.8rem;
  }

  /*
   * Ajuste do ícone da pesquisa à nova altura.
   */
  .search-field,
  .search-control,
  .input-with-icon {
    position: relative;
  }

  .search-field svg,
  .search-control svg,
  .input-with-icon svg,
  .controls input + svg,
  .controls svg {
    width: 14px;
    height: 14px;
  }

  /*
   * Evita que o texto de ajuda ou outros elementos
   * aumentem desnecessariamente a altura desta área.
   */
  .controls small,
  .controls .help-text {
    margin: 0;
    font-size: 0.64rem;
    line-height: 1;
  }
}

/* END LASTHEARD COMPACT CONTROLS */

/* BEGIN LASTHEARD REMOVE TABLE FOOTER */

/*
 * Remove a faixa inferior redundante da tabela.
 * O espaço libertado passa automaticamente para os registos.
 */
.table-footer {
  display: none !important;
}

/* END LASTHEARD REMOVE TABLE FOOTER */

/* BEGIN LASTHEARD UNIFIED PROJECT LAYOUT */

/*
 * Estrutura visual alinhada com as restantes páginas
 * BrandMeister Portugal.
 *
 * Este bloco não altera a distribuição, as larguras ou
 * o conteúdo das 17 colunas da tabela.
 */

:root {
  --layout-line: var(--slate-200);
  --layout-surface: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --navy-950: #e8eef5;
  --navy-900: #163b5c;
  --navy-800: #8bcaf0;

  --blue-700: #65b5e3;
  --blue-100: #193548;
  --cyan-500: #5bc5d0;

  --green-700: #55c98b;
  --green-100: #153526;

  --amber-700: #e2b45e;
  --amber-100: #3a2b12;

  --red-700: #ff8b84;
  --red-100: #3a1c1a;

  --slate-900: #e8eef5;
  --slate-700: #c4d0dc;
  --slate-600: #9fb0c3;
  --slate-500: #8193a6;
  --slate-300: #465a70;
  --slate-200: #2b3a4c;
  --slate-100: #202c3a;

  --white: #151e2a;
  --surface: #0d131c;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.25);

  --layout-line: #2b3a4c;
  --layout-surface: rgba(21, 30, 42, 0.92);
}

html,
body {
  background-color: var(--surface);
}

body {
  background:
    radial-gradient(
      circle at 8% 0%,
      color-mix(in srgb, var(--blue-700) 10%, transparent),
      transparent 30rem
    ),
    var(--surface);
}

/*
 * Cabeçalho comum às páginas do projeto.
 */

.topo {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--layout-line);
  background: var(--layout-surface);
  backdrop-filter: blur(14px);
}

.topo-conteudo,
.page-shell,
.site-footer {
  width: min(calc(100% - 2rem), 1920px);
  margin-inline: auto;
}

.topo-conteudo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  padding-block: 0.72rem;
  gap: 1.25rem;
}

.topo-identidade {
  min-width: 0;
}

.marca {
  margin: 0 0 0.12rem;
  color: var(--blue-700);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topo h1 {
  margin: 0 0 0.08rem;
  color: var(--navy-950);
  font-size: clamp(1.72rem, 3vw, 2.35rem);
  line-height: 1.03;
  letter-spacing: -0.04em;
}

.subtitulo {
  margin: 0;
  color: var(--slate-600);
  font-size: 0.88rem;
}

.topo-acoes {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.topo-ligacoes {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  margin-right: 0.25rem;
}

.topo-ligacoes a {
  padding: 0.48rem 0.55rem;
  border-radius: 0.5rem;
  color: var(--slate-700);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.topo-ligacoes a:hover,
.topo-ligacoes a:focus-visible {
  color: var(--blue-700);
  background: var(--blue-100);
  outline: none;
}

.topo .connection {
  min-height: 40px;
  margin-top: 0;
  background: var(--white);
}

.topo .refresh-button {
  min-height: 40px;
  padding: 0.46rem 0.7rem;
  background: var(--white);
}

.theme-button {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--slate-300);
  border-radius: 50%;
  color: var(--navy-800);
  background: var(--white);
  cursor: pointer;
}

.theme-button:hover {
  border-color: var(--blue-700);
  color: var(--blue-700);
}

.theme-button:focus-visible {
  outline: 3px solid
    color-mix(in srgb, var(--blue-700) 34%, transparent);
  outline-offset: 3px;
}

.theme-button__dark {
  display: none;
}

html[data-theme="dark"] .theme-button__light {
  display: none;
}

html[data-theme="dark"] .theme-button__dark {
  display: inline;
}

/*
 * Compactação do início da área de conteúdo.
 */

.page-shell {
  padding-top: 0.72rem;
}

.overview {
  margin-bottom: 0.55rem;
}

.metrics {
  margin-top: 0;
  background: var(--layout-surface);
}

.data-panel,
.controls,
.table-footer,
input,
select,
.refresh-button,
.theme-button {
  border-color: var(--layout-line);
}

.data-panel {
  background: var(--white);
}

.data-panel__header {
  min-height: 52px;
  padding-top: 0.48rem;
  padding-bottom: 0.46rem;
}

/*
 * Tema escuro.
 */

html[data-theme="dark"] .controls,
html[data-theme="dark"] .table-footer {
  background: #101823;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select {
  color: var(--slate-900);
  background: #151e2a;
}

html[data-theme="dark"] tbody tr:nth-child(even) {
  background: #111a25;
}

html[data-theme="dark"] tbody tr:hover {
  background: #193548;
}

html[data-theme="dark"] .row--progress {
  background: #12313a;
}

html[data-theme="dark"] .message-row td {
  background: var(--white) !important;
}

html[data-theme="dark"] .chip--blue {
  color: #9bd3f4;
  background: #193548;
  border-color: #2e627f;
}

html[data-theme="dark"] .chip--green {
  color: #7bddaa;
  background: #153526;
  border-color: #286548;
}

html[data-theme="dark"] .chip--amber {
  color: #f1c978;
  background: #3a2b12;
  border-color: #6a4d1b;
}

html[data-theme="dark"] .chip--red {
  color: #ffaaa5;
  background: #3a1c1a;
  border-color: #6d302c;
}

html[data-theme="dark"] .state-pill--ended {
  color: #b9c7d5;
  background: #202c3a;
}

html[data-theme="dark"] .site-footer {
  color: var(--slate-600);
}

/*
 * Adaptação a ecrãs mais estreitos.
 */

@media (max-width: 1050px) {
  .topo-ligacoes {
    display: none;
  }
}

@media (max-width: 760px) {
  .topo-conteudo {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    gap: 0.65rem;
  }

  .topo-acoes {
    width: 100%;
    flex-wrap: wrap;
  }

  .topo .connection {
    margin-right: auto;
  }

  .page-shell {
    padding-top: 0.65rem;
  }
}

@media (max-width: 480px) {
  .topo-conteudo,
  .page-shell,
  .site-footer {
    width: min(calc(100% - 1rem), 1920px);
  }

  .topo h1 {
    font-size: 1.62rem;
  }

  .subtitulo {
    font-size: 0.8rem;
  }

  .topo .refresh-button span {
    display: none;
  }
}

/* END LASTHEARD UNIFIED PROJECT LAYOUT */

/* BEGIN LASTHEARD DARK TABLE CONTRAST FIX */

/*
 * Algumas regras antigas aplicam o fundo diretamente às células,
 * não apenas às linhas. Por esse motivo, o tema escuro tem de
 * definir explicitamente o fundo de cada td.
 */

html[data-theme="dark"] .table-frame,
html[data-theme="dark"] table,
html[data-theme="dark"] tbody {
  background-color: #0d1621 !important;
}

/*
 * Linhas ímpares.
 */

html[data-theme="dark"] tbody tr td {
  color: #e6edf5 !important;
  background-color: #121c28 !important;
  border-color: #2b3a4c !important;
}

/*
 * Linhas pares, mantendo a leitura alternada.
 */

html[data-theme="dark"] tbody tr:nth-child(even) td {
  color: #e6edf5 !important;
  background-color: #172331 !important;
}

/*
 * Destaque ao passar o ponteiro.
 */

html[data-theme="dark"] tbody tr:hover td {
  color: #ffffff !important;
  background-color: #1d3548 !important;
}

/*
 * Comunicação em curso.
 */

html[data-theme="dark"] tbody tr.row--progress td,
html[data-theme="dark"] tbody tr[data-state="progress"] td,
html[data-theme="dark"] tbody tr[data-state="in-progress"] td {
  color: #e7fff4 !important;
  background-color: #12313a !important;
}

/*
 * Comunicação perdida.
 */

html[data-theme="dark"] tbody tr.row--lost td,
html[data-theme="dark"] tbody tr[data-state="lost"] td {
  color: #ffe9e7 !important;
  background-color: #2c1b20 !important;
}

/*
 * Mensagens e estados sem dados.
 */

html[data-theme="dark"] tbody tr.message-row td,
html[data-theme="dark"] tbody tr.empty-row td {
  color: #c4d0dc !important;
  background-color: #151e2a !important;
}

/*
 * Garante contraste nos campos sem etiqueta própria.
 */

html[data-theme="dark"] tbody td:first-child,
html[data-theme="dark"] tbody td .mono {
  color: #e6edf5;
}

html[data-theme="dark"] tbody td a:not(.chip) {
  color: #8bd0f6;
}

/*
 * Preserva as cores específicas das etiquetas.
 */

html[data-theme="dark"] tbody .chip--blue {
  color: #a6dcfa !important;
  background-color: #193b52 !important;
  border-color: #347092 !important;
}

html[data-theme="dark"] tbody .chip--green {
  color: #8be3b6 !important;
  background-color: #153b29 !important;
  border-color: #34785a !important;
}

html[data-theme="dark"] tbody .chip--amber {
  color: #f4cd7d !important;
  background-color: #3a2b12 !important;
  border-color: #76571f !important;
}

html[data-theme="dark"] tbody .chip--red {
  color: #ffaaa5 !important;
  background-color: #401e1c !important;
  border-color: #813b36 !important;
}

html[data-theme="dark"] tbody .state-pill--ended {
  color: #c6d2de !important;
  background-color: #243242 !important;
}

html[data-theme="dark"] tbody .state-pill--progress {
  color: #80e3ae !important;
  background-color: #153b29 !important;
}

html[data-theme="dark"] tbody .state-pill--lost {
  color: #ff9690 !important;
  background-color: #431f1d !important;
}

/* END LASTHEARD DARK TABLE CONTRAST FIX */
