:root {
  /* Backgrounds */
  --bg: #0b0f16;
  --bg-elevated: #10151f;
  --surface: #171c26;
  --surface-2: #1d2431;
  --surface-hover: rgba(255, 255, 255, 0.06);

  /* Text */
  --text: #f7f9ff;
  --text-muted: #aab6cb;
  --text-soft: #73819a;

  /* Brand */
  --primary: #244e91;
  --primary-hover: #3567b7;
  --primary-light: #6fa2ff;
  --primary-wash: rgba(36, 78, 145, 0.24);
  --accent: #2563eb;
  --accent-muted: rgba(37, 99, 235, 0.18);
  --gold: #d8a33a;

  /* Semantic status */
  --success: #58c58a;
  --danger: #f16d55;
  --danger-hover: #ff8a70;
  --status-good: #58c58a;
  --status-good-wash: rgba(88, 197, 138, 0.2);
  --status-warning: #d8a33a;
  --status-warning-wash: rgba(216, 163, 58, 0.2);
  --status-critical: #f16d55;
  --status-critical-wash: rgba(241, 109, 85, 0.2);
  --status-info: #6fa2ff;
  --status-info-wash: rgba(111, 162, 255, 0.18);
  --status-neutral: #aab6cb;
  --status-neutral-wash: rgba(170, 182, 203, 0.16);

  /* Borders */
  --border: rgba(151, 169, 205, 0.18);
  --border-strong: rgba(216, 163, 58, 0.36);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;

  /* Typography */
  --text-xs: 0.7rem;
  --text-sm: 0.8rem;
  --text-base: 0.9rem;
  --text-md: 0.95rem;
  --text-lg: 1.1rem;
  --text-xl: 1.5rem;

  /* Radius */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-pill: 999px;
  --radius-circle: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.24);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.32), 0 1px 0 rgba(255, 255, 255, 0.04) inset;

  /* Motion */
  --duration-enter: 600ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --enter-delay: 0s;
  --hero-glow-x: 50%;
  --hero-glow-y: 50%;

  /* Layers / Z-Index:
     1    — local stacking (pseudo-elements above decorative layers)
     20   — dropdown menus
     100  — modal overlays (standard)
     110  — form-modal (above standard modal)
     115  — curso-lote-modal (above form-modal)
     200  — auth-screen (login covers everything below)
     500  — map overlays (mapa-avisos, mapa-sticks — inside map context)
  */
  --z-dropdown: 20;
  --z-modal: 2000;
  --z-modal-form: 2010;
  --z-modal-lote: 2020;
  --z-auth: 200;
  --z-map-overlay: 500;
  --z-nav-backdrop: 1100;
  --z-nav-drawer: 1200;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* -- 13. Dimensões de Ícones -- */
  --icon-xs: 14px;
  --icon-sm: 16px;
  --icon-md: 18px;
  --icon-lg: 20px;
  --icon-xl: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16;
    --surface: #171c26;
    --text: #f7f9ff;
    --status-info: #6fa2ff;
    --status-neutral: #aab6cb;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f16;
  --surface: #171c26;
  --text: #f7f9ff;
  --status-info: #6fa2ff;
  --status-neutral: #aab6cb;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(36, 78, 145, 0.32), transparent 34rem),
    radial-gradient(circle at 88% 12%, rgba(216, 163, 58, 0.12), transparent 28rem),
    linear-gradient(135deg, #0b0f16 0%, #10151f 54%, #0b0f16 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(151, 169, 205, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(151, 169, 205, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 55% 18%, rgba(0, 0, 0, 0.9), transparent 70%);
}

.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

.app[hidden] {
  display: none !important;
}

.mobile-header,
.mobile-nav-backdrop {
  display: none;
}

.sidebar {
  width: 264px;
  min-width: 264px;
  max-width: 264px;
  flex: 0 0 264px;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(15, 20, 29, 0.98), rgba(11, 15, 22, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(36, 78, 145, 0.24), transparent 18rem);
  border-right: 1px solid rgba(216, 163, 58, 0.18);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 18px 0 46px rgba(0, 0, 0, 0.22);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 6px 10px 26px;
  border-bottom: 1px solid rgba(151, 169, 205, 0.12);
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(216, 163, 58, 0.22), rgba(36, 78, 145, 0.5));
  border: 1px solid rgba(216, 163, 58, 0.42);
  box-shadow: 0 12px 28px rgba(36, 78, 145, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--gold);
  font-size: var(--text-lg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: 0.08em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: calc(100vh - 116px);
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  flex: 0 0 auto;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 13px;
  font-size: var(--text-base);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--text-md);
  line-height: 1;
  border-radius: var(--radius-sm);
  background: rgba(151, 169, 205, 0.08);
  color: var(--text-muted);
}

.nav-icon .icon {
  width: var(--icon-md);
  height: var(--icon-md);
}

/* ==========================================================================
   SISTEMA CENTRALIZADO DE ÍCONES (FASE 3)
   ========================================================================== */
.svg-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.icon {
  display: inline-block;
  width: var(--icon-md);
  height: var(--icon-md);
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;
  flex-shrink: 0;
  pointer-events: none;
}
.icon-xs { width: var(--icon-xs); height: var(--icon-xs); }
.icon-sm { width: var(--icon-sm); height: var(--icon-sm); }
.icon-md { width: var(--icon-md); height: var(--icon-md); }
.icon-lg { width: var(--icon-lg); height: var(--icon-lg); }
.icon-xl { width: var(--icon-xl); height: var(--icon-xl); }

/* Indicadores semânticos de status */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}
.status-dot--good,
.status-dot.good { background-color: var(--status-good); box-shadow: 0 0 0 2px var(--status-good-wash); }
.status-dot--warning,
.status-dot.warning,
.status-dot.warn { background-color: var(--status-warning); box-shadow: 0 0 0 2px var(--status-warning-wash); }
.status-dot--critical,
.status-dot.critical,
.status-dot.bad { background-color: var(--status-critical); box-shadow: 0 0 0 2px var(--status-critical-wash); }
.status-dot--info,
.status-dot.info { background-color: var(--status-info); box-shadow: 0 0 0 2px var(--status-info-wash); }
.status-dot--neutral,
.status-dot.neutral { background-color: var(--status-neutral); box-shadow: 0 0 0 2px var(--status-neutral-wash); }

.nav-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  line-height: 1.3;
}

.nav-btn:hover {
  background: var(--primary-wash);
  border-color: rgba(151, 169, 205, 0.14);
  color: var(--text);
  transform: translateX(2px);
}

.nav-btn.active {
  background: linear-gradient(90deg, rgba(36, 78, 145, 0.46), rgba(36, 78, 145, 0.16));
  border-color: rgba(111, 162, 255, 0.24);
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--gold), 0 10px 24px rgba(36, 78, 145, 0.18);
}

.nav-btn.active .nav-icon {
  background: rgba(216, 163, 58, 0.16);
  color: var(--gold);
}

.logout-btn {
  margin-top: auto;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 32px 34px 64px;
  max-width: 1660px;
}

.view-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.view-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: var(--text-md);
  font-weight: 400;
  line-height: 1.5;
}

/* Manutenção: eventos são uma linha do tempo, não um fluxo obrigatório. */
.manut-grid { margin-bottom: 24px; }
.manut-linha { cursor: pointer; }
.manut-linha:hover td { background: rgba(37, 99, 235, .06); }
.manut-linha:focus-visible { outline: 2px solid var(--primary-light, #60a5fa); outline-offset: -2px; }
.manut-timeline { border-left: 2px solid var(--border-color, #d7dee8); margin: 12px 0 24px 8px; padding-left: 22px; }
.manut-evento { position: relative; padding: 0 0 20px; }
.manut-evento::before { content: ""; position: absolute; left: -29px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary, #2563eb); box-shadow: 0 0 0 4px var(--surface, #fff); }
.manut-evento strong, .manut-evento span { display: block; }
.manut-evento span, .manut-evento small { color: var(--text-muted, #64748b); font-size: .9rem; }
.manut-evento p { margin: 7px 0; white-space: pre-wrap; }
.manut-anexos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.manut-anexos a { font-size: .88rem; }
.manut-modal { max-width: 760px; }
#manutencao-detalhe details { margin-top: 20px; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.view-header .view-title {
  margin: 0;
}

@keyframes slide-in-up {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xl);
  min-height: 220px;
  margin-bottom: var(--space-xl);
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid rgba(111, 162, 255, 0.34);
  border-radius: var(--radius);
  background:
    linear-gradient(125deg, rgba(36, 78, 145, 0.92), rgba(23, 28, 38, 0.96) 62%, rgba(216, 163, 58, 0.24)),
    radial-gradient(circle at 75% 25%, rgba(216, 163, 58, 0.32), transparent 16rem),
    radial-gradient(circle at 15% 60%, rgba(36, 78, 145, 0.24), transparent 18rem);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.48),
    0 0 60px rgba(216, 163, 58, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  animation: slide-in-up var(--duration-enter) var(--ease-out-expo);
  backdrop-filter: blur(0.5px);
  transform-style: preserve-3d;
  perspective: 1200px;
}

.dashboard-hero::before,
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dashboard-hero::before {
  background-image:
    radial-gradient(circle at var(--hero-glow-x, 50%) var(--hero-glow-y, 50%), rgba(216, 163, 58, 0.18), transparent 38%),
    linear-gradient(120deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 46px);
  opacity: 0.56;
  transition: background-image 0.1s ease;
}

.dashboard-hero::after {
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.08) 45%, transparent 70%);
  transform: translateX(-45%);
}

.dashboard-hero-content,
.dashboard-hero-visual {
  position: relative;
  z-index: 1;
}

.fleet-health {
  margin-top: 18px;
}

@keyframes section-glow-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.fleet-health-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.fleet-health-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--text-muted);
}

.fleet-health-pct {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(216, 163, 58, 0.32);
}

.fleet-health-bar {
  height: 8px;
  background: rgba(151, 169, 205, 0.12);
  border-radius: var(--radius-circle);
  overflow: hidden;
  position: relative;
}

.fleet-health-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #58c58a 0%, #6fa2ff 50%, #d8a33a 100%);
  border-radius: var(--radius-circle);
  box-shadow: 0 0 16px rgba(88, 197, 138, 0.4);
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.fleet-health-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  animation: shimmer 2.4s linear infinite;
}

.fleet-health-detail {
  display: flex;
  gap: 10px;
  color: var(--text-muted);
}

.fleet-health-card {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
}

.fleet-health-card.good { color: var(--status-good); }
.fleet-health-card.warn,
.fleet-health-card.warning { color: var(--status-warning); }
.fleet-health-card.bad,
.fleet-health-card.critical { color: var(--status-critical); }
.fleet-health-card.neutral { color: var(--status-neutral); }

.fleet-health-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text);
}

.fleet-health-card-header .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.fleet-health-card-header .icon .icon {
  width: var(--icon-lg);
  height: var(--icon-lg);
}

.fleet-health-card-header .label {
  flex: 1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.fleet-health-card-header .pct {
  font-weight: 800;
  font-size: var(--text-base);
  letter-spacing: -0.02em;
  color: currentColor;
}

.fleet-health-bar-mini {
  height: 5px;
  background: rgba(151, 169, 205, 0.1);
}

.fleet-health-card-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-xs);
}

.fleet-health-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-xs);
  margin-top: 4px;
  white-space: nowrap;
}

.fleet-health-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.fleet-health-stats .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.fleet-health-stats .stat-good { color: var(--status-good); }
.fleet-health-stats .stat-warn,
.fleet-health-stats .stat-warning { color: var(--status-warning); }
.fleet-health-stats .stat-bad,
.fleet-health-stats .stat-critical { color: var(--status-critical); }
.fleet-health-stats .stat-good .dot { background: var(--status-good); }
.fleet-health-stats .stat-warn .dot,
.fleet-health-stats .stat-warning .dot { background: var(--status-warning); }
.fleet-health-stats .stat-bad .dot,
.fleet-health-stats .stat-critical .dot { background: var(--status-critical); }

.fleet-health-stats-sub {
  font-size: var(--text-xs);
  color: var(--text-soft);
  margin-top: 2px;
  font-style: italic;
}

.fleet-health-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(36, 78, 145, 0.18);
  border: 1px solid rgba(151, 169, 205, 0.14);
}

.fleet-health-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

