:root {
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #16263a;
  --muted: #5a728a;
  --line: #d6e1ec;
  --primary: #1f5f96;
  --primary-2: #174a74;
  --ok: #1e9a4d;
  --warn: #b38317;
  --bad: #bf3e3e;
  --tile-panel-max-h: clamp(300px, 54vh, 560px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eaf1f8 0%, var(--bg) 140px, var(--bg) 100%);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #c7d6e5;
  background: rgba(244, 248, 252, 0.96);
  backdrop-filter: blur(6px);
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f81c0, #1f5f96);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.15;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tabs a {
  text-decoration: none;
  border: 1px solid #b8cadc;
  background: #f6f9fc;
  color: #244461;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
}

.tabs a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.userbox {
  text-align: right;
}

.userbox .name {
  font-size: 13px;
  font-weight: 800;
}

.userbox .email {
  font-size: 11px;
  color: var(--muted);
}

.userbox .logout {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  color: #2b5f8b;
}

.layout {
  max-width: 1320px;
  margin: 10px auto 20px;
  padding: 0 14px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}

body.page-home {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.page-home .topbar {
  flex: 0 0 auto;
}

body.page-home .layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  width: min(1560px, calc(100vw - 10px));
  max-width: none;
  padding: 0 6px calc(10px + env(safe-area-inset-bottom));
  margin: 8px auto 10px;
}

body.page-home #view-home {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(270px, 52%) minmax(220px, 1fr);
}

body.page-home #homeTopCard,
body.page-home #homeTileCard {
  min-height: 0;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

body.page-home #homeTopCard {
  display: flex;
  flex-direction: column;
}

body.page-home #homeTopCard .map-grid {
  flex: 1 1 auto;
  min-height: 0;
}

body.page-home #homeTopCard .map-panel,
body.page-home #homeTopCard .site-panel {
  min-height: 0;
  height: 100%;
  max-height: none;
}

body.page-home #homeTopCard .mapbox-host {
  height: 100%;
  min-height: 170px;
}

body.page-home #homeTileCard {
  display: flex;
  flex-direction: column;
}

body.page-home #homeTileCard > .row {
  flex: 0 0 auto;
}

body.page-home #homeTileCard .tile-history-shell,
body.page-home #homeTileCard .tile-history-panel,
body.page-home #homeTileCard .tile-workspace,
body.page-home #homeTileCard .tile-list-panel,
body.page-home #homeTileCard .tile-detail-panel {
  width: 100%;
  min-width: 0;
}

body.page-radar {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #000;
}

body.page-radar .layout {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
}

body.page-radar-og .public-radar-card,
body.page-radar-og .public-radar-timeline {
  display: none;
}

.public-radar-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.public-radar-map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  user-select: none;
  -webkit-user-select: none;
}

.public-radar-map.is-radar-visible {
  opacity: 1;
  pointer-events: auto;
}

.public-radar-map canvas {
  outline: none;
}

.public-radar-card {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2000;
  width: max-content;
  max-width: calc(100vw - 20px);
  border: 1px solid rgba(255, 244, 168, 0.2);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(12, 13, 8, 0.5), rgba(4, 8, 12, 0.32));
  color: #f4f8fb;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(18px) saturate(1.24);
  backdrop-filter: blur(18px) saturate(1.24);
  padding: 4px 6px;
}

.public-radar-brand {
  display: flex;
  gap: 9px;
  align-items: center;
}

.public-radar-brand h1 {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 10pt;
  font-style: italic;
  font-weight: 700;
  line-height: 1.1;
}

.public-radar-card .meta {
  color: #aebdcc;
}

.public-radar-sites {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.public-radar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(250, 220, 30, 0.34);
  border-radius: 999px;
  background: rgba(250, 220, 30, 0.08);
  color: #fff4a8;
  padding: 5px 8px;
  font-size: 11px;
}

.public-radar-chip.selected {
  box-shadow: 0 0 0 1px rgba(250, 220, 30, 0.18), 0 0 24px rgba(250, 220, 30, 0.08);
}

.public-radar-chip span {
  color: #d7cf95;
}

.public-radar-timeline {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 2000;
  width: min(820px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid rgba(250, 220, 30, 0.28);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 16, 4, 0.5), rgba(5, 5, 2, 0.34));
  color: #fff4a8;
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 236, 105, 0.12);
  -webkit-backdrop-filter: blur(20px) saturate(1.28);
  backdrop-filter: blur(20px) saturate(1.28);
  padding: 10px 12px;
}

.public-radar-timeline.has-stale-latest {
  border-color: rgba(255, 66, 66, 0.82);
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.34), 0 0 0 2px rgba(255, 66, 66, 0.26);
}

