[hidden] { display: none !important; }

#app {
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1f2933;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  overflow: hidden;
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 10px 16px;
  background: #12384f;
  color: #fff;
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

#status {
  font-size: 13px;
  color: #bcd6e3;
}

/* --- Mode tabs --- */
.mode-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 3px;
}

.mode-tabs .tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #cfe3ee;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.mode-tabs .tab:hover {
  color: #fff;
}

.mode-tabs .tab.active {
  background: #fff;
  color: #12384f;
}

/* --- Auth area --- */
.auth-area {
  display: flex;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

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

.btn:disabled:hover {
  background: transparent;
}

.btn-ghost {
  border-color: transparent;
  padding: 5px 8px;
  color: #bcd6e3;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

#map {
  height: 600px;
}

/* --- Cell popup --- */
.cell-popup .leaflet-popup-content {
  margin: 10px 12px;
  width: 280px !important;
}

.popup-header,
.cell-popup a.popup-header:link,
.cell-popup a.popup-header:visited {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  word-break: break-all;
  color: inherit;
  text-decoration: none;
}

/* Leaflet's own CSS styles all `.leaflet-container a` links blue - these
   selectors need to be scoped/specific enough to win over that. */
.cell-popup a.popup-header:hover,
.cell-popup .md-title a:hover {
  text-decoration: underline;
  color: #2c7fb8;
}

.cell-popup .md-title a,
.cell-popup .md-title a:link,
.cell-popup .md-title a:visited {
  color: inherit;
  text-decoration: none;
}

.popup-subheader {
  font-size: 11px;
  color: #616e7c;
  margin-bottom: 8px;
}

.popup-loading, .popup-empty, .popup-error {
  font-size: 12px;
  color: #616e7c;
  padding: 6px 0;
}

.popup-error {
  color: #b3261e;
}

.md-block {
  border-top: 1px solid #e4e7eb;
  padding-top: 8px;
  margin-top: 8px;
}

.md-block:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.md-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.md-badge {
  font-size: 10px;
  font-weight: 500;
  color: #12384f;
  background: #d7ecf5;
  border-radius: 3px;
  padding: 1px 6px;
}

.md-chart-wrap {
  position: relative;
  height: 110px;
  width: 100%;
}

.md-footer {
  font-size: 10px;
  color: #9aa5b1;
  margin-top: 2px;
  text-align: right;
}

/* --- Track layer control --- */
.track-layers-actions {
  border-top: 1px solid #e4e7eb;
  margin-top: 6px;
  padding-top: 6px;
  text-align: right;
}

.track-layers-deselect-all {
  font-size: 11px;
  color: #2c7fb8;
  cursor: pointer;
  text-decoration: none;
}

.track-layers-deselect-all:hover {
  text-decoration: underline;
}

/* --- Track start/end markers --- */
.track-endpoint-icon {
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(15, 30, 40, 0.4);
}

.track-start-icon {
  background: #1a73e8;
  border-radius: 50%;
}

.track-end-icon {
  background: #e6194b;
  border-radius: 3px;
}

/* --- Track tooltip (hover) --- */
.track-tooltip-wrap.leaflet-tooltip {
  background: #fff;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(15, 30, 40, 0.15);
  padding: 8px 10px;
  opacity: 1;
}

.track-tooltip {
  font-size: 12px;
  color: #1f2933;
}

.track-tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.track-tooltip-row {
  color: #616e7c;
  margin-top: 2px;
  line-height: 1.35;
}

/* --- Single track-point popup --- */
.point-obs-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 4px 0;
  border-top: 1px solid #e4e7eb;
}

.point-obs-row:first-of-type {
  border-top: none;
}

.point-obs-label {
  font-weight: 500;
}

.point-obs-value {
  color: #616e7c;
  white-space: nowrap;
}