.fleet-health-chip.good { color: var(--status-good); }
.fleet-health-chip.warn { color: var(--status-warning); }
.fleet-health-chip.bad { color: var(--status-critical); }
.fleet-health-chip.neutral { color: var(--status-neutral); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  color: var(--gold);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: var(--radius-circle);
  background: var(--gold);
  box-shadow: 0 0 18px rgba(216, 163, 58, 0.72);
}

.dashboard-hero-visual {
  position: relative;
  flex: 0 0 190px;
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
}

.radar-ring,
.radar-sweep {
  position: absolute;
  border-radius: var(--radius-circle);
}

.radar-ring {
  border: 1px solid rgba(216, 163, 58, 0.28);
  box-shadow:
    inset 0 0 28px rgba(36, 78, 145, 0.3),
    0 0 16px rgba(111, 162, 255, 0.12);
  animation: subtle-breathe 5s ease-in-out infinite;
  transition: box-shadow 0.3s ease;
}

.radar-ring-1 { width: 130px; height: 130px; }
.radar-ring-2 { width: 88px; height: 88px; border-color: rgba(111, 162, 255, 0.28); }

.radar-sweep {
  width: 130px;
  height: 130px;
  background: conic-gradient(from 230deg, rgba(216, 163, 58, 0.5), transparent 62deg);
  mask-image: radial-gradient(circle, transparent 0 12px, #000 13px);
  opacity: 0.82;
  animation: radar-rotate 6s linear infinite;
  filter: blur(0.5px);
}

.drone-svg-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 140px;
  height: 140px;
  animation: drone-float-3d 5s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(216,163,58,0.3)) drop-shadow(0 4px 12px rgba(36,78,145,0.2));
}

.drone-svg {
  width: 100%;
  height: 100%;
}

.propeller {
  animation: propeller-spin 0.3s linear infinite;
}

.propeller.prop-tl { transform-origin: 45px 45px; }
.propeller.prop-tr { transform-origin: 155px 45px; animation-delay: -0.075s; }
.propeller.prop-bl { transform-origin: 45px 155px; animation-delay: -0.15s; }
.propeller.prop-br { transform-origin: 155px 155px; animation-delay: -0.225s; }

.drone-led {
  animation: led-pulse 1.5s ease-in-out infinite;
}

.drone-led-red {
  animation: led-blink 2s ease-in-out infinite;
}

@keyframes drone-float-3d {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes propeller-spin {
  from { transform: rotateZ(0deg); }
  to { transform: rotateZ(360deg); }
}

@keyframes led-pulse {
  0%, 100% { fill: #58c58a; filter: drop-shadow(0 0 4px #58c58a); }
  50% { fill: #72ff9e; filter: drop-shadow(0 0 12px #72ff9e); }
}

@keyframes led-blink {
  0%, 100% { opacity: 0.4; fill: #f16d55; }
  50% { opacity: 1; fill: #ff8b73; filter: drop-shadow(0 0 8px #f16d55); }
}


.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin: 38px 0 18px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.section-heading.dashboard-section-animated {
  opacity: 1;
  transform: translateY(0);
}

.section-description {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: var(--text-md);
  font-weight: 400;
  line-height: 1.5;
}

.section-title.dashboard-section-title {
  margin-top: 56px;
  margin-bottom: 14px;
}

.dashboard-pagination {
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
}

.dashboard-pagination .pagination-info {
  min-width: 96px;
  text-align: center;
}

.dashboard-pagination button.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

/* (estilos do antigo .date-filter-bar removidos — filtro de data agora é select) */

.filter-popover {
  position: fixed;
  z-index: 1000;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow);
  min-width: 240px;
  backdrop-filter: blur(6px);
}

.filter-popover-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.filter-popover-row input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(20, 30, 48, 0.8);
  color: var(--text);
  font-size: var(--text-sm);
  color-scheme: dark;
}

.filter-popover-row input[type="date"]:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(111, 162, 255, 0.25);
}

.filter-popover-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 4px;
}

.dropdown-select {
  position: relative;
}

.dropdown-select-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 170px;
  max-width: 220px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-select-btn::after {
  content: "▾";
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex: 0 0 auto;
}

.dropdown-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow);
  padding: 6px;
}

.dropdown-select-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 8px;
  font-size: var(--text-base);
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
}

.dropdown-select-option:hover {
  background: rgba(127, 127, 127, 0.08);
}

.dropdown-select-option input {
  cursor: pointer;
}

.dropdown-select-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 2px;
}

/* Selects de filtro usam o mesmo popover dos filtros compostos. O select
   original permanece no DOM para preservar as integrações existentes. */
.filter-select-native {
  display: none !important;
}

.filter-select-menu {
  min-width: 100%;
}

.filter-select-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.filter-select-option::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 1px solid var(--text-soft);
  border-radius: 50%;
  box-sizing: border-box;
}

.filter-select-option.is-selected {
  background: rgba(111, 162, 255, 0.16);
  color: var(--primary-light);
}

.filter-select-option.is-selected::before {
  border: 4px solid var(--primary-light);
}

.filter-select-option:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: -2px;
}

.filter-search {
  flex: 1 1 200px;
  max-width: 260px;
  min-width: 120px;
  padding: 10px 13px;
  border: 1px solid var(--text-soft);
  border-radius: var(--radius-pill);
  background: rgba(11, 15, 22, 0.58);
  color: var(--text);
  font-size: var(--text-base);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.filter-status {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--text-soft);
  border-radius: var(--radius);
  background: rgba(11, 15, 22, 0.58);
  color: var(--text);
  font-size: var(--text-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0, 0, 0, 0.12);
  height: 32px;
  display: flex;
  align-items: center;
}

[hidden],
.filter-status[hidden],
select.filter-status[hidden],
.dropdown-select[hidden] {
  display: none !important;
}

.filter-search:focus,
.filter-status:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(111, 162, 255, 0.25);
}

body.modal-open {
  overflow: hidden;
}

/* Barras de rolagem de superfícies arredondadas.
   O navegador desenha a trilha nativa até os cantos do contêiner rolável,
   o que faz a borda direita parecer reta. Mantemos a rolagem, mas deixamos
   a trilha transparente e reservamos os extremos para preservar os raios. */
:is(
  .dropdown-select-menu,
  .modal,
  .modal-box,
  .filter-popover,
  .voo-telemetria,
  .dual-list-box,
  .export-units-container,
  #unidades-export-modal .modal-body,
  #export-word-modal .modal-body,
  #entity-export-modal .modal-body
) {
  scrollbar-width: thin;
  scrollbar-color: rgba(151, 169, 205, 0.56) transparent;
  scrollbar-gutter: stable;
}

:is(
  .dropdown-select-menu,
  .modal,
  .modal-box,
  .filter-popover,
  .voo-telemetria,
  .dual-list-box,
  .export-units-container,
  #unidades-export-modal .modal-body,
  #export-word-modal .modal-body,
  #entity-export-modal .modal-body
)::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

:is(
  .dropdown-select-menu,
  .modal,
  .modal-box,
  .filter-popover,
  .voo-telemetria,
  .dual-list-box,
  .export-units-container,
  #unidades-export-modal .modal-body,
  #export-word-modal .modal-body,
  #entity-export-modal .modal-body
)::-webkit-scrollbar-track {
  background: transparent;
}

:is(
  .dropdown-select-menu,
  .modal,
  .modal-box,
  .filter-popover,
  .voo-telemetria,
  .dual-list-box,
  .export-units-container,
  #unidades-export-modal .modal-body,
  #export-word-modal .modal-body,
  #entity-export-modal .modal-body
)::-webkit-scrollbar-track-piece:start {
  margin-top: var(--radius-sm);
}

:is(
  .dropdown-select-menu,
  .modal,
  .modal-box,
  .filter-popover,
  .voo-telemetria,
  .dual-list-box,
  .export-units-container,
  #unidades-export-modal .modal-body,
  #export-word-modal .modal-body,
  #entity-export-modal .modal-body
)::-webkit-scrollbar-track-piece:end {
  margin-bottom: var(--radius-sm);
}

:is(
  .dropdown-select-menu,
  .modal,
  .modal-box,
  .filter-popover,
  .voo-telemetria,
  .dual-list-box,
  .export-units-container,
  #unidades-export-modal .modal-body,
  #export-word-modal .modal-body,
  #entity-export-modal .modal-body
)::-webkit-scrollbar-thumb {
  background: rgba(151, 169, 205, 0.56);
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: content-box;
}

.modal::-webkit-scrollbar-corner {
  background: transparent;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, var(--safe-top)) max(24px, var(--safe-right))
    max(24px, var(--safe-bottom)) max(24px, var(--safe-left));
  z-index: var(--z-modal);
  overscroll-behavior: contain;
}

.modal-overlay[hidden] {
  display: none;
}

#form-modal {
  z-index: var(--z-modal-form);
}

#curso-lote-modal {
  z-index: var(--z-modal-lote);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(760px, calc(100vw - 48px));
  max-width: 96vw;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 22px 26px 26px;
  box-sizing: border-box;
  min-width: 0;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  min-width: 0;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Ações das fichas: editar e excluir compartilham a mesma geometria em
   Pilotos, Drones, Cursos, Unidades e nas demais fichas de entidades. */
.modal-header-actions > button.link,
.modal-header-actions > button.danger {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
}

.modal-header-actions > button.link .icon,
.modal-header-actions > button.danger .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

.modal-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--text-base);
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

.modal .form {
  align-items: stretch;
}

.modal .field {
  flex: 1 1 100%;
}

.modal .form-actions {
  flex: 1 1 100%;
  justify-content: flex-end;
  margin-top: 4px;
}

.modal-sm {
  width: min(480px, calc(100vw - 32px));
}

.modal-wide {
  width: min(1180px, calc(100vw - 48px));
}

.modal-xwide {
  width: min(1320px, calc(100vw - 48px));
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 8px;
  }

  .modal,
  .modal-sm,
  .modal-wide,
  .modal-xwide {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }

  .modal-box {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 14px;
  }

  .sidebar {
    padding: 10px;
  }

  .brand {
    padding-bottom: 10px;
    margin-bottom: var(--space-sm);
  }

  .brand-name {
    font-size: var(--text-md);
  }

  .nav-btn {
    padding: 6px 10px;
    font-size: var(--text-sm);
  }

  .nav-icon {
    font-size: var(--text-base);
  }

  .content {
    padding: 14px 12px 32px;
  }

  .view-title {
    font-size: var(--text-lg);
  }

  .filter-bar {
    gap: var(--space-xs);
  }

  .filter-search {
    padding: 8px 10px;
    font-size: 16px;
  }

  .filter-status {
    padding: 8px 10px;
    font-size: 16px;
  }

  .section-heading {
    margin-top: var(--space-lg);
    gap: var(--space-sm);
  }

  .section-title {
    font-size: var(--text-md);
  }

  /* === Carrossel responsivo === */
  .stat-grid {
    gap: 12px;
    padding: 16px 4px 24px;
    margin: 0 -4px;
  }

  .stat-carousel-item {
    flex: 0 0 280px;
    min-height: 180px;
  }

  .carousel-nav {
    width: 40px;
    height: 40px;
    font-size: var(--text-lg);
    bottom: 0;
    transform: none;
  }

  .carousel-prev {
    left: 6px;
  }

  .carousel-next {
    right: 6px;
  }

  .stat-tile {
    padding: 14px 12px;
  }

  .stat-value {
    font-size: 2rem;
    margin: 14px 0 10px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-description {
    font-size: var(--text-sm);
    margin: -3px 0 10px;
  }

  .stat-breakdown {
    gap: 6px;
  }

  .stat-breakdown-item {
    padding: 5px 8px;
    font-size: var(--text-xs);
  }

  .stat-label {
    font-size: var(--text-xs);
  }

  #table thead th,
  #table tbody td {
    padding: 6px 5px;
    font-size: var(--text-xs);
  }

  .drone-chip-list {
    max-width: 160px;
  }

  .drone-chip {
    padding: 3px 6px;
    font-size: var(--text-xs);
    max-width: 80px;
  }

  .detail-grid {
    font-size: var(--text-sm);
  }

  .dashboard-hero-content h1 {
    font-size: var(--text-lg);
  }

  .dashboard-hero-content p {
    font-size: var(--text-sm);
  }

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

/* ---------- Painel geral responsivo (tablet e mobile) ---------- */

/* Tablet (≤ 980px): hero empilhado, drone visual menor */
@media (max-width: 980px) {
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
    min-height: auto;
    padding: 20px 24px;
  }

  .dashboard-hero-visual {
    margin: 16px auto 0;
    width: 160px;
    height: 160px;
    flex: 0 0 160px;
  }

  .drone-svg-wrap {
    width: 100px;
    height: 100px;
  }

  .fleet-health-detail {
    flex-wrap: wrap;
  }

  .fleet-health-card {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
  }
}