.public-radar-controls {
  display: grid;
  grid-template-columns: auto auto auto auto 1fr;
  gap: 8px;
  align-items: center;
}

.public-radar-timeline.is-shared-frame .public-radar-controls {
  display: none;
}

.public-radar-control {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 34px;
  border: 1px solid rgba(250, 220, 30, 0.36);
  border-radius: 10px;
  background: rgba(250, 220, 30, 0.07);
  color: #fff4a8;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.public-radar-control svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.public-radar-control svg.radar-spinner {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 42;
  stroke-dashoffset: 12;
  transform-origin: center;
  animation: radar-spinner 0.85s linear infinite;
}

.public-radar-control.play {
  min-width: 42px;
  background: #fadc1e;
  color: #050500;
}

.public-radar-control.play.loading {
  --radar-load-progress: 0%;
  background: linear-gradient(
    90deg,
    #fadc1e 0%,
    #fadc1e var(--radar-load-progress),
    rgba(250, 220, 30, 0.16) var(--radar-load-progress),
    rgba(250, 220, 30, 0.16) 100%
  );
  color: #fff4a8;
}

.public-radar-control.loading:disabled {
  cursor: wait;
  opacity: 1;
}

.public-radar-control:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.public-radar-site-marker {
  --site-marker-scale: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
  user-select: none;
}

.public-radar-site-marker-label {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: #062a61;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(6, 42, 97, 0.34);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
  transform: scale(var(--site-marker-scale));
  transform-origin: center;
  transition: transform 80ms linear;
  user-select: none;
  will-change: transform;
}

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

.public-radar-range {
  width: 100%;
  accent-color: #fadc1e;
  cursor: pointer;
  touch-action: pan-x;
}

.public-radar-range:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.public-radar-frame-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  color: #d7cf95;
  font-size: 12px;
}

#publicRadarFrameCount {
  color: #fff4a8;
  font-variant-numeric: tabular-nums;
}

.public-radar-warning {
  margin-bottom: 8px;
  border: 1px solid rgba(255, 66, 66, 0.75);
  border-radius: 8px;
  background: rgba(130, 0, 0, 0.72);
  color: #fff;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.public-radar-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.public-radar-actions[hidden],
.public-radar-warning[hidden] {
  display: none;
}

.public-radar-actions a.btn,
.public-radar-live-btn {
  text-decoration: none;
  border: 1px solid rgba(250, 220, 30, 0.48);
  border-radius: 8px;
  background: #fadc1e;
  color: #050500;
  cursor: pointer;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.view-section {
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 6px 18px rgba(15, 36, 56, 0.05);
}

.panel {
  padding: 10px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row h2,
.row h3 {
  margin: 0;
}

.active-sites-top {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#selectedSiteGrid {
  margin-top: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.selected-site-panel {
  margin-top: 4px;
  max-height: 82px;
  overflow: hidden;
  transition: max-height 0.18s ease, opacity 0.18s ease;
  opacity: 1;
}

#selectedSiteGrid .summary-field {
  min-height: 76px;
  max-height: 76px;
  overflow: hidden;
}

#selectedSiteGrid .summary-field .v {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#homeWsMeta {
  margin-top: 4px;
}

#homeProgressList {
  margin-top: 6px;
  max-height: 90px;
  overflow: auto;
  gap: 6px;
}

#homeProgressList .summary-item {
  padding: 6px 8px;
}

#homeProgressList .summary-item .sub {
  font-size: 11px;
}

.active-sites-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 800;
}

.active-sites-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.active-site-chip {
  border-radius: 999px;
  border: 1px solid #bde8cc;
  background: #e5f7ed;
  color: #186a37;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  cursor: pointer;
}

.active-site-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.summary-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.summary-field {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  padding: 8px 9px;
}

.summary-field .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-field .v {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 800;
  color: #22394f;
  word-break: break-word;
}

.summary-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fbfdff;
}

.summary-item .title {
  font-weight: 800;
  font-size: 13px;
}

.summary-item .sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-2);
}

.btn-secondary {
  background: #f2f7fc;
  color: #2e4f6f;
  border-color: #bccfe1;
}

.btn-secondary:hover:not(:disabled) {
  background: #e7f0f8;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  font-size: 12px;
  color: #4f667d;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.field-inline select {
  border: 1px solid #c8d7e6;
  border-radius: 8px;
  background: #fff;
  color: #1f3348;
  padding: 7px 9px;
  font-size: 13px;
}

.field textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.4;
  resize: vertical;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4f667d;
  font-weight: 700;
}

.map-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 10px;
  align-items: start;
}

.map-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #dce8f4;
  position: relative;
}

.mapbox-host {
  height: clamp(320px, 56vh, 620px);
  width: 100%;
  background: #0a0d12;
}

