:root {
  --font-sans: 'Source Han Sans SC', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;

  --bg-0: #ecf1f9;
  --bg-1: #f7faff;
  --bg-2: #dbe7f8;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --line: #cfd8ea;
  --line-strong: #b7c3db;
  --text-0: #102038;
  --text-1: #26395f;
  --text-2: #617292;

  --primary: #1f4fc9;
  --primary-2: #163f9f;
  --success: #178f53;
  --warning: #be6f15;
  --danger: #c62839;
  --danger-soft: #ffe8ec;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;

  --shadow-soft: 0 10px 30px rgba(18, 44, 102, 0.08);
  --shadow-panel: 0 18px 40px rgba(17, 43, 96, 0.13);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --ease-standard: cubic-bezier(0.2, 0.6, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-0);
  font-family: var(--font-sans);
  background: radial-gradient(120% 120% at 10% 0%, #f7fbff 0%, var(--bg-0) 45%, #d7e0f2 100%);
  position: relative;
  -webkit-tap-highlight-color: rgba(31, 79, 201, 0.12);
}

body.advice-drawer-open {
  overflow: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    radial-gradient(circle at 85% 12%, rgba(31, 79, 201, 0.18), transparent 38%),
    radial-gradient(circle at 12% 78%, rgba(7, 143, 97, 0.14), transparent 35%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
}

.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
  z-index: 20;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-2);
  text-decoration: none;
  box-shadow: var(--shadow-panel);
}

.skip-link:focus-visible {
  top: 1rem;
}

.app-header,
.app-footer,
.panel {
  animation: panelIn 420ms var(--ease-standard) both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-header {
  position: relative;
  z-index: 2;
  margin: 1rem auto 0.85rem;
  width: min(1920px, calc(100% - 2.5rem));
  display: grid;
  gap: 0.8rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.88));
  border: 1px solid rgba(183, 195, 219, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  padding: 0.9rem 1.2rem 0.95rem;
}

.header-shell {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.header-main,
.header-side {
  min-width: 0;
}

.header-kicker {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

.app-header h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.2rem, 1.7vw, 1.85rem);
  color: #0f2351;
  line-height: 1.1;
}

.header-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 0.95rem;
}

.header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.data-meta {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions {
  position: relative;
  z-index: 3;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-link,
.panel-link,
.overview-link {
  position: relative;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.52rem 0.88rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
  transition:
    transform 160ms var(--ease-standard),
    background-color 160ms var(--ease-standard),
    color 160ms var(--ease-standard),
    border-color 160ms var(--ease-standard),
    box-shadow 160ms var(--ease-standard);
}

.header-link:hover,
.panel-link:hover,
.overview-link:hover {
  transform: translateY(-1px);
}

.header-link-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #3b73f2);
  box-shadow: 0 10px 24px rgba(31, 79, 201, 0.22);
}

.header-link-secondary,
.panel-link,
.overview-link {
  color: var(--primary-2);
  border: 1px solid rgba(31, 79, 201, 0.22);
  background: rgba(255, 255, 255, 0.82);
}

.header-link:focus-visible,
.panel-link:focus-visible,
.overview-link:focus-visible {
  outline: 3px solid rgba(31, 79, 201, 0.2);
  outline-offset: 2px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(31, 79, 201, 0.25);
  background: rgba(31, 79, 201, 0.08);
  color: #12377d;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.26rem 0.62rem;
}

.dashboard {
  width: min(1920px, calc(100% - 2.5rem));
  margin: 0 auto 1rem;
  display: grid;
  gap: 0.9rem;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(183, 195, 219, 0.72);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 0.88rem;
  backdrop-filter: blur(6px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.panel-head-compact {
  margin-bottom: 0.65rem;
}

h2 {
  margin: 0;
  font-size: 1.12rem;
  color: #142c60;
  text-wrap: balance;
}

.panel-subline {
  margin: 0.22rem 0 0;
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.35;
}

.panel-badge {
  border-radius: 999px;
  border: 1px solid rgba(31, 79, 201, 0.22);
  padding: 0.18rem 0.6rem;
  font-size: 0.76rem;
  color: #12377d;
  background: rgba(31, 79, 201, 0.08);
}

#map-panel {
  display: grid;
  gap: var(--space-3);
}

.panel-map-compact {
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.panel-map-compact .panel-head {
  margin: 0;
  padding: 1rem 1rem 0;
}

.header-filterbar {
  display: flex;
  gap: 0.7rem;
  align-items: stretch;
  flex-wrap: wrap;
  border-top: 1px solid rgba(183, 195, 219, 0.72);
  padding-top: 0.78rem;
  scrollbar-width: thin;
}

.control-card {
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(31, 79, 201, 0.22);
  background: linear-gradient(115deg, rgba(31, 79, 201, 0.08), rgba(255, 255, 255, 0.74));
}

.control-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.control-title {
  font-weight: 700;
  color: #122f72;
  font-size: 0.95rem;
}

.control-inline {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.control-field {
  display: grid;
  gap: 0.25rem;
}

.control-field label {
  font-size: 0.76rem;
  color: var(--text-2);
}

.control-field input,
.control-field select,
.ov-query-field input,
.ov-query-field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--text-0);
  font-size: 0.86rem;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-sans);
  transition: border-color 180ms var(--ease-standard), box-shadow 180ms var(--ease-standard);
}

.control-field input:focus,
.control-field select:focus,
.ov-query-field input:focus,
.ov-query-field select:focus,
button:focus-visible,
.plane-link:focus-visible,
.stat-card:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 79, 201, 0.18);
}