/* Mobile médio (≤ 700px): cards empilhados, fonte menor */
@media (max-width: 700px) {
  .dashboard-hero-content h1 {
    font-size: var(--text-xl);
  }

  .dashboard-hero-content p {
    font-size: var(--text-sm);
  }

  .dashboard-hero-visual {
    margin: 14px auto 0;
    width: 140px;
    height: 140px;
    flex: 0 0 140px;
  }

  .drone-svg-wrap {
    width: 90px;
    height: 90px;
  }

  .fleet-health-card {
    flex: 1 1 100%;
  }

  .fleet-health-card-header .pct {
    font-size: var(--text-base);
  }

  /* Tabelas do painel com scroll horizontal */
  #cursos-expiry-table,
  #avaliacoes-pendentes-table,
  #dashboard-termos-table {
    font-size: var(--text-xs);
  }

  #cursos-expiry-table th,
  #cursos-expiry-table td,
  #avaliacoes-pendentes-table th,
  #avaliacoes-pendentes-table td,
  #dashboard-termos-table th,
  #dashboard-termos-table td {
    padding: 8px 6px;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .section-heading > button {
    width: 100%;
  }

  .pagination-bar {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .pagination-controls {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-pagination-controls {
    width: 100%;
    justify-content: space-between;
  }
}

/* Mobile pequeno (≤ 420px): drone +3D mais compacto */
@media (max-width: 420px) {
  .dashboard-hero-visual {
    width: 120px;
    height: 120px;
    flex: 0 0 120px;
  }

  .drone-svg-wrap {
    width: 76px;
    height: 76px;
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  .expiry-badge {
    padding: 6px 10px;
    font-size: var(--text-xs);
  }

  /* Reduzir efeito parallax em mobile (performance) */
  .stat-tile,
  .drone-svg-wrap {
    transition: none;
  }
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(500px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px 26px 26px;
  box-sizing: border-box;
}

.modal-body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.modal-body .field-wide {
  flex-basis: 100%;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: 4px;
  border-top: 1px solid rgba(151, 169, 205, 0.08);
  margin-top: 4px;
}

.lote-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  width: 100%;
}

.lote-row .field {
  flex: 1 1 160px;
  min-width: 140px;
}

#sarpas-heatmap-mapa {
  height: 520px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
  margin: 0 0 22px;
}

.detail-grid div {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  line-height: 1.2;
}

.detail-value {
  font-size: var(--text-md);
}

.detail-value div {
  line-height: 1.4;
}

/* Ficha do curso - evitar texto invadindo campos vizinhos */
#curso-details {
  word-break: break-word;
  overflow-wrap: break-word;
}

#curso-details .detail-value {
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}

.voo-mapa {
  height: 450px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.voo-player {
  margin-top: var(--space-md);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 0;
}

.player-controls button {
  min-width: 36px;
  height: 36px;
  font-size: var(--text-sm);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-slider {
  flex: 1;
  cursor: pointer;
  height: 6px;
}

.player-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 90px;
  text-align: right;
}

.player-speed {
  font-size: var(--text-xs);
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.voo-mapa-layout {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
  height: 500px;
}

.voo-mapa-layout .voo-mapa {
  flex: 1;
  height: 100%;
  min-width: 0;
}

.voo-mapa-holder {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.voo-mapa-holder .voo-mapa {
  height: 100%;
}

/* Avisos do voo: pilha no topo esquerdo do mapa, um por linha */
.mapa-avisos {
  position: absolute;
  /* abaixo do controle de zoom (+/-) do Leaflet, que fica no topo esquerdo */
  top: 86px;
  left: 10px;
  max-width: min(360px, calc(100% - 140px));
  z-index: var(--z-map-overlay);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  pointer-events: none;
}

.mapa-avisos[hidden],
.mapa-sticks[hidden] {
  display: none;
}

.mapa-avisos .aviso-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  background: rgba(16, 21, 31, 0.95);
  border: 1px solid var(--status-warning);
  color: var(--status-warning);
  font-size: var(--text-xs);
  line-height: 1.3;
  animation: aviso-in 0.18s ease-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.mapa-avisos .aviso-item.saindo {
  animation: aviso-out 0.3s ease-in forwards;
}

.mapa-avisos .aviso-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapa-avisos .aviso-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  margin-left: auto;
  flex-shrink: 0;
}

@keyframes aviso-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes aviso-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* Sticks do radiocontrole: canto direito, abaixo do controle de camadas */
.mapa-sticks {
  position: absolute;
  top: 96px;
  right: 10px;
  z-index: var(--z-map-overlay);
  display: flex;
  gap: var(--space-sm);
  padding: 8px;
  border-radius: var(--radius-xs);
  background: rgba(20, 24, 33, 0.78);
  pointer-events: none;
}

.stick-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.stick-box {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-circle);
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.stick-cross-h,
.stick-cross-v {
  position: absolute;
  background: rgba(255, 255, 255, 0.25);
}

.stick-cross-h {
  left: 4px;
  right: 4px;
  top: 50%;
  height: 1px;
}

.stick-cross-v {
  top: 4px;
  bottom: 4px;
  left: 50%;
  width: 1px;
}

.stick-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: var(--radius-circle);
  background: #00d4ff;
  box-shadow: 0 0 4px rgba(0, 212, 255, 0.8);
  top: 50%;
  left: 50%;
  transition: top 0.08s linear, left 0.08s linear;
}

.stick-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stick-label small {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.voo-telemetria-sidebar {
  width: 340px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Painel de valores do instante atual */
.telemetria-live {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.telemetria-live .tl-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
  background: var(--surface);
  min-width: 0;
}

.telemetria-live .tl-wide {
  grid-column: 1 / -1;
}

.telemetria-live .tl-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.telemetria-live .tl-value {
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetria-live .tl-value.tl-alerta {
  color: var(--status-critical);
}

/* Cabeçalho fixo da linha do tempo — mesma grade das linhas */
.telemetria-head {
  display: grid;
  grid-template-columns: 42px 1fr 1fr 40px;
  gap: var(--space-xs);
  padding: 4px 8px;
  margin-bottom: 2px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.telemetria-head .th-bat {
  text-align: right;
}

/* Linha do tempo rolante */
.voo-telemetria-sidebar .voo-telemetria {
  flex: 1;
  margin-top: 0;
  max-height: none;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* rolagem controlada pelo player; esconde a barra sem travar o scroll */
  scrollbar-width: none;
}

.voo-telemetria-sidebar .voo-telemetria::-webkit-scrollbar {
  width: 0;
}

.voo-telemetria {
  margin-top: var(--space-md);
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.voo-telemetria .tl-row {
  display: grid;
  grid-template-columns: 42px 1fr 1fr 40px;
  align-items: baseline;
  gap: var(--space-xs);
  padding: 4px 8px;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(151, 169, 205, 0.08);
  transition: background 0.12s linear, color 0.12s linear;
}

/* box-shadow em vez de border-left: mantém as colunas alinhadas
   com o cabeçalho (borda deslocaria o conteúdo em 2px) */
.voo-telemetria .tl-row.active {
  background: var(--accent-muted);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.voo-telemetria .tl-t {
  color: var(--text);
  opacity: 0.7;
}

.voo-telemetria .tl-row.active .tl-t {
  opacity: 1;
}

.voo-telemetria .tl-bat {
  text-align: right;
}

.voo-telemetria .tl-up {
  color: var(--success);
  margin-left: 3px;
  font-size: var(--text-xs);
}

.voo-telemetria .tl-down {
  color: var(--status-warning);
  margin-left: 3px;
  font-size: var(--text-xs);
}

/* Aviso ocupa a largura toda, na linha de baixo */
.voo-telemetria .tl-warn {
  grid-column: 1 / -1;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voo-telemetria .tl-spacer {
  pointer-events: none;
}

#voos-table th,
#voos-table td {
  white-space: nowrap;
}

#voos-table td:nth-child(4),
#voos-table td:nth-child(6) {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 220px;
}

.log-dji-upload-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin: 12px 0;
}

.view-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 12px;
}

/* separa visualmente uma seção (ex: Avaliações) da tabela da seção anterior
   (ex: Cursos) na ficha do piloto, apenas com espaço */
.table-wrap + .view-section-header {
  margin-top: var(--space-3xl);
}

.view-section-header h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.curso-pilotos-grid-head,
.curso-pilotos-grid {
  display: grid;
  grid-template-columns: 56px minmax(126px, 0.9fr) minmax(260px, 2fr) 112px 112px minmax(190px, 1.2fr) 36px 36px;
  gap: var(--space-sm);
  width: max(100%, 940px);
  box-sizing: border-box;
}

.curso-pilotos-grid-head {
  margin-bottom: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.curso-pilotos-grid-wrap {
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.curso-pilotos-readonly-cell {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(151, 169, 205, 0.12);
  border-radius: var(--radius-xs);
  background: rgba(11, 15, 22, 0.28);
  color: var(--text);
  font-size: var(--text-base);
  overflow-wrap: break-word;
}

.curso-pilotos-editable-cell {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(11, 15, 22, 0.52);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  box-sizing: border-box;
  width: 100%;
}

.curso-pilotos-editable-cell:focus {
  outline: 2px solid rgba(216, 163, 58, 0.35);
  outline-offset: 1px;
  border-color: rgba(216, 163, 58, 0.5);
}

.curso-pilotos-editable-cell:disabled {
  background: rgba(11, 15, 22, 0.22);
  color: var(--text-muted);
  cursor: not-allowed;
}

.curso-pilotos-grid-remove-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.curso-pilotos-grid-head > div {
  white-space: nowrap;
}

.curso-pilotos-num {
  white-space: nowrap;
  text-align: center;
}

.curso-pilotos-nome {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.curso-pilotos-grid-edit-btn {
  width: 32px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--primary);
  cursor: pointer;
  font-size: var(--text-md);
  line-height: 1;
  justify-self: center;
  align-self: center;
}

.curso-pilotos-grid-edit-btn:hover {
  background: var(--primary);
  color: #fff;
}

.curso-pilotos-grid-edit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.curso-pilotos-grid-remove-btn {
  width: 32px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--danger);
  cursor: pointer;
  font-size: var(--text-md);
  line-height: 1;
  justify-self: center;
  align-self: center;
}

.curso-pilotos-grid-remove-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* ==========================================================================
   FUNDAÇÃO COMUM DE CARDS, CAIXAS E SUPERFÍCIES (FASE 7)
   ========================================================================== */
.card,
.surface-card,
.panel,
.stat-tile,
.op-card,
.skeleton-card,
.export-card-section,
.fleet-health-card {
  box-sizing: border-box;
  color: var(--text);
}

.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(29, 36, 49, 0.96), rgba(18, 23, 33, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-2xl);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent 34%);
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-premium {
  border-color: rgba(216, 163, 58, 0.28);
  box-shadow: var(--shadow);
}

.panel-premium::after {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(216, 163, 58, 0.5), transparent);
  z-index: 1;
  transition: opacity 0.4s ease;
}


.form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1 1 160px;
  min-width: 140px;
}

.field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-muted);
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--text-soft);
  line-height: 1.35;
}

.required-mark,
.field-required {
  color: var(--danger);
  margin-left: 2px;
  font-weight: 700;
}

.field-error,
.auth-error {
  font-size: var(--text-xs);
  color: var(--danger);
  line-height: 1.35;
}

.cert-link {
  color: var(--primary-light);
  text-decoration: none;
}

.cert-link:hover {
  text-decoration: underline;
}

/* Base input, select, textarea styling */
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
.field select,
.field textarea,
.link-box input,
#export-posto-input {
  width: 100%;
  padding: 8px 12px;
  min-height: 38px;
  border: 1px solid var(--text-soft);
  border-radius: var(--radius-xs);
  background: rgba(11, 15, 22, 0.65);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  box-sizing: border-box;
}

#export-posto-input {
  flex: 1;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.filter-search::placeholder,
#export-posto-input::placeholder,
.drone-hist-add input::placeholder {
  color: var(--text-soft);
  opacity: 1;
}

/* Focus states */
.field input:focus,
.field select:focus,
.field textarea:focus,
.link-box input:focus,
#export-posto-input:focus,
.drone-hist-add input:focus,
.curso-pilotos-editable-cell:focus,
.player-speed:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(111, 162, 255, 0.25);
}

