:root { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: #f4f5f7; color: #1c222b; }
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: #1c222b; color: #fff; }
header h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: 0.2px; }
header a { color: #cbd5e1; text-decoration: none; font-size: 13px; }
header a:hover { color: #fff; }
nav.subnav { display: flex; gap: 2px; background: #2a3342; padding: 0 12px; }
nav.subnav a { color: #9aa5b5; text-decoration: none; font-size: 13px; padding: 10px 14px; display: inline-block; border-bottom: 2px solid transparent; }
nav.subnav a:hover { color: #fff; }
nav.subnav a.active { color: #fff; border-bottom-color: #2563eb; }
main { padding: 16px; max-width: 1800px; margin: 0 auto; }
.panel { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; margin: 0 0 10px; font-weight: 600; }
form.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select, input[type=file], input[type=text], input[type=number], button { font-size: 13px; padding: 7px 10px; border: 1px solid #d7dbe0; border-radius: 6px; background: #fff; }
button { background: #2563eb; color: #fff; border: none; cursor: pointer; font-weight: 600; }
button:hover { background: #1d4ed8; }
button.secondary { background: #fff; color: #374151; border: 1px solid #d7dbe0; }
button.secondary:hover { background: #f3f4f6; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
.stat { font-size: 13px; color: #4b5563; }
.stat b { color: #111827; }
.error { color: #b91c1c; font-size: 13px; }
.hint { color: #6b7280; font-size: 12px; margin-top: 4px; }
#map { height: 62vh; border-radius: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: #4b5563; margin-top: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eef0f2; }
table.data-table th { color: #6b7280; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
table.data-table tr:hover td { background: #f8fafc; }
a.link { color: #2563eb; text-decoration: none; }
a.link:hover { text-decoration: underline; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.intra { background: #dcfce7; color: #166534; }
.badge.inter { background: #fef3c7; color: #92400e; }
.badge.manual { background: #e0e7ff; color: #3730a3; }
.badge.rejected { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.cp-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eef0f2; font-size: 13px; }
.cp-row:last-child { border-bottom: none; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }

.sites-split { display: flex; gap: 16px; align-items: stretch; }
.map-pane { flex: 2 1 0; min-width: 0; }
.map-pane #map { height: 72vh; }
.list-pane { flex: 1 1 0; min-width: 280px; display: flex; flex-direction: column; }
.list-pane input[type=text] { width: 100%; }
.upload-box { border-bottom: 1px solid #eef0f2; padding-bottom: 10px; margin-bottom: 10px; }
.upload-box form.upload-row { flex-direction: column; align-items: stretch; }
.cell-card-list { overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; }
.cell-card { border: 1px solid #eef0f2; border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: background 0.1s, border-color 0.1s; }
.cell-card:hover { background: #f8fafc; border-color: #d7dbe0; }
.cell-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cell-card-name { font-weight: 600; font-size: 13px; }
.cell-card-az { font-size: 12px; color: #2563eb; font-weight: 600; }
.cell-card-meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.tech-badge-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tech-badge { color: #fff; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 999px; letter-spacing: 0.2px; }
@media (max-width: 860px) {
  .sites-split { flex-direction: column; }
  .map-pane #map { height: 50vh; }
  .cell-card-list { max-height: 50vh; }
}

/* Route shape points (trip.php) stay almost invisible until hovered, so a dense road-followed
   route doesn't look like a chain of beads - the line itself is always visible, these are just
   the drag handles. */
.route-vertex-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid #2563eb; opacity: 0; transition: opacity 0.15s; }
.route-vertex-marker:hover .route-vertex-dot { opacity: 1; }

details#waypoint-details { margin-top: 8px; font-size: 13px; }
details#waypoint-details summary { cursor: pointer; color: #374151; font-weight: 600; }
details#waypoint-details #waypoint-list { margin-top: 6px; line-height: 1.6; }

.signal-legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #4b5563; }
.signal-gradient-bar { width: 160px; height: 10px; border-radius: 5px; background: linear-gradient(to right, #06b6d4, #16a34a, #f59e0b, #dc2626); }

/* Per-reading hover/click detail (index.php's Readings map, trip_view.php's Trip results map) -
   capped height + scroll so a ~20-column CSV row never runs off the screen; the priority-ordered
   fields (signal, band, etc.) land above the fold without scrolling. */
.leaflet-tooltip.reading-tooltip, .leaflet-popup.reading-tooltip .leaflet-popup-content-wrapper { max-width: 260px; }
.leaflet-popup.reading-tooltip .leaflet-popup-content { margin: 10px 12px; }
.reading-table-scroll { max-height: 45vh; overflow-y: auto; }
.reading-table { font-size: 12px; border-collapse: collapse; width: 100%; }
.reading-table td { padding: 2px 8px 2px 0; white-space: nowrap; }
.reading-field { color: #6b7280; }

/* Trip results map's base-station/sector overlay (2026-10-31) - the wedge is a fixed CSS pixel
   size via a divIcon rather than a geo-scaled shape, so it stays a constant, legible size at any
   zoom instead of shrinking to a sliver when zoomed out over a long route. Leaflet's default
   divIcon chrome (white box + border) is reset since the wedge draws its own shape via clip-path. */
.sector-wedge-icon { background: transparent; border: none; }
/* A true circular sector (pie-slice) rather than a straight-sided triangle (2026-10-31 explicit
   request: "this figure has farther side round-shaped") - the far edge is the arc of a circle of
   radius = the wedge's own height, centered on the apex (50% 0%), sampled every 5 degrees across
   a 60 degree span (+/-30 degrees) to read as smoothly curved rather than faceted. */
.sector-wedge {
  clip-path: polygon(
    50% 0%,
    0% 86.6%, 7.74% 90.63%, 15.8% 93.97%, 24.12% 96.59%, 32.64% 98.48%, 41.28% 99.62%,
    50% 100%,
    58.72% 99.62%, 67.36% 98.48%, 75.88% 96.59%, 84.2% 93.97%, 92.26% 90.63%, 100% 86.6%
  );
  transform-origin: 50% 0%;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.1s;
}
.sector-wedge:hover { opacity: 0.75; }
.sector-wedge.highlighted { opacity: 0.9; filter: drop-shadow(0 0 2px #111827); }
.station-label.leaflet-tooltip {
  background: none; border: none; box-shadow: none; padding: 0;
  font-size: 11px; font-weight: 700; color: #14532d;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 4px #fff;
}
.station-label.leaflet-tooltip::before { display: none; }