.heatmap-toggle-btn {
  border: 1px solid rgba(16, 45, 113, 0.3);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #3369ee);
  transition: transform 120ms var(--ease-standard), filter 120ms var(--ease-standard);
}

.heatmap-toggle-btn:hover {
  filter: brightness(1.04);
}

.heatmap-toggle-btn:active {
  transform: translateY(1px);
}

.heatmap-toggle-btn.active {
  background: linear-gradient(135deg, #101f3f, #1a3468);
  border-color: #162b53;
}

.control-status {
  margin: 0.5rem 0 0;
  color: #314b7a;
  font-size: 0.83rem;
}

#map {
  width: 100%;
  height: clamp(460px, 58vh, 720px);
  border-radius: 0 0 14px 14px;
  overflow: hidden;
  border-top: 1px solid rgba(31, 79, 201, 0.12);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.map-error {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: #7f1424;
  font-weight: 700;
  background: rgba(255, 247, 248, 0.95);
}

.map-error.hidden,
.hidden {
  display: none !important;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgba(16, 45, 113, 0.26);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.45rem 0.75rem;
}

.legend-gradient {
  width: 170px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2363d9 0%, #31b8ff 40%, #f5d13d 74%, #c62839 100%);
}

.legend-scale {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #2f4778;
}

.route-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 177, 201, 0.95);
  background: rgba(255, 255, 255, 0.92);
  color: #1b315f;
  padding: 0.22rem 0.56rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.legend-chip::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-chip-route::before {
  background: #2563eb;
}

.legend-chip-emergency-route::before {
  background: #f97316;
}

.legend-chip-track::before {
  background: #16a34a;
}

.legend-chip-ov::before {
  background: #dc2626;
}

.map-hint {
  margin: 0;
  color: var(--text-2);
  font-size: 0.82rem;
}

.map-controls-br {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 8px;
  z-index: 10;
}

.map-fab {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(31, 79, 201, 0.35);
  background: rgba(255, 255, 255, 0.95);
  color: #1d386f;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(17, 43, 96, 0.16);
}

.map-fab[aria-pressed='true'] {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.map-fab.is-loading {
  cursor: wait;
  opacity: 0.72;
}

.map-fab:disabled {
  pointer-events: none;
}

.map-fab-layer {
  width: 38px;
  font-size: 1.05rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
  position: relative;
  overflow: visible;
}

.map-fab-exposure[aria-pressed='true'] {
  background: #c2410c;
  border-color: #c2410c;
}

.risk-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.risk-high {
  background: #dc2626;
}

.risk-medium {
  background: #f59e0b;
}

.risk-low {
  background: #16a34a;
}

.risk-score,
.risk-na {
  font-size: 0.82rem;
  color: #334155;
}

#ov-monitor {
  display: grid;
  gap: var(--space-4);
  align-content: start;
}

.ov-live-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(198, 40, 57, 0.34);
  background: linear-gradient(135deg, rgba(255, 236, 239, 0.95), rgba(255, 249, 250, 0.94));
  padding: 0.8rem 0.95rem;
}

.ov-live-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}