/* Error / Validation states (controlados por classe ou acessibilidade) */
.field input.is-invalid,
.field select.is-invalid,
.field textarea.is-invalid,
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.field input.is-invalid:focus,
.field select.is-invalid:focus,
.field textarea.is-invalid:focus,
.field input[aria-invalid="true"]:focus,
.field select[aria-invalid="true"]:focus,
.field textarea[aria-invalid="true"]:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(241, 109, 85, 0.25);
}

/* Readonly states */
.field input:read-only,
.field textarea:read-only,
.link-box input:read-only {
  background: rgba(16, 21, 31, 0.85);
  border-color: rgba(151, 169, 205, 0.14);
  color: var(--text);
  cursor: default;
  user-select: text;
}

/* Disabled states */
.field input:disabled,
.field select:disabled,
.field textarea:disabled,
.curso-pilotos-editable-cell:disabled {
  background: rgba(11, 15, 22, 0.35);
  border-color: rgba(151, 169, 205, 0.1);
  color: var(--text-soft);
  opacity: 0.46;
  cursor: not-allowed;
  user-select: none;
}

/* Date input styling */
input[type="date"] {
  color-scheme: dark;
  max-width: 100%;
  box-sizing: border-box;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8) sepia(10%) saturate(200%) hue-rotate(180deg);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* File / Upload styling */
.field input[type="file"],
input[type="file"] {
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  background: rgba(11, 15, 22, 0.5);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  padding: 5px 12px;
  margin-right: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
  background: var(--primary-wash);
  border-color: var(--primary-light);
}

/* Checkbox and Radio styling */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary-light);
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}

/* Autofill styling for dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-elevated) inset !important;
  caret-color: var(--text) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Editable cells in grids */
.curso-pilotos-editable-cell {
  padding: 4px 8px;
  min-height: 30px;
  font-size: var(--text-xs);
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
}

.field-wide {
  flex-basis: 100%;
}

.dual-list {
  display: flex;
  gap: var(--space-md);
}

.dual-list-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1 1 50%;
  min-width: 0;
}

.dual-list-header {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.dual-list-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  height: 160px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
}

.dual-list-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.dual-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  font-size: var(--text-sm);
  cursor: pointer;
}

.dual-list-item:hover {
  background: var(--primary-wash);
  border-color: var(--border);
}

.dual-list-item-selected,
.dual-list-item-catalog-selected {
  background: var(--primary-wash);
  color: var(--primary);
}

.dual-list-delete {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(241, 109, 85, 0.26);
  border-radius: var(--radius-xs);
  background: rgba(241, 109, 85, 0.08);
  color: var(--danger);
  font-size: var(--text-md);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.dual-list-delete:hover {
  background: rgba(241, 109, 85, 0.16);
  border-color: rgba(241, 109, 85, 0.42);
}

.dual-list-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 6px 8px;
}

/* ==========================================================================
   SISTEMA DE BOTÕES E AÇÕES (FASE 4)
   ========================================================================== */

/* 1. Base Button System */
.btn,
button.primary,
button.secondary,
button.danger,
button.link,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost,
.btn-link,
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  vertical-align: middle;
  text-decoration: none;
  box-sizing: border-box;
  transition: background-color 150ms ease,
              border-color 150ms ease,
              color 150ms ease,
              box-shadow 150ms ease,
              transform 120ms ease,
              opacity 150ms ease;
}

.btn .icon,
button .icon {
  flex-shrink: 0;
  pointer-events: none;
}

/* 2. Escala de Tamanhos (Default, Small, Large) */
.btn,
button.primary,
button.secondary,
button.danger,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost {
  height: 38px;
  min-height: 38px;
  padding: 0 var(--space-lg);
}

.btn-sm,
.small,
button.small,
button.link,
.btn-link {
  height: 30px;
  min-height: 30px;
  padding: 0 var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  gap: 4px;
  border-radius: var(--radius-xs);
}

.btn-lg,
.large,
button.large {
  height: 44px;
  min-height: 44px;
  padding: 0 var(--space-xl);
  font-size: var(--text-md);
  font-weight: 700;
  border-radius: var(--radius);
}

/* 3. Variante PRIMARY (Ação Principal Positiva) */
.btn-primary,
button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(36, 78, 145, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover,
button.primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #4779ca);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(36, 78, 145, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:active,
button.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(36, 78, 145, 0.3), inset 0 1px 0 rgba(0, 0, 0, 0.1);
}
.btn-primary:focus-visible,
button.primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45), 0 2px 8px rgba(36, 78, 145, 0.35);
}

/* 4. Variante SECONDARY (Ação Neutra / Alternativa) */
.btn-secondary,
button.secondary {
  background: rgba(151, 169, 205, 0.08);
  color: var(--text);
  border-color: var(--text-soft);
}
.btn-secondary:hover,
button.secondary:hover {
  background: rgba(151, 169, 205, 0.16);
  border-color: rgba(216, 163, 58, 0.4);
  color: var(--text);
  transform: translateY(-1px);
}
.btn-secondary:active,
button.secondary:active {
  background: rgba(151, 169, 205, 0.12);
  transform: translateY(0);
}
.btn-secondary:focus-visible,
button.secondary:focus-visible {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(111, 162, 255, 0.35);
}

/* 5. Variante DANGER (Ação Destrutiva) */
.btn-danger,
button.danger {
  background: rgba(241, 109, 85, 0.08);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover,
button.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(241, 109, 85, 0.35);
}
.btn-danger:active,
button.danger:active {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: #ffffff;
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(241, 109, 85, 0.25);
}
.btn-danger:focus-visible,
button.danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(241, 109, 85, 0.4);
}

/* 6. Variante GHOST / LINK (Ação Suave / Inline) */
.btn-ghost,
.btn-link,
button.link {
  background: transparent;
  border-color: var(--text-soft);
  color: var(--text-muted);
}
.btn-ghost:hover,
.btn-link:hover,
button.link:hover {
  background: rgba(151, 169, 205, 0.1);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.btn-ghost:active,
.btn-link:active,
button.link:active {
  background: rgba(151, 169, 205, 0.14);
  transform: translateY(0);
}
.btn-ghost:focus-visible,
.btn-link:focus-visible,
button.link:focus-visible {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(111, 162, 255, 0.3);
}

/* 7. Variante ICON BUTTON (.btn-icon, .modal-close) */
.btn-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-icon:hover {
  background: rgba(151, 169, 205, 0.12);
  border-color: var(--border);
  color: var(--text);
  transform: translateY(-1px);
}
.btn-icon:active {
  background: rgba(151, 169, 205, 0.2);
  transform: translateY(0);
}
.btn-icon:focus-visible {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.btn-icon.small,
.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: var(--radius-xs);
}

/* 8. Botão Fechar Modal (.modal-close) */
.modal-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease;
}
.modal-close .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}
.modal-close:hover {
  color: var(--text);
  background: rgba(151, 169, 205, 0.12);
  border-color: var(--border);
  transform: translateY(-1px);
}
.modal-close:active {
  transform: translateY(0);
  background: rgba(151, 169, 205, 0.2);
}
.modal-close:focus-visible {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* 9. Estados Desabilitado e Carregando */
button:disabled,
.btn:disabled,
button[disabled],
button[aria-disabled="true"],
.btn[aria-disabled="true"] {
  opacity: 0.46 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn-loading,
button.btn-loading,
button:disabled.btn-loading {
  opacity: 0.72 !important;
  cursor: wait !important;
  pointer-events: none !important;
  transform: none !important;
}

.stat-grid-wrapper {
  position: relative;
  margin-bottom: var(--space-lg);
  min-width: 0;
  max-width: 100%;
}

.stat-grid-viewport {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  contain: paint;
  -webkit-overflow-scrolling: touch;
}

.stat-grid {
  display: flex;
  flex-direction: row;
  gap: 16px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 20px 0 28px;
  margin: 0;
}

.stat-grid::-webkit-scrollbar {
  display: none;
}

.stat-grid-viewport::-webkit-scrollbar {
  display: none;
}

.stat-grid-viewport > #stat-grid {
  width: max-content;
  min-width: 100%;
  max-width: none;
  overflow: visible;
  scroll-snap-type: none;
}

#sarpas-resumo-grid {
  width: 100%;
}

#sarpas-resumo-grid .stat-tile {
  flex: 1 1 auto;
  min-width: 0;
}

/* Cada card do carrossel */
.stat-carousel-item {
  flex: 0 0 300px;
  min-height: 200px;
  scroll-snap-align: center;
  transition:
    transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  /* desativar o transform do hover herdado enquanto o carrossel controla */
}

/* Sobrescreve o hover padrão para não conflitar com o efeito de profundidade */
.stat-carousel-item:hover {
  transform: none !important;
  box-shadow:
    0 24px 48px -16px rgba(36, 78, 145, 0.45),
    0 0 0 1px rgba(216, 163, 58, 0.45),
    0 0 28px rgba(36, 78, 145, 0.22) !important;
  border-color: rgba(216, 163, 58, 0.45) !important;
  opacity: 1 !important;
}

/* Botões de navegação */
.carousel-nav {
  position: absolute;
  bottom: 0;
  transform: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(216, 163, 58, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(29, 36, 49, 0.94), rgba(18, 23, 33, 0.97));
  color: var(--gold);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.25s ease, background 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
  padding: 0;
}

.carousel-nav:hover {
  background: linear-gradient(180deg, rgba(36, 78, 145, 0.6), rgba(18, 23, 33, 0.97));
  border-color: rgba(216, 163, 58, 0.55);
}

.carousel-nav:disabled {
  opacity: 0 !important;
  pointer-events: none !important;
}

.carousel-prev {
  left: 8px;
}

.carousel-next {
  right: 8px;
}

#sarpas-resumo-grid {
  margin-bottom: 1.5rem;
}

.section-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
}

.expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1.5px solid transparent;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  transform: translateZ(0);
}

.expiry-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  background: currentColor;
  box-shadow: 0 0 16px currentColor, inset 0 0 6px rgba(255, 255, 255, 0.24);
  animation: badge-pulse 2.5s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 16px currentColor, inset 0 0 6px rgba(255, 255, 255, 0.24); }
  50% { box-shadow: 0 0 28px currentColor, inset 0 0 10px rgba(255, 255, 255, 0.32); }
}

.expiry-badge.ok,
.expiry-badge.good { background: var(--status-good-wash); color: var(--status-good); border-color: rgba(88, 197, 138, 0.42); }
.expiry-badge.ok:hover,
.expiry-badge.good:hover { background: rgba(88, 197, 138, 0.28); box-shadow: 0 0 24px rgba(88, 197, 138, 0.24), 0 4px 12px rgba(0, 0, 0, 0.3); }

.expiry-badge.warning,
.expiry-badge.warn { background: var(--status-warning-wash); color: var(--status-warning); border-color: rgba(216, 163, 58, 0.44); }
.expiry-badge.warning:hover,
.expiry-badge.warn:hover { background: rgba(216, 163, 58, 0.28); box-shadow: 0 0 24px rgba(216, 163, 58, 0.28), 0 4px 12px rgba(0, 0, 0, 0.3); }

.expiry-badge.critical,
.expiry-badge.bad { background: var(--status-critical-wash); color: var(--status-critical); border-color: rgba(241, 109, 85, 0.44); }
.expiry-badge.critical:hover,
.expiry-badge.bad:hover { background: rgba(241, 109, 85, 0.28); box-shadow: 0 0 24px rgba(241, 109, 85, 0.28), 0 4px 12px rgba(0, 0, 0, 0.3); }

.stat-tile {
  position: relative;
  overflow: hidden;
  color: var(--text);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(29, 36, 49, 0.97), rgba(14, 18, 28, 0.99)),
    radial-gradient(circle at 80% 0%, rgba(36, 78, 145, 0.42), transparent 12rem),
    radial-gradient(circle at 10% 90%, rgba(216, 163, 58, 0.08), transparent 10rem);
  border: 1px solid rgba(151, 169, 205, 0.2);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    0 0 18px rgba(36, 78, 145, 0.12);
  padding: 22px 24px;
  min-height: 168px;
  transform: translateZ(0);
  transform-style: preserve-3d;
  perspective: 1000px;
  opacity: 0;
  animation: stat-tile-enter 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--enter-delay, 0s);
  will-change: transform, opacity, box-shadow;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease,
              background 0.5s ease;
}

@keyframes stat-tile-enter {
  0% { opacity: 0; transform: translateY(28px) scale(0.88) rotateX(-20deg); }
  50% { opacity: 0.8; transform: translateY(-6px) scale(1.03) rotateX(3deg); }
  75% { opacity: 1; transform: translateY(2px) scale(0.99) rotateX(-1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0); }
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.07), transparent 30%);
  transition: opacity 0.4s;
  z-index: 1;
}