.mapbox-host.radar-black-bg {
  background: #000;
}

.radar-toolbox {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: min(440px, calc(100% - 20px));
  border: 1px solid #213243;
  border-radius: 10px;
  background: rgba(8, 13, 20, 0.86);
  color: #f0f6ff;
  backdrop-filter: blur(3px);
  z-index: 12;
  box-shadow: 0 4px 18px rgba(6, 10, 16, 0.55);
}

.radar-toolbox .toolbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(150, 185, 220, 0.25);
}

.radar-toolbox .toolbox-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.toolbox-collapse {
  border: 1px solid rgba(177, 203, 231, 0.45);
  border-radius: 6px;
  background: rgba(23, 39, 56, 0.96);
  color: #dcecff;
  width: 30px;
  height: 22px;
  line-height: 1;
  font-size: 15px;
  cursor: pointer;
}

.toolbox-collapse:hover {
  background: rgba(30, 51, 73, 0.96);
}

.radar-toolbox .toolbox-body {
  padding: 7px 8px 8px;
  display: grid;
  gap: 7px;
  max-height: min(46vh, 360px);
  overflow: auto;
}

.radar-toolbox.toolbox-collapsed .toolbox-body {
  display: none;
}

.radar-toolbox .tool-row {
  display: grid;
  gap: 5px;
}

.radar-toolbox .meta {
  color: #b8cee4;
}

.radar-toolbox .tool-label {
  font-size: 11px;
  color: #b8cee4;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

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

.mode-switch .mode-btn {
  border: 1px solid rgba(154, 183, 213, 0.45);
  border-radius: 8px;
  background: rgba(27, 46, 67, 0.95);
  color: #d7e8fa;
  padding: 6px 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mode-switch .mode-btn.active {
  background: #1f5f96;
  border-color: #2f89d5;
  color: #fff;
}

.frame-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
}

.frame-btn {
  min-width: 38px;
  padding: 6px 8px;
}

#radarFrameRange,
#radarStackDepthRange,
#radarStackOpacityRange,
#radarPitchRange {
  width: 100%;
}

.tool-checks {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.tool-checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #dcecff;
}

.tool-row.is-hidden {
  display: none;
}

.site-marker {
  border: 1px solid rgba(15, 32, 52, 0.7);
  border-radius: 999px;
  background: rgba(245, 251, 255, 0.96);
  color: #17324c;
  padding: 2px 8px 2px 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(6, 20, 34, 0.35);
  cursor: pointer;
}

.site-marker .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #1e9a4d;
  box-shadow: 0 0 0 1px rgba(13, 56, 30, 0.5);
}

.site-marker.inactive .dot {
  background: #b38317;
  box-shadow: 0 0 0 1px rgba(92, 68, 10, 0.45);
}

.site-marker.selected {
  border-color: #1f5f96;
  background: rgba(220, 239, 255, 0.98);
  color: #0f2c46;
}

.site-marker.site-label-hidden {
  padding-right: 4px;
}

.site-marker.site-label-hidden .text {
  display: none;
}

.site-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  padding: 8px;
  min-height: 180px;
  max-height: clamp(280px, 56vh, 620px);
  overflow: auto;
}

.tile-history-toggle-wrap {
  display: none;
}

#homeTileCard {
  position: relative;
}

.tile-history-shell {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 12px;
  padding-top: 0;
}

.tile-history-shell.collapsed {
  flex: 0 0 auto;
  margin-top: 0;
}

.tile-history-toggle {
  position: absolute;
  left: 50%;
  top: 42px;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 58px;
  height: 24px;
  border: 1px solid #bccfe1;
  border-radius: 6px;
  background: #f2f7fc;
  color: #2e4f6f;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tile-history-toggle:hover {
  background: #e7f0f8;
}

.tile-history-panel {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  transition: height 0.2s ease, opacity 0.2s ease;
  opacity: 1;
}

.tile-history-panel.collapsed {
  height: 0 !important;
  opacity: 0;
  overflow: hidden;
  border-bottom-width: 0;
}

body.page-home #view-home.tile-history-collapsed {
  grid-template-rows: minmax(0, 1fr) auto;
}

body.page-home #homeTileCard.tile-history-collapsed {
  min-height: 48px;
  height: auto;
}

.tile-workspace {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(280px, 31%) minmax(0, 1fr);
  gap: 10px;
  max-height: var(--tile-panel-max-h);
  height: 100%;
  min-height: 0;
  padding: 8px;
}

.tile-list-panel,
.tile-detail-panel {
  border: 1px solid #cfdbe7;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  max-height: var(--tile-panel-max-h);
  height: 100%;
  overflow: auto;
  min-height: 0;
}

