* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #101317;
  color: #e8eaed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  min-height: 76px;
  padding: 12px 20px;
  background: #181c21;
  border-bottom: 1px solid #2b3037;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logos {
  display: flex;
  gap: 7px;
}

.logos img {
  height: 42px;
  width: auto;
}

h1 {
  margin: 0;
  font-size: 22px;
}

.subtitle,
.muted,
.label {
  color: #9299a2;
  font-size: 12px;
}

.home-link {
  color: #aeb4bc;
  text-decoration: none;
}

main {
  max-width: 1400px;
  margin: auto;
  padding: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.card,
.panel {
  background: #181c21;
  border: 1px solid #2b3037;
  border-radius: 12px;
}

.card {
  padding: 16px;
}

.value {
  margin-top: 6px;
  font-size: 25px;
  font-weight: 700;
}

.value-small {
  font-size: 16px;
}

.panel {
  padding: 14px;
  margin-bottom: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.controls {
  display: flex;
  gap: 8px;
}

select {
  background: #24292f;
  color: #e8eaed;
  border: 1px solid #3a4048;
  border-radius: 7px;
  padding: 8px 10px;
}

#route-map {
  height: 430px;
  border-radius: 9px;
  overflow: hidden;
}

.desktop-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.station-item,
.message-item {
  padding: 10px 4px;
  border-top: 1px solid #292e35;
}

.station-item:first-child,
.message-item:first-child {
  border-top: 0;
}

.station-call,
.message-route {
  font-weight: 700;
}

.station-meta,
.message-meta {
  margin-top: 3px;
  color: #9299a2;
  font-size: 12px;
}

.message-text {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .desktop-columns {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #route-map {
    height: 330px;
  }
}

.subtitle {
  color: #ff4d4f;
  font-weight: 700;
}

.send-form label {
  display: block;
  margin: 10px 0 5px;
  color: #9299a2;
  font-size: 12px;
}

.send-form input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #3a4048;
  border-radius: 8px;
  background: #101317;
  color: #e8eaed;
  font-size: 15px;
}

.send-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 12px;
}

#send-count {
  color: #9299a2;
  font-size: 12px;
}

#send-button {
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  background: #d93a3a;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

#send-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.send-status {
  min-height: 18px;
  margin-top: 9px;
  color: #9299a2;
  font-size: 12px;
}

.send-status.ok {
  color: #7fdc8a;
}

.send-status.error {
  color: #ff7777;
}

#send-from {
  color: #ff4d4f;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-item {
  padding: 10px 12px;
  border: 1px solid #2b3037;
  border-radius: 9px;
}

.message-incoming {
  margin-right: 28px;
  background: #1d2228;
}

.message-outgoing {
  margin-left: 28px;
  background: #242a31;
}

.message-route {
  font-size: 12px;
  color: #9aa0a6;
  margin-bottom: 5px;
}

.message-text {
  font-size: 14px;
  color: #f0f2f4;
}

.message-status {
  font-weight: 700;
}

.status-acknowledged {
  color: #76d889;
}

.status-rejected,
.status-failed {
  color: #ff7777;
}

.status-sent,
.status-sending {
  color: #e5c66a;
}

.message-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.message-list::-webkit-scrollbar {
  width: 8px;
}

.message-list::-webkit-scrollbar-thumb {
  background: #3a4048;
  border-radius: 8px;
}

.message-list::-webkit-scrollbar-track {
  background: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logout-button {
  border: 1px solid #3a4048;
  border-radius: 7px;
  padding: 7px 11px;
  background: #24292f;
  color: #d7dbe0;
  cursor: pointer;
}

.logout-button:hover {
  background: #30363d;
  color: #fff;
}


/* Account email verification */

.verification-status {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  line-height: 1.4;
}

.verification-status.required {
  border: 1px solid rgba(255, 77, 79, .45);
  background: rgba(255, 77, 79, .08);
}

.verification-status.verified {
  border: 1px solid rgba(80, 200, 120, .4);
  background: rgba(80, 200, 120, .08);
}

.verification-button {
  margin-top: 10px;
  padding: 8px 12px;
  cursor: pointer;
}


/* ---------------------------------------------------------
   Station detail page
   --------------------------------------------------------- */

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.station-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.station-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.station-title-line h2 {
  margin: 0;
  font-size: 28px;
}

.station-state {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  background: #30363d;
}

.station-state.online {
  color: #77dd88;
  border: 1px solid #326d3c;
}

.station-state.offline {
  color: #ff7777;
  border: 1px solid #743c3c;
}

.station-last {
  text-align: right;
}

.station-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.station-tab {
  border: 1px solid #343a42;
  background: #181c21;
  color: #9299a2;
  border-radius: 8px;
  padding: 8px 14px;
}

.station-tab.active {
  color: #fff;
  border-color: #d93a3a;
}

.station-tab:disabled {
  opacity: .45;
}

.station-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(480px, 1.1fr);
  gap: 14px;
}