.stat-tile::after {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(216, 163, 58, 0.72), transparent);
  z-index: 1;
}

.stat-tile > * {
  position: relative;
  z-index: 2;
}

/* Efeito 3D no hover (perspective tilt) */
.stat-tile:hover {
  transform: translateY(-8px) scale(1.018) rotateX(-2deg) rotateY(1deg);
  box-shadow:
    0 38px 80px -18px rgba(36, 78, 145, 0.64),
    0 0 0 1px rgba(216, 163, 58, 0.6),
    0 0 48px rgba(36, 78, 145, 0.36),
    inset 0 1px 12px rgba(216, 163, 58, 0.12);
  border-color: rgba(216, 163, 58, 0.56);
  background:
    linear-gradient(180deg, rgba(40, 50, 72, 0.98), rgba(20, 26, 40, 0.99)),
    radial-gradient(circle at 80% 0%, rgba(36, 78, 145, 0.58), transparent 12rem),
    radial-gradient(circle at 10% 90%, rgba(216, 163, 58, 0.16), transparent 10rem);
}

/* Halo radial no hover */
.stat-tile .stat-halo {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(216, 163, 58, 0.28), transparent 35%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.stat-tile:hover .stat-halo {
  opacity: 1;
}

/* SVG decorativo no canto */
.stat-tile .stat-decor {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 100px;
  height: 100px;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.stat-tile:hover .stat-decor {
  opacity: 0.22;
  transform: scale(1.12) rotate(-4deg);
}

/* Dashboard view premium surface */
.dashboard-view::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 10%, rgba(36, 78, 145, 0.06), transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(216, 163, 58, 0.04), transparent 35%);
  z-index: -1;
}

.stat-tile-clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-tile-clickable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.stat-tile-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Skeleton loading ---------- */
.stat-tile-skeleton {
  pointer-events: none;
  animation: none;
  opacity: 0.6;
}

.skeleton-line {
  position: relative;
  background: rgba(151, 169, 205, 0.08);
  border-radius: var(--radius-xs);
  overflow: hidden;
  margin: 8px 0;
}

.skeleton-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: shimmer 1.6s linear infinite;
}

.skeleton-label { width: 38%; height: 12px; }
.skeleton-value { width: 60%; height: 32px; margin: 18px 0; }
.skeleton-desc  { width: 78%; height: 10px; }
.skeleton-row { width: 90%; height: 14px; }
.skeleton-row.short { width: 50%; }

/* Skeleton genérico para tabelas e cards (Fase 4C) */
.skeleton-cell {
  width: 80%;
  height: 14px;
  margin: 6px 0;
}
.skeleton-row-tr td {
  padding: 10px 8px;
}
.skeleton-card {
  padding: var(--space-lg);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.skeleton-card-title {
  width: 60%;
  height: 16px;
  margin-bottom: 10px;
}
.skeleton-card-sub {
  width: 40%;
  height: 12px;
}

/* Estado vazio com CTA */
.empty-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.empty-cta {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
}
.empty-cta:hover {
  opacity: 0.9;
}
.empty-cta:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduzir animações para quem prefere */
@media (prefers-reduced-motion: reduce) {
  .skeleton-line::after {
    animation: none;
  }
  .stat-tile-skeleton {
    animation: none;
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}


/* Animação pulse no número grande */
@keyframes value-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.stat-value.animating {
  animation: value-pulse 0.6s ease-out;
}

/* Breakdown items com animação própria */
.stat-breakdown-item {
  position: relative;
  overflow: hidden;
}

.stat-breakdown-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.stat-breakdown-item:hover::before {
  transform: translateX(100%);
}

.toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.toggle-btn {
  padding: 6px 14px;
  font-size: var(--text-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

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

.stat-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(36, 78, 145, 0.55), rgba(216, 163, 58, 0.22)),
    radial-gradient(circle at 60% 30%, rgba(255, 255, 255, 0.08), transparent);
  border: 1.5px solid rgba(216, 163, 58, 0.42);
  color: var(--gold);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.14),
    0 4px 12px rgba(0,0,0,0.34),
    0 0 20px rgba(216, 163, 58, 0.2);
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: icon-float 3.5s ease-in-out infinite;
}

.stat-icon .icon {
  width: var(--icon-xl);
  height: var(--icon-xl);
}

@keyframes icon-float {
  0%, 100% { transform: translateY(0) rotateY(0); }
  50% { transform: translateY(-3px) rotateY(8deg); }
}

.stat-tile:hover .stat-icon {
  transform: translateZ(20px) rotateZ(-5deg) scale(1.1);
}

.stat-value {
  font-size: clamp(2.2rem, 4vw, 3.05rem);
  line-height: 1;
  font-weight: 800;
  margin: 18px 0 14px;
  letter-spacing: -0.06em;
  font-variant-numeric: proportional-nums;
  color: var(--text);
  text-shadow: 0 10px 28px rgba(36, 78, 145, 0.28);
  background: linear-gradient(180deg, #f7f9ff 0%, #aab6cb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stat-tile:hover .stat-value {
  transform: translateZ(15px);
}

.stat-description {
  margin: -6px 0 14px;
  color: var(--text-soft);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.stat-value-text {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 10px 0 4px;
  line-height: 1.25;
  word-break: break-word;
  color: var(--text);
  letter-spacing: -0.01em;
}

.stat-hint {
  margin-top: auto;
  padding-top: 12px;
  color: var(--primary-light);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.stat-tile-clickable:hover .stat-hint {
  opacity: 1;
  transform: translateX(3px);
}

.stat-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.stat-breakdown-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(151, 169, 205, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(11, 15, 22, 0.34);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  flex: 0 0 auto;
}

.stat-dot.good,
.stat-dot.ok { background: var(--status-good); }
.stat-dot.warning,
.stat-dot.warn { background: var(--status-warning); }
.stat-dot.critical,
.stat-dot.bad { background: var(--status-critical); }
.stat-dot.info { background: var(--status-info); }
.stat-dot.neutral { background: var(--status-neutral); }

.stat-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.technical-table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  color: var(--text);
}

.technical-table {
  width: 100%;
  border-collapse: collapse;
}

/* Larguras mínimas técnicas calibradas individualmente por conteúdo */
#logs-dji-table {
  min-width: 800px;
}

#voos-table {
  min-width: 900px;
}

#view-termos-table {
  min-width: 720px;
}

#termo-pilotos-table {
  min-width: 880px;
}

#avaliacao-pilotos-table {
  min-width: 600px;
}

th, td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: break-word;
}

th {
  color: var(--text-muted);
  background: var(--primary-wash);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody tr.row-clickable {
  cursor: pointer;
}

tbody tr.row-clickable:hover {
  background: var(--primary-wash);
}

/* Densidade e alinhamento padronizados */
.table-compact th,
.table-compact td {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
}

.table-actions-cell,
.actions-cell,
td:has(> .table-actions),
td:has(> .btn-group) {
  white-space: nowrap;
}

/* Ações internas das fichas e tabelas: todas as variantes usam a mesma
   geometria compacta, para que pares de decisão permaneçam alinhados. */
.table-actions-cell > button.primary,
.table-actions-cell > button.link,
.table-actions-cell > button.danger {
  height: 30px;
  min-height: 30px;
  padding: 0 var(--space-sm);
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: 500;
  vertical-align: middle;
}

.table-actions-cell > button.primary .icon,
.table-actions-cell > button.link .icon,
.table-actions-cell > button.danger .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

/* Central PMES: os comandos de cabeçalho seguem a geometria e o
   alinhamento dos botões padrão, inclusive quando acompanhados de ícone. */
#pmes-central .header-actions > button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  padding: 0 var(--space-lg);
  line-height: 1.2;
}

/* O ícone não participa da largura do conteúdo: assim, o rótulo permanece
   geometricamente centralizado dentro do botão. */
#pmes-central .header-actions > button .icon,
#pmes-changes .table-actions-cell > button.primary .icon {
  position: absolute;
  left: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
}

#pmes-changes .table-actions-cell > button.primary {
  position: relative;
  justify-content: center;
}

/* Retorno de progresso durante a auditoria manual da PMES. */
#pmes-btn-verificar-agora.is-loading {
  position: relative;
  cursor: wait;
}

#pmes-btn-verificar-agora.is-loading:disabled {
  opacity: 0.72 !important;
  cursor: wait !important;
}

#pmes-btn-verificar-agora.is-loading .spinner-inline {
  position: absolute;
  left: var(--space-sm);
  top: calc(50% - 6.5px);
}

.pmes-progress-box {
  align-items: center;
  gap: 10px;
}

.pmes-progress-content {
  display: grid;
  flex: 1;
  gap: 6px;
  min-width: 0;
}

.pmes-progress-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
}

.pmes-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: width 420ms ease;
}

.pmes-progress-track.is-indeterminate .pmes-progress-fill {
  width: 36%;
  animation: pmes-progress-indeterminate 1.25s ease-in-out infinite;
}

.pmes-progress-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

@keyframes pmes-progress-indeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(330%); }
}

@media (prefers-reduced-motion: reduce) {
  .pmes-progress-track.is-indeterminate .pmes-progress-fill,
  #pmes-btn-verificar-agora.is-loading .spinner-inline {
    animation: none;
  }
}

.table-actions-cell > * + * {
  margin-left: 6px;
}

th.text-center,
td.text-center {
  text-align: center;
}

th.text-right,
td.text-right {
  text-align: right;
}

th.text-left,
td.text-left {
  text-align: left;
}

.drone-badge-list {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drone-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}

.drone-count-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#table td.drones-cell {
  width: 200px;
  max-width: 200px;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.good,
.badge.ok,
.badge--good {
  background: var(--status-good-wash);
  color: var(--status-good);
  border-color: rgba(88, 197, 138, 0.35);
}

.badge.warning,
.badge.warn,
.badge--warning {
  background: var(--status-warning-wash);
  color: var(--status-warning);
  border-color: rgba(216, 163, 58, 0.35);
}

.badge.critical,
.badge.bad,
.badge.danger,
.badge--critical {
  background: var(--status-critical-wash);
  color: var(--status-critical);
  border-color: rgba(241, 109, 85, 0.35);
}

.badge.info,
.badge--info {
  background: var(--status-info-wash);
  color: var(--status-info);
  border-color: rgba(111, 162, 255, 0.35);
}

.badge.neutral,
.badge--neutral {
  background: var(--status-neutral-wash);
  color: var(--status-neutral);
  border-color: rgba(170, 182, 203, 0.22);
}

/* Estado vazio — movido para seção skeleton (Fase 4C) */

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.pagination-per-page {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pagination-per-page select {
  padding: 5px 8px;
  border: 1px solid var(--text-soft);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-sm);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.pagination-numbers button {
  min-width: 32px;
  padding: 5px 8px;
  border: 1px solid var(--text-soft);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-sm);
}

.pagination-numbers button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination-numbers span {
  padding: 0 4px;
  color: var(--text-muted);
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ==========================================================================
   LISTAGENS TABULARES — GEOMETRIA ESTRUTURAL COMPARTILHADA (DESKTOP TABULAR)
   Padroniza proporção, distribuição vertical e respiro entre telas de listagem
   usando como referência visual estrutural o painel de #cursos-expiry-table.
   ========================================================================== */

.table-listing-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 700px;
  box-sizing: border-box;
}

.table-listing-panel > .filter-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  min-height: 36px;
  margin-bottom: var(--space-lg);
  /* O menu de habilitação é absoluto; este contexto precisa ficar acima da
     tabela irmã para que o dropdown não seja encoberto. */
  z-index: 2;
}

.table-listing-panel > .filter-bar .filter-search {
  height: 34px;
  padding: 6px 12px;
  box-sizing: border-box;
}

.table-listing-panel > .filter-bar .filter-status,
.table-listing-panel > .filter-bar .dropdown-select-btn {
  height: 34px;
  box-sizing: border-box;
}

.table-listing-panel > .table-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 536px;
  width: 100%;
  box-sizing: border-box;
}

.table-listing-panel > .table-wrap > table {
  width: 100%;
  flex: 0 0 auto;
  border-collapse: collapse;
}

.table-listing-panel > .table-wrap > table thead tr {
  height: 36px;
}

.table-listing-panel > .table-wrap > table thead th {
  padding: 8px 12px;
  vertical-align: middle;
  line-height: 1.3;
  text-align: center;
}