.ov-live-count {
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.12rem 0.52rem;
}

.ov-live-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.38rem;
}

.ov-live-item {
  color: #7b1021;
  font-size: 0.86rem;
}

.ov-live-empty {
  color: #5f6f8f;
  font-size: 0.84rem;
}

.ov-query-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.ov-query-field {
  display: grid;
  gap: 0.24rem;
}

.ov-query-field label {
  color: var(--text-2);
  font-size: 0.76rem;
}

.ov-query-actions {
  display: flex;
  align-items: flex-end;
}

.ov-query-actions button {
  width: 100%;
  border: none;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, #0f2044, #1f3d79);
  color: #fff;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.53rem 0.65rem;
}

.ov-summary {
  margin: 0;
  color: #334c7f;
  font-size: 0.85rem;
}

.ov-quick-grid {
  display: grid;
  gap: 0.75rem;
}

.ov-quick-card {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(183, 195, 219, 0.64);
  background: rgba(248, 251, 255, 0.92);
  padding: 0.8rem 0.9rem;
}

.ov-quick-title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #14347a;
}

.ov-quick-card p:last-child {
  margin: 0;
  color: var(--text-2);
  line-height: 1.55;
}

.ov-history-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0.55rem;
}

.ov-history-toggle-btn {
  border: 1px solid rgba(31, 79, 201, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #173f95;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.34rem 0.85rem;
  transition: background-color 140ms var(--ease-standard), color 140ms var(--ease-standard), border-color 140ms var(--ease-standard);
}

.ov-history-toggle-btn:hover {
  background: #eaf1ff;
  border-color: rgba(31, 79, 201, 0.45);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(183, 195, 219, 0.82);
  background: rgba(255, 255, 255, 0.92);
  min-height: 0;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

.fleet-table {
  table-layout: fixed;
  width: 2084px;
  min-width: 2084px;
}

.fleet-table .col-plane-id { width: 104px; }
.fleet-table .col-model { width: 104px; }
.fleet-table .col-city { width: 84px; }
.fleet-table .col-speed { width: 80px; }
.fleet-table .col-altitude { width: 80px; }
.fleet-table .col-throttle { width: 76px; }
.fleet-table .col-power { width: 78px; }
.fleet-table .col-main-state { width: 88px; }
.fleet-table .col-sub-state { width: 100px; }
.fleet-table .col-advice { width: 222px; }
.fleet-table .col-exposure { width: 86px; }
.fleet-table .col-loc { width: 86px; }
.fleet-table .col-deviation { width: 102px; }
.fleet-table .col-start { width: 146px; }
.fleet-table .col-end { width: 146px; }
.fleet-table .col-progress { width: 144px; }
.fleet-table .col-alarm-info { width: 174px; }
.fleet-table .col-alarm-level { width: 84px; }
.fleet-table .col-updated-at { width: 100px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #e7eefb 0%, #dde8fb 100%);
  color: #19376f;
  font-size: 0.81rem;
  letter-spacing: 0.01em;
}

th,
td {
  border-bottom: 1px solid rgba(183, 195, 219, 0.56);
  text-align: left;
  padding: 0.6rem 0.72rem;
  white-space: nowrap;
  font-size: 0.84rem;
}

.fleet-table th,
.fleet-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr {
  transition: background-color 120ms var(--ease-standard);
}

tbody tr:hover {
  background: rgba(31, 79, 201, 0.06);
}

.route-terminal {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-progress-cell {
  min-width: 160px;
  overflow: visible !important;
  text-overflow: clip !important;
}

.route-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 142px;
}

.route-progress-track {
  position: relative;
  width: 92px;
  height: 9px;
  border-radius: 999px;
  background: #deebff;
  overflow: hidden;
}

.route-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #2f66de 0%, #1f4fbf 100%);
  border-radius: 999px;
}

.route-progress-text {
  min-width: 3.4rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #1a3f98;
}

.route-progress-na {
  font-size: 0.82rem;
  color: #64748b;
}

.advice-cell {
  min-width: 260px;
  white-space: normal;
  overflow: visible !important;
  text-overflow: clip !important;
}

.advice-empty {
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.advice-chip {
  appearance: none;
  font: inherit;
  color: inherit;
  display: grid;
  gap: 0.18rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.42rem 0.58rem;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(241, 246, 255, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  transition:
    transform 140ms var(--ease-standard),
    box-shadow 140ms var(--ease-standard),
    border-color 140ms var(--ease-standard),
    background-color 140ms var(--ease-standard);
  white-space: normal;
}

.advice-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(17, 43, 96, 0.12);
}

.advice-chip:focus-visible {
  outline: 3px solid rgba(31, 79, 201, 0.18);
  outline-offset: 2px;
}

.advice-chip-action {
  font-size: 0.86rem;
  font-weight: 800;
  color: #102555;
}

.advice-chip-meta,
.advice-chip-evidence {
  font-size: 0.74rem;
  line-height: 1.35;
}

.advice-chip-meta {
  color: #4d628a;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.advice-chip-evidence {
  color: #41587f;
  font-size: 0.68rem;
}

.advice-chip-blue {
  border-color: rgba(31, 79, 201, 0.22);
}

.advice-chip-neutral {
  border-color: rgba(31, 79, 201, 0.18);
}

.advice-chip-yellow {
  border-color: rgba(245, 158, 11, 0.28);
  background: linear-gradient(180deg, rgba(255, 249, 232, 0.98), rgba(255, 245, 214, 0.96));
}

.advice-chip-green {
  border-color: rgba(23, 143, 83, 0.22);
  background: linear-gradient(180deg, rgba(239, 251, 244, 0.98), rgba(228, 247, 236, 0.96));
}

.advice-chip-orange {
  border-color: rgba(249, 115, 22, 0.25);
  background: linear-gradient(180deg, rgba(255, 246, 239, 0.98), rgba(255, 238, 226, 0.96));
}

.advice-chip-red {
  border-color: rgba(198, 40, 57, 0.25);
  background: linear-gradient(180deg, rgba(255, 239, 241, 0.98), rgba(255, 228, 233, 0.96));
}

.advice-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.advice-drawer.hidden {
  display: none !important;
}

.advice-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  appearance: none;
  background: rgba(12, 22, 44, 0.26);
  backdrop-filter: blur(1px);
  cursor: pointer;
}

.advice-drawer-panel {
  position: relative;
  margin-left: auto;
  width: min(100vw, 420px);
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  border-left: 1px solid rgba(183, 195, 219, 0.85);
  box-shadow: -16px 0 36px rgba(17, 43, 96, 0.18);
  display: grid;
  grid-template-rows: auto 1fr;
  z-index: 1;
}

.advice-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1rem 0.8rem;
  border-bottom: 1px solid rgba(183, 195, 219, 0.64);
}