.station-detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 15px;
  padding: 9px 2px;
  border-top: 1px solid #292e35;
}

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

.station-detail-label {
  color: #9299a2;
  font-size: 12px;
}

.station-detail-value {
  overflow-wrap: anywhere;
}

.detail-secondary {
  display: block;
  margin-top: 2px;
  color: #727982;
  font-size: 11px;
}

#station-map {
  height: 520px;
  border-radius: 9px;
  overflow: hidden;
}

.lora-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.lora-value {
  margin-top: 5px;
  font-size: 24px;
  font-weight: 700;
}

.lora-value-small {
  font-size: 18px;
}


@media (max-width: 900px) {

  .station-layout {
    grid-template-columns: 1fr;
  }

  #station-map {
    height: 350px;
  }
}


@media (max-width: 600px) {

  .station-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .station-last {
    text-align: left;
  }

  .station-detail-row {
    grid-template-columns: 110px 1fr;
  }

  .lora-values {
    grid-template-columns: 1fr;
  }
}

.station-link {
  color: #e8eaed;
  text-decoration: none;
}

.station-link:hover {
  color: #5cc8ff;
  text-decoration: underline;
}

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

#track-map {
  height: 520px;
  border-radius: 9px;
  overflow: hidden;
}

.station-hero[hidden],
.station-layout[hidden] {
  display: none !important;
}

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

.track-action {
  background: #24292f;
  color: #e8eaed;
  border: 1px solid #3a4048;
  border-radius: 7px;
  padding: 8px 11px;
  cursor: pointer;
}

.track-action:hover {
  border-color: #5cc8ff;
}

@media (max-width: 900px) {
  .track-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.rf-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.rf-chart {
  margin-top: 8px;
  min-height: 220px;
  background: #101317;
  border: 1px solid #2b3037;
  border-radius: 9px;
  overflow: hidden;
}

.rf-chart svg {
  display: block;
  width: 100%;
  height: 220px;
}

.rf-receiver-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 2px;
  border-top: 1px solid #292e35;
}

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

@media (max-width: 900px) {
  .rf-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .rf-charts {
    grid-template-columns: 1fr;
  }
}

.packet-item {
  padding: 12px 2px;
  border-top: 1px solid #292e35;
}

.packet-item:first-child {
  border-top: 0;
}

.packet-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 6px;
}

.packet-time {
  color: #9299a2;
  font-size: 12px;
}

.packet-meta {
  color: #9299a2;
  font-size: 12px;
  margin-top: 3px;
}

.packet-raw {
  margin-top: 8px;
  padding: 9px 10px;
  background: #101317;
  border: 1px solid #2b3037;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.packet-toggle {
  margin-top: 7px;
  border: 0;
  padding: 0;
  background: none;
  color: #5cc8ff;
  cursor: pointer;
  font-size: 12px;
}

.packet-decoded {
  margin-top: 8px;
  padding: 9px 10px;
  background: #15191e;
  border-left: 3px solid #5cc8ff;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.55;
}

.packet-decoded strong {
  color: #bfc5cc;
}

.messages-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
}

.conversation-item {
  padding: 11px 6px;
  border-top: 1px solid #292e35;
  cursor: pointer;
}

.conversation-item:first-child {
  border-top: 0;
}

.conversation-item:hover,
.conversation-item.active {
  background: #20252b;
}

.conversation-call {
  font-weight: 700;
}

.conversation-preview {
  margin-top: 3px;
  color: #9299a2;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-messages {
  min-height: 420px;
  max-height: 600px;
  overflow-y: auto;
  padding: 8px 2px 18px;
}

.chat-row {
  display: flex;
  margin: 8px 0;
}

.chat-row.outgoing {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 75%;
  padding: 9px 11px;
  border-radius: 11px;
  background: #24292f;
}

.chat-row.outgoing .chat-bubble {
  background: #302326;
}

.chat-text {
  overflow-wrap: anywhere;
}

.chat-meta {
  margin-top: 4px;
  color: #9299a2;
  font-size: 10px;
}

.chat-status-ok {
  color: #77dd88;
}

.chat-status-warn {
  color: #e7c66a;
}

.chat-status-bad {
  color: #ff7777;
}

.conversation-compose {
  border-top: 1px solid #292e35;
  padding-top: 12px;
}

.conversation-compose-row {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}

.conversation-compose-row input {
  flex: 1;
  padding: 10px;
  border: 1px solid #3a4048;
  border-radius: 8px;
  background: #101317;
  color: #e8eaed;
}

.conversation-compose-row button {
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  background: #d93a3a;
  color: white;
  font-weight: 700;
}

.conversation-compose-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: #9299a2;
  font-size: 11px;
}

@media (max-width: 800px) {
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .conversation-messages {
    min-height: 300px;
  }
}

.rf-point {
  fill: #101317;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.rf-point:hover,
.rf-point:focus {
  r: 6;
  outline: none;
}

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

@media (max-width: 900px) {
  .rf-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