#table thead th,
#unidade-recurso-table thead th,
#unidade-termos-table thead th {
  text-align: center;
}

.table-listing-panel > .table-wrap > table tbody tr {
  height: 50px;
}

.table-listing-panel > .table-wrap > table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  line-height: 1.4;
}

.table-listing-panel > .table-wrap > .empty-msg {
  margin: auto;
  padding: var(--space-2xl);
  text-align: center;
}

.table-listing-panel > .pagination-bar {
  flex: 0 0 auto;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  min-height: 34px;
  box-sizing: border-box;
}

/* ---------- Operação Coordenada ---------- */

.badge.amber { background: rgba(184, 121, 15, 0.15); color: var(--status-warning); }

.op-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.op-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  width: 100%;
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  cursor: default;
}

.op-card-main {
  min-width: 0;
}

.op-card-nome {
  font-weight: 600;
  font-size: var(--text-md);
}

.op-card-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.op-card-side {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 0 0 auto;
}

.op-card-chevron {
  color: var(--text-muted);
  font-size: var(--text-lg);
}

.stepper {
  display: flex;
  align-items: center;
  margin: 4px 0 24px;
}

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex: 0 0 auto;
  color: var(--text-muted);
}

.stepper-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-circle);
  border: 2px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  font-size: var(--text-sm);
}

.stepper-label {
  font-size: var(--text-xs);
  white-space: nowrap;
}

.stepper-step.active { color: var(--primary); }
.stepper-step.active .stepper-circle {
  border-color: var(--primary);
  color: var(--primary);
}

.stepper-step.done .stepper-circle {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.stepper-connector {
  flex: 1 1 auto;
  height: 2px;
  background: var(--border);
  margin: 0 6px 20px;
}

.op-step-actions {
  margin-top: var(--space-lg);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-sm);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.chip-selected {
  background: var(--primary-wash);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.chip.chip-dashed {
  border-style: dashed;
  color: var(--text-muted);
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  padding: max(20px, var(--safe-top)) max(20px, var(--safe-right))
    max(20px, var(--safe-bottom)) max(20px, var(--safe-left));
  z-index: var(--z-auth);
}

.auth-screen[hidden] {
  display: none;
}

/* reforca via classe setada por um script inline no <head> (roda antes do
   body ser desenhado) -- o painel principal e a tela de login nunca devem
   aparecer, nem por uma fracao de segundo, na pagina de definir senha */
html.is-definir-senha #app-root,
html.is-definir-senha #login-screen {
  display: none !important;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 360px;
  padding: 24px 24px 28px;
}

.auth-card .brand {
  justify-content: center;
  padding: 0 0 20px;
}

/* .form/.field por padrao sao pensados pra linha (varios campos lado a
   lado, ex: telas de cadastro) -- no cartao estreito de login/definir
   senha isso fazia os 2 campos de senha ficarem espremidos lado a lado
   em vez de empilhados */
.auth-card .form {
  flex-direction: column;
  align-items: stretch;
}

.auth-card .field {
  flex: none;
  width: 100%;
}

.auth-card .form-actions {
  flex-direction: column;
}

.auth-card .form-actions button {
  width: 100%;
}

.auth-error {
  color: var(--danger);
  font-size: var(--text-sm);
  margin: 0 0 12px;
}

.link-box {
  display: flex;
  gap: var(--space-sm);
}

.link-box input {
  flex: 1;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-base);
  font-weight: 400;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  box-shadow: var(--shadow);
  max-width: calc(100vw - max(32px, var(--safe-left)) - max(32px, var(--safe-right)));
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
}

.toast[hidden] { display: none; }

.toast-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.toast-icon .icon {
  width: var(--icon-lg);
  height: var(--icon-lg);
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: inherit;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  opacity: 0.7;
  border-radius: var(--radius-xs);
}

.toast-close .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}
.toast-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.toast-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.toast-success {
  background: var(--surface-2);
  border: 1px solid var(--status-good);
  color: var(--text);
}
.toast-success .toast-icon {
  color: var(--status-good);
}

.toast-error,
.toast.error {
  background: var(--surface-2);
  border: 1px solid var(--status-critical);
  color: var(--text);
}
.toast-error .toast-icon,
.toast.error .toast-icon {
  color: var(--status-critical);
}

.toast-warning {
  background: var(--surface-2);
  border: 1px solid var(--status-warning);
  color: var(--text);
}
.toast-warning .toast-icon {
  color: var(--status-warning);
}

.toast-info {
  background: var(--surface-2);
  border: 1px solid var(--status-info);
  color: var(--text);
}
.toast-info .toast-icon {
  color: var(--status-info);
}

@media (max-width: 1100px) {
  .app {
    flex-direction: column;
  }

  .content {
    padding: 24px 18px 48px;
  }

  /* === Carrossel em tablets === */
  .stat-grid {
    gap: 14px;
    padding: 18px 5px 26px;
    margin: 0 -5px;
  }

  .stat-carousel-item {
    flex: 0 0 310px;
  }

  .carousel-nav {
    width: 42px;
    height: 42px;
    font-size: var(--text-lg);
    bottom: 0;
    transform: none;
  }
}

@media (max-width: 900px) {
  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .dashboard-hero-visual {
    position: absolute;
    right: -28px;
    bottom: -24px;
    opacity: 0.42;
  }

  .stat-grid {
    gap: 10px;
    padding: 14px 4px 22px;
  }

  .stat-carousel-item {
    flex: 0 0 260px;
    min-height: 170px;
  }

  .carousel-nav {
    display: none;
  }

  .section-heading {
    margin-top: var(--space-2xl);
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-status,
  .filter-search,
  .dropdown-select,
  .dropdown-select-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .stat-tile {
    padding: 14px 16px;
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  .modal.modal-wide,
  .modal.modal-xwide {
    max-width: 96vw;
    margin: 2vh auto;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #table {
    font-size: var(--text-sm);
  }

  #table:not(.responsive-card-table) thead th,
  #table:not(.responsive-card-table) tbody td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  .panel-premium {
    padding: var(--space-md);
  }

  .pagination-bar {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: stretch;
  }

  .pagination-controls {
    justify-content: space-between;
  }
}

/* Leaflet layer control - tema escuro */
.leaflet-control-layers {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-xs) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  color: var(--text) !important;
  padding: 8px !important;
  max-height: 70vh;
  overflow-y: auto;
}

.leaflet-control-layers-expanded {
  padding: 10px 12px !important;
}

.leaflet-control-layers-list {
  color: var(--text) !important;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
  color: var(--text) !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 0 !important;
  font-size: var(--text-sm) !important;
}

.leaflet-control-layers-separator {
  border-top: 1px solid var(--border) !important;
  margin: 6px 0 !important;
}

.leaflet-control-layers input[type="checkbox"] {
  cursor: pointer;
}

.leaflet-control-layers-selector {
  margin-right: 6px !important;
}

/* Scrollbar do control de camadas */
.leaflet-control-layers::-webkit-scrollbar {
  width: 6px;
}

.leaflet-control-layers::-webkit-scrollbar-track {
  background: var(--surface);
}

.leaflet-control-layers::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-xs);
}

/* Marker de ponto - nome tooltip */
.ponto-marker-icon {
  background: transparent !important;
  border: none !important;
}

/* Tooltip permanente do ponto */
.ponto-tooltip {
  background: var(--bg-elevated) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-xs) !important;
  padding: 2px 6px !important;
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
  white-space: nowrap !important;
  opacity: 1;
  transition: opacity 0.3s;
}

.ponto-tooltip::before {
  border-top-color: var(--bg-elevated) !important;
}


/* Accessibility: respect reduced motion preference */
/* Drone player animation */
.drone-marker-icon {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.drone-marker-icon svg {
  transition: transform 0.15s ease-out;
  transform-origin: center center;
}

.drone-marker-icon.playing {
  animation: drone-pulse 1.5s ease-in-out infinite;
}

/* Drone Histórico */
.drone-hist-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.drone-hist-add input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  height: 34px;
}

.drone-hist-add input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  height: 34px;
}

.drone-hist-add button {
  padding: 6px 14px;
  font-size: var(--text-sm);
  height: 34px;
  white-space: nowrap;
}

.drone-hist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.drone-hist-item:last-child {
  border-bottom: none;
}

.drone-hist-item-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.drone-hist-item-date {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.drone-hist-item-obs {
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.drone-hist-item button.danger {
  padding: 4px 8px;
  font-size: var(--text-base);
  line-height: 1;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Export modal styles */
.export-section {
  margin-bottom: 24px;
}

.export-section h3 {
  margin: 0 0 12px 0;
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.export-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.export-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-checkbox-item input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.export-checkbox-item label {
  cursor: pointer;
  flex: 1;
  user-select: none;
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.35;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.chip-list .chip {
  background: var(--primary-wash);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-list .chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

@keyframes drone-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(100, 200, 255, 0.9));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== Fase 1: estrutura responsiva e navegacao por toque ========== */
@media (min-width: 1101px) and (hover: hover) and (pointer: fine) {
  .stat-grid-viewport {
    width: calc(100% + 34px);
    max-width: calc(100% + 34px);
  }
}

@media (max-width: 1100px),
  (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  img,
  svg,
  canvas,
  video,
  input,
  select,
  textarea {
    max-width: 100%;
  }

  main,
  section,
  .view,
  .panel,
  .dashboard-view,
  .dashboard-hero-content,
  .view-header > *,
  .section-heading > *,
  .modal,
  .modal-box,
  .modal-header > *,
  .modal-header-actions,
  .filter-bar,
  .pagination-bar,
  .voo-mapa-layout,
  .voo-mapa-holder,
  .voo-telemetria-sidebar {
    min-width: 0;
  }

  .app {
    width: 100%;
    flex-direction: column;
  }

  .stat-grid-viewport {
    width: 100%;
    max-width: 100%;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: calc(64px + var(--safe-top));
    padding: max(10px, var(--safe-top)) max(14px, var(--safe-right)) 10px
      max(14px, var(--safe-left));
    background:
      linear-gradient(180deg, rgba(15, 20, 29, 0.99), rgba(11, 15, 22, 0.98)),
      radial-gradient(circle at 20% 0%, rgba(36, 78, 145, 0.24), transparent 18rem);
    border-bottom: 1px solid rgba(216, 163, 58, 0.18);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mobile-brand .brand-mark {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
  }

  .mobile-brand .brand-name {
    font-size: var(--text-md);
  }

  .mobile-brand .brand-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-menu-toggle {
    display: grid;
    place-content: center;
    gap: 5px;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 9px;
    border: 1px solid rgba(216, 163, 58, 0.34);
    border-radius: var(--radius);
    background: rgba(36, 78, 145, 0.22);
    color: var(--text);
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 160ms ease, opacity 160ms ease;
  }

  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .mobile-menu-toggle:focus-visible,
  .nav-btn:focus-visible,
  .mobile-nav-backdrop:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--z-nav-drawer);
    display: flex;
    flex-direction: column;
    width: min(88vw, 320px);
    min-width: 0;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    padding: max(14px, var(--safe-top)) 14px max(14px, var(--safe-bottom))
      max(14px, var(--safe-left));
    border-right: 1px solid rgba(216, 163, 58, 0.24);
    border-bottom: none;
    overflow: hidden;
    visibility: hidden;
    transform: translateX(-105%);
    transition: transform 180ms ease, visibility 180ms ease;
    box-shadow: 18px 0 46px rgba(0, 0, 0, 0.42);
  }

  .app.mobile-nav-open .mobile-header {
    z-index: 1150;
  }

  .app.mobile-nav-open .sidebar {
    visibility: visible;
    transform: translateX(0);
  }

  .sidebar .brand {
    flex: 0 0 auto;
    margin-bottom: 10px;
    padding: 6px 10px 14px;
  }

  .side-nav {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 2px max(8px, var(--safe-bottom)) 0;
    -webkit-overflow-scrolling: touch;
  }

  .nav-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    white-space: normal;
    touch-action: manipulation;
  }

  .logout-btn {
    margin-top: auto;
    margin-left: 0;
  }

  .mobile-nav-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: var(--z-nav-backdrop);
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(3, 6, 12, 0.68);
    cursor: pointer;
  }

  body.mobile-nav-locked {
    overflow: hidden;
  }

  .content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-right: max(18px, var(--safe-right));
    padding-bottom: max(48px, var(--safe-bottom));
    padding-left: max(18px, var(--safe-left));
    scroll-margin-top: calc(64px + var(--safe-top) + 12px);
  }

  .view-header,
  .section-heading,
  .modal-header,
  .modal-header-actions,
  .form-actions,
  .filter-bar,
  .pagination-bar,
  .upload-actions,
  .history-actions,
  .link-box,
  .log-dji-upload-row {
    flex-wrap: wrap;
  }

  .log-dji-upload-row > * {
    min-width: 0;
    max-width: 100%;
  }

  #logs-dji-file {
    flex: 1 1 180px;
    width: 100%;
  }

  #logs-dji-upload-btn {
    flex: 1 1 auto;
  }

  .btn,
  button.primary,
  button.secondary,
  button.danger,
  button.link,
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .btn-ghost,
  .btn-link,
  .btn-icon,
  .modal-close,
  .filter-status,
  .dropdown-select-btn,
  .pagination-controls button,
  .dashboard-pagination-controls button,
  .dual-list button,
  .course-actions button,
  .chip-list .chip button {
    min-height: 44px;
    touch-action: manipulation;
  }

  .modal-close,
  .btn-icon,
  .chip-list .chip button {
    min-width: 44px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  .checkbox-item,
  .radio-item,
  .toggle-label {
    min-height: 44px;
  }

  .voo-telemetria-sidebar {
    width: min(340px, 100%);
    min-width: 0;
    max-width: 100%;
  }

  table:not(.responsive-card-table) .table-row-open {
    min-width: 44px;
    min-height: 44px;
    margin: -5px -6px;
    padding: 0 6px;
    touch-action: manipulation;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 14px max(12px, var(--safe-right)) max(32px, var(--safe-bottom))
      max(12px, var(--safe-left));
  }

  .modal-overlay {
    padding: max(8px, var(--safe-top)) max(8px, var(--safe-right))
      max(8px, var(--safe-bottom)) max(8px, var(--safe-left));
  }

  .modal,
  .modal-sm,
  .modal-wide,
  .modal-xwide,
  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - max(16px, var(--safe-top)) - max(16px, var(--safe-bottom)));
  }

  .view-header,
  .modal-header {
    align-items: flex-start;
  }

  .view-title,
  .modal-title {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .dashboard-pagination-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    gap: 4px;
  }

  .dashboard-pagination-controls button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .dashboard-pagination-controls .pagination-info {
    white-space: nowrap;
    text-align: center;
  }
}