.advice-drawer-kicker {
  margin: 0 0 0.18rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.advice-drawer-header h2 {
  margin: 0;
  font-size: 1.06rem;
  color: #12306b;
}

.advice-drawer-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(31, 79, 201, 0.2);
  appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a3773;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.advice-drawer-body {
  display: grid;
  gap: 0.9rem;
  padding: 0.95rem 1rem 1rem;
  overflow: auto;
}

.advice-drawer-meta {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.advice-meta-item,
.advice-drawer-section {
  border: 1px solid rgba(183, 195, 219, 0.7);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.94);
}

.advice-meta-item {
  padding: 0.65rem 0.72rem;
  display: grid;
  gap: 0.18rem;
}

.advice-meta-label {
  font-size: 0.74rem;
  color: var(--text-2);
}

.advice-meta-value {
  color: #132c62;
  font-size: 0.85rem;
  font-weight: 700;
  word-break: break-word;
}

.advice-drawer-section {
  padding: 0.72rem 0.78rem;
}

.advice-drawer-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: #17366f;
}

.advice-drawer-text {
  margin: 0;
  color: #364a73;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.advice-drawer-muted {
  margin-top: 0.35rem;
  color: #6a7894;
}

.advice-candidate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.advice-candidate-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(183, 195, 219, 0.8);
  background: #fff;
  color: #27406f;
  font-size: 0.78rem;
}

.advice-candidate-chip strong {
  font-weight: 700;
}

.advice-candidate-chip span {
  font-family: var(--font-mono);
  color: #52688f;
}

@media (max-width: 1180px) {
  .advice-drawer-panel {
    width: min(100vw, 380px);
  }
}