#tileRenderList {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.tile-button {
  width: 100%;
  border: 1px solid #c4d5e6;
  background: #fff;
  border-radius: 8px;
  text-align: left;
  padding: 7px;
  cursor: pointer;
}

.tile-button.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  background: #eef5fd;
}

.render-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  display: grid;
  gap: 3px;
}

.render-row .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.render-row .meta-line {
  font-size: 11px;
  color: var(--muted);
}

.render-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.render-head-text {
  font-size: 12px;
  min-width: 0;
}

.render-thumb-btn {
  border: 1px solid #253342;
  border-radius: 8px;
  padding: 0;
  background: #000;
  cursor: pointer;
  line-height: 0;
}

.render-thumb-box {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.render-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(1.25);
  display: block;
}

.render-thumb-box.no-image {
  border: 1px dashed #5c6772;
}

.render-preview-stage {
  margin-top: 8px;
  border: 1px solid #253342;
  border-radius: 10px;
  background: #000;
  min-height: 132px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.render-preview-frame {
  width: 100%;
  min-height: 132px;
  display: grid;
  place-items: center;
  background: #000;
}

.render-preview-frame img {
  width: 100%;
  max-height: 176px;
  height: 176px;
  object-fit: cover;
  object-position: 50% 50%;
  filter: contrast(1.25) saturate(1.15);
  display: block;
}

.site-button {
  width: 100%;
  border: 1px solid #c4d5e6;
  background: #fff;
  border-radius: 8px;
  text-align: left;
  padding: 7px;
  cursor: pointer;
}

.site-button.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  background: #eef5fd;
}

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.site-active-btn {
  min-width: 86px;
  white-space: nowrap;
  align-self: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.pill.ok {
  background: #e5f7ed;
  color: #186a37;
  border: 1px solid #bde8cc;
}

.pill.warn {
  background: #fff5df;
  color: #7f5d10;
  border: 1px solid #ecd8a0;
}

.pill.bad {
  background: #fdeaea;
  color: #912f2f;
  border: 1px solid #efc2c2;
}

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

.palette-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.palette-table th,
.palette-table td {
  border-bottom: 1px solid var(--line);
  padding: 6px;
  text-align: left;
}

.palette-table input[type="number"] {
  width: 100%;
}

.palette-table input[type="color"] {
  width: 42px;
  height: 30px;
  padding: 0;
  border: 1px solid #b9cce0;
  border-radius: 6px;
  background: #fff;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 1060px) {
  :root {
    --tile-panel-max-h: clamp(240px, 46vh, 430px);
  }

  body.page-home .layout {
    margin: 6px auto 8px;
    width: min(1400px, calc(100vw - 8px));
    padding: 0 4px 8px;
  }

  body.page-home #view-home {
    grid-template-rows: minmax(220px, 48%) minmax(180px, 1fr);
  }

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

  .site-panel {
    max-height: clamp(180px, 30vh, 240px);
    overflow: auto;
  }

  .radar-toolbox {
    width: min(430px, calc(100% - 16px));
    left: 8px;
    bottom: 8px;
  }

  .tile-workspace {
    grid-template-columns: 1fr;
  }

  #tileRenderList {
    max-height: 260px;
  }

  .mapbox-host {
    height: clamp(260px, 46vh, 520px);
  }

  #selectedSiteGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-site-panel {
    max-height: 160px;
  }
}

@media (max-width: 860px) {
  .public-radar-card {
    left: auto;
    right: 10px;
    top: 10px;
    width: max-content;
    max-width: calc(100vw - 20px);
  }

  .public-radar-timeline {
    bottom: 10px;
    width: calc(100vw - 20px);
    padding: 9px;
  }

  .public-radar-controls {
    grid-template-columns: auto auto auto auto;
  }

  .public-radar-range {
    grid-column: 1 / -1;
  }

  .public-radar-frame-line {
    flex-direction: column;
    gap: 4px;
  }

  body.page-home .layout {
    width: 100vw;
    margin: 0;
    padding: 0 0 calc(6px + env(safe-area-inset-bottom));
  }

  body.page-home #view-home {
    gap: 6px;
  }

  body.page-home .card {
    border-radius: 0;
    border-left-width: 0;
    border-right-width: 0;
  }

  body.page-home #homeTopCard,
  body.page-home #homeTileCard {
    padding-left: 8px;
    padding-right: 8px;
  }

  body.page-home #view-home {
    grid-template-rows: minmax(200px, 44%) minmax(160px, 1fr);
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .userbox {
    text-align: left;
  }

  .radar-toolbox {
    left: 6px;
    right: 6px;
    width: auto;
    bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .radar-toolbox .toolbox-body {
    max-height: min(40vh, 320px);
  }

  .mode-switch .mode-btn {
    font-size: 11px;
    padding: 6px 4px;
  }
}