@media (max-height: 600px) and (orientation: landscape) and (hover: none) {
  .mobile-header {
    min-height: calc(52px + var(--safe-top));
    padding-top: max(4px, var(--safe-top));
    padding-bottom: 4px;
  }

  .mobile-brand .brand-mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .sidebar {
    padding-top: max(8px, var(--safe-top));
    padding-bottom: max(8px, var(--safe-bottom));
  }

  .sidebar .brand {
    margin-bottom: 6px;
    padding-bottom: 8px;
  }

  .content {
    padding-top: 12px;
  }

}

/* ========== Fase 2B: tabelas, filtros e paginação em toque ========== */
@media (max-width: 1100px) {
  .table-listing-panel {
    min-height: auto;
  }

  .table-listing-panel > .table-wrap {
    min-height: auto;
  }

  .table-listing-panel > .table-wrap > table thead tr,
  .table-listing-panel > .table-wrap > table tbody tr {
    height: auto;
  }

  .table-listing-panel > .filter-bar .filter-search,
  .table-listing-panel > .filter-bar .filter-status,
  .table-listing-panel > .filter-bar .dropdown-select-btn {
    height: 44px;
    min-height: 44px;
  }

  .filter-bar {
    align-items: stretch;
  }

  .filter-bar > * {
    min-width: 0;
  }

  .filter-popover {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .filter-popover-row {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .filter-popover-row input[type="date"] {
    width: 100%;
  }

  .filter-popover-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-popover-actions button:last-child {
    grid-column: 1 / -1;
  }

  .pagination-bar {
    align-items: stretch;
  }

  .pagination-per-page {
    justify-content: space-between;
  }

  .pagination-controls {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .pagination-numbers {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .pagination-numbers button,
  .pagination-controls > button {
    min-width: 44px;
    min-height: 44px;
  }

  .pagination-info {
    width: 100%;
    text-align: center;
  }

  .technical-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 1100px) {
  .responsive-card-table {
    width: 100%;
  }

  .responsive-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .responsive-card-table,
  .responsive-card-table tbody,
  .responsive-card-table tr,
  .responsive-card-table td {
    display: block;
  }

  .responsive-card-table tbody {
    padding: 8px;
  }

  .responsive-card-table tr {
    margin: 0 0 10px;
    overflow: hidden;
    border: 1px solid rgba(151, 169, 205, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(11, 15, 22, 0.28);
  }

  .responsive-card-table tr:last-child {
    margin-bottom: 0;
  }

  .responsive-card-table td {
    display: grid;
    grid-template-columns: minmax(96px, 0.8fr) minmax(0, 1.2fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(151, 169, 205, 0.1);
    overflow-wrap: anywhere;
  }

  .responsive-card-table td:last-child {
    border-bottom: 0;
  }

  .responsive-card-table td::before {
    content: attr(data-label);
    min-width: 0;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .responsive-card-table td[data-label="Ações"] > * {
    min-height: 40px;
    margin: 0 6px 6px 0;
  }

  .responsive-card-table td[data-label="Ações"] button:last-child {
    margin-right: 0;
  }

  .responsive-card-table .drone-badge-list,
  .responsive-card-table .drone-chip-list {
    max-width: 100%;
    white-space: normal;
  }

  .responsive-card-table .drone-count-label {
    white-space: normal;
  }

  .table-wrap:has(.responsive-card-table) {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .responsive-card-table .table-row-open {
    min-height: 44px;
    width: 100%;
    padding: 8px 10px;
    margin: 0;
    touch-action: manipulation;
  }
}

@media (max-width: 480px) {
  .drone-hist-add {
    flex-wrap: wrap;
  }

  .responsive-card-table td {
    grid-template-columns: minmax(82px, 0.72fr) minmax(0, 1.28fr);
    gap: 8px;
    padding: 9px 10px;
  }

  .pagination-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .pagination-controls .pagination-numbers {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: -1;
  }

  .dashboard-pagination-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .dashboard-pagination-controls .pagination-info {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}
/* ========== Fase 2C: mapas, player DJI e telemetria em toque ========== */
.map-load-feedback {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: calc(var(--z-map-overlay) + 1);
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-xs);
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}

.map-load-feedback.is-error {
  border-color: rgba(248, 113, 113, 0.8);
  background: rgba(127, 29, 29, 0.94);
}

#telemetria-toggle {
  display: none;
}

.telemetria-head #telemetria-toggle {
  margin-left: auto;
  min-height: 32px;
  padding: 4px 8px;
  font-size: var(--text-xs);
}

@media (max-width: 1100px) {
  #telemetria-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .modal.modal-xwide:has(#log-dji-mapa),
  .modal.modal-xwide:has(#sarpas-heatmap-mapa) {
    width: min(100% - 20px, 900px);
    max-height: calc(100dvh - 20px);
    overflow: auto;
  }

  .voo-mapa-layout {
    flex-direction: column;
    height: auto;
  }

  .voo-mapa-holder,
  .voo-mapa-layout .voo-mapa,
  .voo-mapa-holder .voo-mapa,
  #sarpas-heatmap-mapa,
  #voo-mapa {
    height: clamp(280px, 52dvh, 480px);
  }

  .voo-telemetria-sidebar {
    flex: none;
    width: 100%;
    max-height: min(45dvh, 400px);
  }

  .player-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .player-controls button,
  .player-speed {
    min-height: 44px;
  }

  .player-slider {
    order: 3;
    flex-basis: 100%;
    height: 28px;
  }

  .player-time {
    min-width: 0;
    flex: 1;
    text-align: left;
  }

  .mapa-avisos {
    top: 78px;
    left: 8px;
    max-width: calc(100% - 16px);
  }

  .mapa-sticks {
    transform: scale(.84);
    transform-origin: right bottom;
  }

  .telemetria-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .voo-telemetria-sidebar.is-collapsed .telemetria-live,
  .voo-telemetria-sidebar.is-collapsed .voo-telemetria {
    display: none;
  }

  .voo-telemetria-sidebar.is-collapsed {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .modal.modal-xwide:has(#log-dji-mapa),
  .modal.modal-xwide:has(#sarpas-heatmap-mapa) {
    width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
  }

  .modal-header:has(#sarpas-heatmap-toggle) {
    align-items: flex-start;
  }

  #sarpas-heatmap-toggle {
    flex-wrap: wrap;
  }

  .voo-mapa-holder,
  .voo-mapa-layout .voo-mapa,
  .voo-mapa-holder .voo-mapa,
  #sarpas-heatmap-mapa,
  #voo-mapa {
    height: clamp(240px, 48dvh, 380px);
  }

  .telemetria-head {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .telemetria-head #telemetria-toggle {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
  }
}

/* Fullscreen SARPAS modal com safe areas para iPhone (Dynamic Island / notch / home indicator) */
#modal-sarpas-comparacao {
  padding: max(16px, var(--safe-top)) max(16px, var(--safe-right))
    max(16px, var(--safe-bottom)) max(16px, var(--safe-left)) !important;
}

/* O popover SARPAS é fixed e deve permanecer acima da tabela técnica. */
.filter-popover {
  z-index: 1001;
}

/* Fase 2A: confirmação exibida somente quando há edição não salva. */
.unsaved-confirm-overlay {
  z-index: 10050;
}

.unsaved-confirm-dialog {
  width: min(460px, calc(100vw - 32px));
}

.unsaved-confirm-actions {
  justify-content: flex-end;
}

@media (max-width: 480px) {
  .unsaved-confirm-dialog {
    width: calc(100vw - 24px);
  }

  .unsaved-confirm-actions {
    align-items: stretch;
  }

  .unsaved-confirm-actions button {
    width: 100%;
  }
}

/* Correção iPhone: em filtros empilhados, o flex-basis horizontal não pode
   virar altura. Mantém área de toque normal e remove o formato de pílula. */
@media (max-width: 900px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  .filter-bar .filter-search {
    flex: 0 0 44px;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: var(--radius);
    line-height: 20px;
    -webkit-appearance: none;
    appearance: none;
    font-size: 16px !important;
  }

  .filter-bar > select.filter-status,
  .filter-bar .dropdown-select-btn {
    height: 44px;
    min-height: 44px;
    font-size: 16px !important;
  }
}

/* A lista completa existe no DOM para leitores de tela e é visível nos
   cartões de toque. No desktop permanece o resumo visual já utilizado. */
.drone-model-list {
  display: none;
}

@media (max-width: 900px) {
  #table.responsive-card-table td.drones-cell {
    width: auto;
    max-width: none;
  }

  #table.responsive-card-table td.drones-cell .drone-badge-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    width: 100%;
    min-width: 0;
    overflow: visible;
    white-space: normal;
  }

  #table.responsive-card-table td.drones-cell .drone-count-badge {
    grid-column: 1;
    grid-row: 1;
    margin-top: 1px;
  }

  #table.responsive-card-table td.drones-cell .drone-count-label {
    display: none;
  }

  #table.responsive-card-table td.drones-cell .drone-model-list {
    display: block;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.4;
    white-space: normal;
  }
}

/* Ficha do piloto: contatos detectados pelo Safari continuam acionáveis,
   mas seguem a tipografia dos valores em vez do sublinhado nativo. */
#view-details .detail-value a[href^="tel:"],
#view-details .detail-value a[href^="mailto:"] {
  color: inherit !important;
  text-decoration: none !important;
  border-radius: var(--radius-xs);
}

#view-details .detail-value a[href^="tel:"]:focus,
#view-details .detail-value a[href^="mailto:"]:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

@supports selector(:focus-visible) {
  #view-details .detail-value a[href^="tel:"]:focus,
  #view-details .detail-value a[href^="mailto:"]:focus {
    outline: none;
  }

  #view-details .detail-value a[href^="tel:"]:focus-visible,
  #view-details .detail-value a[href^="mailto:"]:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
  }
}


/* ==========================================================================
   MODAL DE EXPORTAÇÃO DE UNIDADES (PDF) - LAYOUT PREMIUM & POLIDO
   ========================================================================== */

#unidades-export-modal .modal {
  width: min(720px, calc(100vw - 32px)) !important;
  max-width: 720px !important;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 24px 28px 24px;
  display: flex !important;
  flex-direction: column !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  box-sizing: border-box !important;
  overflow-y: hidden !important;
}