@media (max-width: 920px) {
  .advice-drawer-panel {
    width: 100%;
    height: min(78vh, 760px);
    margin-top: auto;
    border-left: none;
    border-top: 1px solid rgba(183, 195, 219, 0.85);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -16px 36px rgba(17, 43, 96, 0.18);
  }

  .advice-drawer {
    align-items: end;
  }

  .advice-drawer-meta {
    grid-template-columns: 1fr;
  }
}

.deviation-value {
  display: inline-flex;
  min-width: 3.4rem;
  justify-content: center;
  border-radius: 999px;
  background: #e8f0ff;
  color: #1743a7;
  font-family: var(--font-mono);
  font-size: 0.79rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
}

.deviation-value-alert {
  background: var(--danger-soft);
  color: #8f1020;
}

.deviation-value-warn {
  background: #fff5dc;
  color: #8d5706;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.13rem 0.52rem;
}

.status-tag-open {
  background: #ffe8ec;
  color: #9a1530;
}

.status-tag-recovered {
  background: #e7f8ef;
  color: #116239;
}

.ov-level-dot-shell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 36px;
  border: 2px solid rgba(163, 182, 214, 0.95);
  border-radius: 999px;
  background: #f7fbff;
}

.ov-level-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
}

.ov-level-dot-red {
  background: #dc2626;
}

.ov-level-dot-yellow {
  background: #f59e0b;
}

#fleet {
  display: grid;
  gap: var(--space-3);
  min-height: 0;
}

.plane-link {
  color: #1b55c8;
  font-weight: 700;
  text-decoration: none;
}

.plane-link:hover,
.plane-link:focus-visible {
  text-decoration: underline;
}

.marker-label {
  border-radius: 999px;
  background: rgba(24, 67, 164, 0.92);
  color: #fff;
  padding: 0.24rem 0.6rem;
  font-size: 0.74rem;
  line-height: 1;
  box-shadow: 0 7px 14px rgba(20, 53, 122, 0.3);
}

.marker-popup {
  position: relative;
  min-width: 210px;
  max-width: 420px;
  color: #14284f;
  font-size: 0.84rem;
  line-height: 1.45;
}

.marker-popup .marker-title {
  color: #1a49b5;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.marker-metrics {
  display: grid;
  gap: 0.08rem;
}

.marker-camera-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 0.5rem;
}

.marker-camera-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(183, 195, 219, 0.9);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
}

.marker-camera-card[data-expandable='1'] {
  cursor: zoom-in;
}

.marker-camera-card figcaption {
  padding: 0.25rem 0.42rem;
  background: #eef3fe;
  color: #1c3d7f;
  font-size: 0.74rem;
  font-weight: 700;
}

.marker-camera-card img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  background: #f2f6ff;
}

.marker-popup-image-expanded {
  min-width: 330px;
  min-height: 252px;
}

.marker-popup-image-expanded .marker-metrics {
  display: none;
}

.marker-popup-image-expanded .marker-camera-grid {
  margin-top: 0;
  height: 100%;
  min-height: 252px;
  grid-template-columns: 1fr;
}

.marker-popup-image-expanded .marker-camera-card.is-hidden {
  display: none;
}

.marker-popup-image-expanded .marker-camera-card.is-expanded {
  height: 100%;
  cursor: zoom-out;
}

.marker-popup-image-expanded .marker-camera-card.is-expanded img {
  flex: 1;
  min-height: 0;
  height: auto;
}

.marker-camera-empty .marker-camera-placeholder {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5b6e92;
  font-size: 0.75rem;
  background: #f6f8fc;
}

.deviation-marker {
  --ov-ring-rgb: 198, 40, 57;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(198, 40, 57, 0.95);
  border: 2px solid #fff;
  box-shadow: 0 0 0 5px rgba(198, 40, 57, 0.25);
  animation: ovPulse 1.2s infinite ease-in-out;
}

.deviation-marker-red {
  background: rgba(198, 40, 57, 0.95);
  --ov-ring-rgb: 198, 40, 57;
  box-shadow: 0 0 0 5px rgba(198, 40, 57, 0.25);
}

.deviation-marker-yellow {
  background: rgba(234, 179, 8, 0.95);
  --ov-ring-rgb: 234, 179, 8;
  box-shadow: 0 0 0 5px rgba(234, 179, 8, 0.28);
}

@keyframes ovPulse {
  0% {
    box-shadow: 0 0 0 2px rgba(var(--ov-ring-rgb), 0.42);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(var(--ov-ring-rgb), 0);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(var(--ov-ring-rgb), 0);
  }
}