#unidades-export-modal .modal-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

#unidades-export-modal .modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

#unidades-export-modal .modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: calc(85vh - 160px) !important;
  max-height: calc(85dvh - 160px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding-right: 4px;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  gap: 16px !important;
}

#export-word-modal .modal,
#entity-export-modal .modal {
  display: flex !important;
  flex-direction: column !important;
  overflow-y: hidden !important;
}

#export-word-modal .modal-header,
#entity-export-modal .modal-header {
  flex: 0 0 auto;
}

#export-word-modal .modal-body,
#entity-export-modal .modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: calc(85vh - 140px) !important;
  max-height: calc(85dvh - 140px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

#export-word-modal .modal-footer,
#entity-export-modal .modal-footer {
  flex: 0 0 auto;
}

/* Seções em cartões organizados empilhados verticalmente */
#unidades-export-modal .export-card-section,
.export-card-section {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
}

.export-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.export-section-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-section-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.export-section-desc {
  margin: 0 0 10px 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.export-btn-group {
  display: flex;
  gap: 6px;
}

.export-btn-group .button,
.export-btn-group button {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-xs);
  line-height: 1.2;
}

.export-master-checkbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
}

.export-master-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  user-select: none;
}

.export-master-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.export-units-container {
  max-height: 160px;
  overflow-y: auto;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
}

@media (max-width: 560px) {
  .export-units-container {
    grid-template-columns: 1fr;
  }
}

.export-unit-item {
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  color: var(--text);
  transition: all 0.15s ease;
}

.export-unit-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.export-unit-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.export-unit-item span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grid de recursos */
.export-resources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

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

.export-resource-card {
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s ease;
}

.export-resource-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.export-resource-card input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

/* Formato de saída */
.export-format-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-format-card {
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.export-format-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.export-format-card input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.export-format-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-format-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.export-format-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Banner da regra de ordenação decrescente */
.export-rule-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-xs);
  background: var(--status-info-wash);
  border: 1px solid rgba(111, 162, 255, 0.35);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.35;
}

.export-rule-banner strong {
  color: var(--text);
}

#unidades-export-modal .modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TERMOS DE COORDENAÇÃO
   ============================================================ */
.termo-pilotos-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(36, 78, 145, 0.25);
  border: 1px solid rgba(111, 162, 255, 0.4);
  color: var(--primary-light);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.termo-pilotos-badge:hover {
  background: rgba(36, 78, 145, 0.5);
  border-color: #6fa2ff;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.btn-link-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.badge-termo-normal {
  background: var(--status-good-wash);
  color: var(--status-good);
  border: 1px solid rgba(88, 197, 138, 0.35);
}

.badge-termo-avencer {
  background: var(--status-warning-wash);
  color: var(--status-warning);
  border: 1px solid rgba(216, 163, 58, 0.35);
}

.badge-termo-vencido {
  background: var(--status-critical-wash);
  color: var(--status-critical);
  border: 1px solid rgba(241, 109, 85, 0.35);
}

/* Ficha do Piloto e Modais Ampliados */
#view-modal .modal.modal-wide,
#termo-pilotos-modal .modal.modal-wide {
  width: min(1360px, calc(100vw - 32px));
  max-width: 96vw;
  padding: 26px 32px;
}

#avaliacao-pilotos-modal .modal.modal-wide {
  width: min(960px, calc(100vw - 32px));
  max-width: 96vw;
  padding: 26px 32px;
}

#view-modal #view-details {
  display: grid;
  grid-template-columns: 1.3fr 0.85fr 1fr 0.85fr 1.2fr;
  align-items: start;
  gap: var(--space-md) var(--space-2xl);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xl) var(--space-2xl);
  margin-bottom: var(--space-2xl);
  width: 100%;
  box-sizing: border-box;
}

.detail-drones-col {
  grid-column: 5;
  grid-row: 1 / span 2;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.detail-drones-col .detail-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  line-height: 1.2;
}

.detail-drones-col .detail-value {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  max-height: 90px;
  overflow-y: auto;
}

.detail-drones-col .detail-value::-webkit-scrollbar {
  width: 4px;
}

.detail-drones-col .detail-value::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

#view-modal #view-details .detail-value .badge,
.detail-grid .detail-value .badge {
  display: inline-flex !important;
  width: fit-content !important;
  max-width: max-content !important;
  align-self: flex-start !important;
  padding: 4px 10px !important;
  font-size: var(--text-xs) !important;
  font-weight: 700 !important;
  border-radius: var(--radius-pill) !important;
  line-height: 1.2 !important;
}

/* Tabela de Cursos da Ficha do Piloto - Situação em uma única linha no modo tabular */
#view-cursos-table:not(.responsive-card-table) th:nth-child(5),
#view-cursos-table:not(.responsive-card-table) td:nth-child(5) {
  white-space: nowrap;
}

#view-cursos-table td:nth-child(5) .badge,
#view-cursos-table .badge-termo-normal,
#view-cursos-table .badge-termo-avencer,
#view-cursos-table .badge-termo-vencido {
  white-space: nowrap;
  display: inline-flex;
}

#view-cursos-table:not(.responsive-card-table) th:nth-child(2),
#view-cursos-table:not(.responsive-card-table) td:nth-child(2),
#view-cursos-table:not(.responsive-card-table) th:nth-child(3),
#view-cursos-table:not(.responsive-card-table) td:nth-child(3),
#view-cursos-table:not(.responsive-card-table) th:nth-child(4),
#view-cursos-table:not(.responsive-card-table) td:nth-child(4),
#view-cursos-table:not(.responsive-card-table) th:nth-child(6),
#view-cursos-table:not(.responsive-card-table) td:nth-child(6) {
  white-space: nowrap;
}

@media (max-width: 1024px) {
  #view-modal #view-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-drones-col {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 600px) {
  #view-modal #view-details {
    grid-template-columns: 1fr;
  }
}

/* Accessibility Utilities */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--surface);
  color: var(--gold);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gold);
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Semantic row trigger for keyboard and touch accessibility */
.table-row-open {
  background: transparent;
  border: 0;
  padding: 4px 6px;
  margin: -4px -6px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: var(--radius-xs);
  min-height: 28px;
  min-width: 24px;
  box-sizing: border-box;
}

.table-row-open:hover {
  color: inherit;
  text-decoration: none;
}

.table-row-open:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Technical scroll region focus indicators */
.technical-table-wrap:focus-visible,
.curso-pilotos-grid-wrap:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: -2px;
}

/* Reset para fieldsets acessíveis sem estilos em linha */
.a11y-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

/* ==========================================================================
   Aba Unidades - Colunas de Contagem, Ordenação e Modais de Recursos
   ========================================================================== */


/* Células e linhas centralizadas da aba Unidades */
td.text-center,
th.text-center {
  text-align: center;
}

td.text-center .table-cell-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

td.text-center .table-row-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 auto;
}

/* Modais de Recursos e Termos da Unidade - células centralizadas */
#unidade-recurso-table th,
#unidade-recurso-table td,
#unidade-termos-table th,
#unidade-termos-table td {
  text-align: center;
  vertical-align: middle;
}

#unidade-recurso-table td .badge,
#unidade-termos-table td .badge {
  display: inline-flex;
  justify-content: center;
  margin: 0 auto;
}

#unidade-recurso-table td.drones-cell .drone-badge-list {
  display: inline-flex;
  justify-content: center;
  width: 100%;
}

/* Células de contagem da Unidade */
td.unidade-count-cell {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  padding: 6px 12px;
}

/* Botão badge de contagem interativo */
.unidade-count-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 46px;
  height: 27px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  user-select: none;
  background: transparent;
  outline: none;
}

.unidade-count-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary-light);
}

.unidade-count-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  pointer-events: none;
  transition: transform 0.18s ease;
}

.unidade-count-num {
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* 1. Pilotos - Azul Refinado */
.unidade-count-btn--pilotos.unidade-count-btn--active {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
}
.unidade-count-btn--pilotos.unidade-count-btn--active:hover {
  background: rgba(59, 130, 246, 0.28);
  border-color: #60a5fa;
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 3px 12px rgba(59, 130, 246, 0.32);
}

/* 2. Drones - Ciano / Sky Moderno */
.unidade-count-btn--drones.unidade-count-btn--active {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}
.unidade-count-btn--drones.unidade-count-btn--active:hover {
  background: rgba(14, 165, 233, 0.28);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 3px 12px rgba(14, 165, 233, 0.32);
}

/* 3. Controles - Turquesa */
.unidade-count-btn--controles.unidade-count-btn--active {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(94, 234, 212, 0.38);
  color: #99f6e4;
}
.unidade-count-btn--controles.unidade-count-btn--active:hover {
  background: rgba(45, 212, 191, 0.28);
  border-color: #5eead4;
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 3px 12px rgba(45, 212, 191, 0.32);
}

/* 4. Baterias - Âmbar / Dourado */
.unidade-count-btn--baterias.unidade-count-btn--active {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}
.unidade-count-btn--baterias.unidade-count-btn--active:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: #fbbf24;
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.32);
}

/* 5. Termos de Coordenação - Violeta / Púrpura */
.unidade-count-btn--termos.unidade-count-btn--active {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(192, 132, 252, 0.35);
  color: #d8b4fe;
}
.unidade-count-btn--termos.unidade-count-btn--active:hover {
  background: rgba(168, 85, 247, 0.28);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 3px 12px rgba(168, 85, 247, 0.32);
}

/* Quando quantidade é ZERO - visual sutil, limpo e discreto */
.unidade-count-btn--zero {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(151, 169, 205, 0.12);
  color: var(--text-soft);
  opacity: 0.45;
  min-width: 40px;
}
.unidade-count-btn--zero .unidade-count-icon {
  opacity: 0.35;
}
.unidade-count-btn--zero:hover {
  opacity: 0.9;
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
  transform: translateY(-1px);
}
.unidade-count-btn--zero:active,
.unidade-count-btn--active:active {
  transform: translateY(0) scale(0.97);
}

/* Estilos para modal de recursos e múltiplos termos por piloto */
.termo-piloto-cell {
  vertical-align: middle;
}

.termo-piloto-nome {
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.termo-piloto-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  white-space: nowrap;
}

.termo-piloto-repeat {
  color: var(--text-muted);
  font-size: var(--text-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-style: italic;
  padding-left: 12px;
}

.termo-row-grouped {
  border-top: 1px dashed var(--border-subtle);
}

/* ==========================================================================
   Painel Geral — Tabela de Termos de Coordenação
   ========================================================================== */

#dashboard-termos-table {
  width: 100%;
}

#dashboard-termos-table:not(.responsive-card-table) {
  table-layout: fixed;
}

#dashboard-termos-table th,
#dashboard-termos-table td {
  text-align: center;
  vertical-align: middle;
}

/* Coluna Piloto: largura calibrada e equilibrada (sem aperto nem sobra excessiva) */
#dashboard-termos-table:not(.responsive-card-table) th:nth-child(1),
#dashboard-termos-table:not(.responsive-card-table) td:nth-child(1),
#dashboard-termos-table .col-piloto {
  width: 220px;
  text-align: center;
}

/* Coluna Unidade: largura equilibrada */
#dashboard-termos-table:not(.responsive-card-table) th:nth-child(2),
#dashboard-termos-table:not(.responsive-card-table) td:nth-child(2),
#dashboard-termos-table .col-unidade {
  width: 130px;
  text-align: center;
}

/* Coluna Status: ocupa toda a ampla maioria do espaço restante */
#dashboard-termos-table:not(.responsive-card-table) th:nth-child(3),
#dashboard-termos-table:not(.responsive-card-table) td:nth-child(3),
#dashboard-termos-table .col-status {
  width: auto;
  text-align: center;
}

/* Centralização do botão do piloto. O nome é mantido em uma única linha;
   se necessário, a tabela usa sua rolagem horizontal em vez de quebrá-lo. */
#dashboard-termos-table td .table-row-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 auto;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1.25;
}

/* Centralização do badge de status */
#dashboard-termos-table td .expiry-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 auto;
  max-width: 95%;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Consulta NF PMES no formulário de piloto */
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.input-with-action input {
  flex: 1;
}

.btn-consultar-nf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  white-space: nowrap;
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-consultar-nf.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.pmes-nf-hint {
  display: block;
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.35;
  transition: color 0.15s ease;
}

.pmes-nf-hint.hint-success {
  color: #4ade80;
  font-weight: 500;
}

.pmes-nf-hint.hint-error {
  color: #f87171;
  font-weight: 500;
}

.spinner-inline {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