#history {
  display: none !important;
}

.app-footer {
  margin: 0 auto 1.2rem;
  width: min(1920px, calc(100% - 2.5rem));
  color: #4d6289;
  font-size: 0.9rem;
}

#dashboard-main,
#map-panel,
#fleet,
#history {
  scroll-margin-top: 1rem;
}

.warning-banner {
  border-left: 4px solid #c62839;
  background: #fff3f5;
  color: #8d1226;
  font-weight: 700;
}

.operations-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.focus-cards,
.stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.focus-cards {
  padding-right: 0.7rem;
  margin-right: 0.1rem;
  border-right: 1px solid rgba(183, 195, 219, 0.78);
}

.focus-card,
.stat-card {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  min-width: 112px;
  min-height: 46px;
  padding: 0.56rem 0.72rem;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(15, 35, 81, 0.12);
  transition:
    transform 100ms var(--ease-standard),
    filter 140ms var(--ease-standard),
    border-color 140ms var(--ease-standard),
    background-color 140ms var(--ease-standard),
    color 140ms var(--ease-standard),
    box-shadow 140ms var(--ease-standard);
}

.focus-card:hover,
.stat-card:hover {
  filter: brightness(1.04);
}

.focus-card:active,
.stat-card:active {
  transform: translateY(1px);
}

.focus-card .name,
.stat-card .name {
  font-size: 0.84rem;
}

.focus-card .count,
.stat-card .count {
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.focus-risk { background: #c62839; }
.focus-landing { background: #2a9a5f; }

.stat-blue { background: #2c66de; }
.stat-green { background: #2a9a5f; }
.stat-red { background: #de3e4f; }
.stat-orange { background: #e79732; }
.stat-yellow { background: #cfaf2d; }

.focus-card.selected,
.stat-card.selected {
  background: #fff;
  color: #12294f;
  box-shadow: 0 6px 16px rgba(15, 35, 81, 0.08);
}

.focus-risk.selected { border-color: #c62839; }
.focus-landing.selected { border-color: #2a9a5f; }

.stat-blue.selected { border-color: #2c66de; }
.stat-green.selected { border-color: #2a9a5f; }
.stat-red.selected { border-color: #de3e4f; }
.stat-orange.selected { border-color: #e79732; }
.stat-yellow.selected { border-color: #cfaf2d; }

.row-focused { background: rgba(31, 79, 201, 0.14) !important; }

.table-wrap {
  min-height: 360px;
}

@media (min-width: 1280px) {
  #fleet .table-wrap {
    height: clamp(360px, 42vh, 640px);
  }

  #map {
    height: clamp(480px, 52vh, 860px);
  }
}

@media (min-width: 1760px) {
  .app-header,
  .dashboard,
  .app-footer {
    width: min(2160px, calc(100% - 3rem));
  }

  #fleet .table-wrap {
    height: clamp(420px, 44vh, 720px);
  }

  #map {
    height: clamp(540px, 56vh, 920px);
  }
}

@media (max-width: 1279px) {
  #map,
  #fleet .table-wrap {
    height: min(50vh, 420px);
  }

  .header-filterbar {
    gap: 0.55rem;
  }
}

@media (max-width: 860px) {
  .app-header {
    gap: 0.7rem;
    padding: 0.82rem 0.88rem 0.88rem;
  }

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

  .header-side,
  .header-actions {
    width: 100%;
    justify-items: stretch;
    justify-content: flex-start;
  }

  .dashboard,
  .app-header,
  .app-footer {
    width: calc(100% - 1rem);
  }

  .panel-head-compact {
    flex-direction: column;
  }

  .focus-cards,
  .stat-cards {
    flex-wrap: wrap;
  }

  .focus-cards {
    padding-right: 0;
    margin-right: 0;
    border-right: none;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid rgba(183, 195, 219, 0.78);
    margin-bottom: 0.2rem;
  }

  .header-filterbar {
    gap: 0.45rem;
  }
}

@media (max-width: 560px) {
  .overview-ribbon {
    grid-template-columns: 1fr;
  }

  .ov-query-form {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 0.75rem;
  }

  .panel-map-compact {
    padding: 0;
  }

  .focus-card,
  .stat-card {
    width: 100%;
    min-width: 0;
  }

  #map,
  #fleet .table-wrap {
    height: min(46vh, 360px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
