html,
body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f5f5f5;
  color: #111;
}

/* Raíz Blazor: altura de ventana para layouts flex y scroll interno */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@supports (height: 100dvh) {
  html {
    height: 100dvh;
  }

  body,
  #app {
    height: 100dvh;
  }
}

.loading {
  padding: 2rem;
  text-align: center;
}

/* Manija de redimensionado de columnas (minuta / debriefing) */
.sar-col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  margin-right: -3px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 3;
  background: transparent;
}

.sar-col-resize-handle:hover {
  background: rgba(11, 42, 74, 0.12);
}

.login-card {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
  margin-top: 0;
}

.login-card label {
  display: block;
  margin-top: 0.5rem;
  font-weight: 600;
}

.login-card .input {
  width: 100%;
  padding: 0.45rem;
  box-sizing: border-box;
  background: #fff;
  color: #111;
  border: 1px solid #cbd5e1;
}

.error {
  color: #b00020;
}

/* ── Join page tabs (register / login) ─────────────────────────────── */

.join-tabs {
  display: flex;
  border: 1px solid #dde3ec;
  border-radius: 8px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.join-tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  color: #374151;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.12s, color 0.12s;
}

.join-tab + .join-tab {
  border-left: 1px solid #dde3ec;
}

.join-tab--active {
  background: #0b2a4a;
  color: #fff;
}

.join-tab:not(.join-tab--active):hover {
  background: #eef2f6;
}

.join-login-hint {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 0.5rem;
}

.hint {
  font-size: 0.85rem;
  color: #666;
}

.muted {
  color: #666;
}

/* Contenedor fuera de flujo: oculta el chrome nativo del file (Blazor no siempre pasa id/clases al <input>) */
.composer-file-host,
.minute-file-host {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  /* No interceptar taps en la barra (el <label for> sigue activando el input). */
  pointer-events: none;
}

.composer-file-host input[type="file"],
.minute-file-host input[type="file"] {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  max-height: 1px !important;
  pointer-events: auto;
}

/* Textarea del compositor: ancho vía .composer-field-wrap / .minute-composer-field-wrap (evita ancho 0 en iOS WebKit). */
#chat-draft-input,
#minute-input {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  min-width: 0 !important;
  min-height: 2.5rem !important;
  max-height: 10rem !important;
  margin: 0 !important;
  padding: 0.45rem 0.4rem !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  resize: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  font: inherit !important;
  font-size: 1rem !important;
  line-height: 1.4 !important;
  align-self: stretch !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  vertical-align: top;
  -webkit-user-select: text !important;
  user-select: text !important;
  /* Safari: asegurar modo editable explícito (evita foco “muerto” con ciertas capas/CSS). */
  -webkit-user-modify: read-write-plaintext-only !important;
  touch-action: auto !important;
}

#chat-draft-input::placeholder,
#minute-input::placeholder {
  color: #8696a0;
}

/* Celdas de tabla (minuta / debriefing): texto largo con … y texto completo en atributo title (tooltip del navegador). */
.sar-td-clip {
  min-width: 0;
  overflow: hidden;
}

.sar-cell-ellipsis {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sar-cell-ellipsis-inline {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* ── Mapa Operacional — estilos compartidos (no de página) ──────────────── */

/* Asset list */
.asset-list-panel {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border, #2e3d4a);
}
.asset-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}
.asset-list-header .btn-secondary,
.asset-list-header .btn-primary {
  flex-shrink: 0;
}
.asset-list-title { font-weight: 600; font-size: 0.9rem; }
.asset-list-filters { margin-bottom: 0.4rem; }
.asset-list-items { list-style: none; padding: 0; margin: 0; }
.asset-list-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.asset-list-item:hover { background: rgba(255,255,255,.07); }
.asset-list-item.selected { background: rgba(255,255,255,.12); }
.asset-icon { font-size: 1rem; flex-shrink: 0; }
.asset-item-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: .05rem; }
.asset-item-callsign { font-weight: 600; font-size: .82rem; }
.asset-item-name { font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-item-status { font-size: .7rem; white-space: nowrap; flex-shrink: 0; }
.asset-route-btn {
  background: none;
  border: 1px solid rgba(59,130,246,.35);
  color: #60a5fa;
  border-radius: 4px;
  padding: .18rem .35rem;
  font-size: .8rem;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, background .15s;
  line-height: 1;
}
.asset-list-item:hover .asset-route-btn { opacity: 1; }
.asset-list-item.selected .asset-route-btn { opacity: 1; }
.asset-route-btn:hover { background: rgba(59,130,246,.2); }
.status-active { color: #3fb950; }
.status-done { color: #8b949e; }
.status-idle { color: #8b949e; }

/* Asset detail */
.asset-detail-panel { padding: 0.6rem; border-bottom: 1px solid var(--border, #2e3d4a); }
.asset-detail-empty { padding: 1rem; font-size: 0.85rem; }
.asset-detail-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.asset-detail-callsign { font-weight: 700; font-size: 1rem; }
.asset-detail-type { font-size: 0.8rem; }
.asset-detail-close { margin-left: auto; }
.asset-detail-body { display: flex; gap: 0.5rem; margin: 0.4rem 0; }
.asset-detail-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.5rem; font-size: 0.82rem; flex: 1; min-width: 0; align-content: start; }
.asset-detail-dl dt { font-weight: 600; color: #8b949e; }
.asset-detail-photo { flex-shrink: 0; width: 88px; height: 88px; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.06); }
.asset-detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.asset-route-summary { font-size: 0.8rem; margin: 0.4rem 0; padding: 0.3rem; background: rgba(255,255,255,.05); border-radius: 4px; }
.asset-route-label { font-weight: 600; margin-right: 0.4rem; }
.asset-detail-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.4rem; }

/* Route editor */
.route-editor-panel { display: flex; flex-direction: column; border-bottom: 1px solid var(--border, #2e3d4a); }
.route-editor-header { display: flex; align-items: center; padding: 0.5rem; border-bottom: 1px solid var(--border, #2e3d4a); }
.route-editor-title { font-weight: 600; font-size: 0.88rem; flex: 1; }
.route-editor-body { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; overflow-y: auto; }
.route-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; }
.route-editor-hint { margin: 0; }
.route-wp-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.route-wp-table th, .route-wp-table td { padding: 0.2rem 0.3rem; border-bottom: 1px solid var(--border, #2e3d4a); }
.route-editor-toolbar { display: flex; gap: 0.3rem; }
.route-editor-footer { display: flex; gap: 0.4rem; padding: 0.5rem; border-top: 1px solid var(--border, #2e3d4a); }

/* Asset marker */
.sar-asset-marker {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
}
.sar-asset-marker svg {
  width: 100%; height: 100%;
  transition: transform .15s;
}
.sar-asset-marker:hover svg { transform: scale(1.2); }

/* Utility buttons */
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-xs { padding: 0.1rem 0.3rem; font-size: 0.75rem; }
.input-sm { padding: 0.25rem 0.4rem; font-size: 0.82rem; }
.input-xs { padding: 0.1rem 0.3rem; font-size: 0.78rem; }
.btn-success { background: #238636; color: #fff; border: none; border-radius: 4px; cursor: pointer; padding: 0.4rem 0.8rem; }
.btn-success:hover:not(:disabled) { background: #2ea043; }
.btn-danger { background: #b91c1c; color: #fff; border: none; border-radius: 4px; cursor: pointer; padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-ghost { background: transparent; border: none; cursor: pointer; color: inherit; padding: 0.2rem 0.4rem; }

/* ── Input — dark-theme global ────────────────────────────────────────────── */
.input {
  width: 100%;
  box-sizing: border-box;
  padding: .38rem .6rem;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.07);
  color: #e2e8f0;
  font: inherit;
  font-size: .88rem;
  transition: border-color .15s, background .15s;
}
.input:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(59,130,246,.08);
}
.input::placeholder { color: rgba(255,255,255,.3); }
select.input option { background: #1e2a35; color: #e2e8f0; }

textarea.input {
  resize: vertical;
  min-height: 2.5rem;
  line-height: 1.45;
}

/* Color picker — hace cuadrado con altura mínima */
input[type="color"].input {
  padding: .15rem .2rem;
  height: 36px;
  cursor: pointer;
}

/* ── Form field label ──────────────────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .88rem;
}
.form-field > span:first-child,
.form-field > label:first-child {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(200,215,240,.65);
}

/* ── Buttons — dark-theme modal ───────────────────────────────────────────── */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: .42rem .9rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  padding: .42rem .9rem;
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.modal-card {
  background: #141f2e;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.55);
}
.modal-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.modal-header h3 {
  margin: 0;
  flex: 1;
  font-size: 1.08rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -.015em;
}
.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal-footer {
  display: flex;
  gap: 0.6rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  justify-content: flex-end;
  background: rgba(255,255,255,.02);
}

/* ── Asset marker on-route state ──────────────────────────────────────────── */
.sar-asset-marker.sar-asset-on-route {
  animation: pulse-asset 1.8s ease-in-out infinite;
}

@keyframes pulse-asset {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255,255,255,.4)) drop-shadow(0 0 8px rgba(255,255,255,.2)); }
  50%       { filter: drop-shadow(0 0 8px rgba(255,255,255,.7)) drop-shadow(0 0 14px rgba(255,255,255,.35)); }
}

/* ── Waypoint markers (map edit mode) ─────────────────────────────────────── */
.sar-wp-marker {
  width: 22px;
  height: 22px;
  background: #f59e0b;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #1a1a1a;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.sar-wp-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(0,0,0,.6), 0 0 0 3px rgba(245,158,11,.3);
}
.sar-wp-marker:active { cursor: grabbing; transform: scale(1.1); }
.sar-wp-start {
  background: #4ade80;
  border-color: #fff;
}
.sar-wp-start:hover { box-shadow: 0 3px 10px rgba(0,0,0,.6), 0 0 0 3px rgba(74,222,128,.3); }
.sar-wp-end {
  background: #f87171;
  border-color: #fff;
}
.sar-wp-end:hover { box-shadow: 0 3px 10px rgba(0,0,0,.6), 0 0 0 3px rgba(248,113,113,.3); }

/* ── Leaflet Geoman toolbar — dark theme ──────────────────────────────── */
.leaflet-pm-toolbar .leaflet-pm-icon-delete,
.leaflet-pm-toolbar .leaflet-pm-icon-edit,
.leaflet-pm-toolbar .leaflet-pm-icon-polygon,
.leaflet-pm-toolbar .leaflet-pm-icon-rectangle,
.leaflet-pm-toolbar .leaflet-pm-icon-circle {
  filter: none;
}

.leaflet-pm-toolbar {
  border: 1px solid rgba(59,130,246,.35) !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.45) !important;
}

.leaflet-pm-toolbar .button-container {
  background: #0b2a4a !important;
  border-color: rgba(255,255,255,.1) !important;
}

.leaflet-pm-toolbar .button-container .leaflet-buttons-container-button {
  background: #0b2a4a !important;
  border-color: rgba(255,255,255,.08) !important;
}

.leaflet-pm-toolbar .button-container .leaflet-buttons-container-button:hover {
  background: #143d66 !important;
}

.leaflet-pm-toolbar .button-container .leaflet-buttons-container-button.active {
  background: rgba(59,130,246,.25) !important;
  box-shadow: inset 0 0 0 2px rgba(59,130,246,.5);
}

.leaflet-pm-toolbar .button-container a {
  background: #0b2a4a !important;
  border-color: rgba(255,255,255,.08) !important;
  transition: background .15s;
}

.leaflet-pm-toolbar .button-container a:hover {
  background: #143d66 !important;
}

.leaflet-pm-toolbar .button-container a.active {
  background: rgba(59,130,246,.25) !important;
  box-shadow: inset 0 0 0 2px rgba(59,130,246,.5);
}

.leaflet-pm-actions-container {
  background: #0b2a4a !important;
  border: 1px solid rgba(59,130,246,.3) !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.4) !important;
}

.leaflet-pm-actions-container a {
  color: #e2e8f0 !important;
  background: transparent !important;
  border-color: rgba(255,255,255,.08) !important;
  font-size: .78rem;
  padding: .3rem .6rem;
}

.leaflet-pm-actions-container a:hover {
  background: rgba(59,130,246,.15) !important;
  color: #93c5fd !important;
}

/* ── Deploy / Recover (embark) ──────────────────────────────────────────── */
.asset-info-embark-section {
  padding: .5rem .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.embark-status {
  font-size: .78rem;
  padding: .3rem .5rem;
  border-radius: 6px;
}
.embark-status.stowed {
  background: rgba(59,130,246,.12);
  color: #93c5fd;
}
.embark-status.deployed {
  background: rgba(34,197,94,.12);
  color: #86efac;
}

.btn-deploy {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .35rem .75rem;
  font-weight: 600;
  font-size: .8rem;
  cursor: pointer;
  transition: filter .15s;
}
.btn-deploy:hover:not(:disabled) { filter: brightness(1.15); }
.btn-deploy:disabled { opacity: .5; cursor: not-allowed; }

.btn-recover {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .35rem .75rem;
  font-weight: 600;
  font-size: .8rem;
  cursor: pointer;
  transition: filter .15s;
}
.btn-recover:hover:not(:disabled) { filter: brightness(1.15); }
.btn-recover:disabled { opacity: .5; cursor: not-allowed; }

/* ── Carrier section (embarked aircraft list) ───────────────────────── */
.carrier-section {
  border-top: 1px solid rgba(255,255,255,.1);
}
.carrier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  font-weight: 700;
  color: #7dd3fc;
}
.embarked-list {
  list-style: none;
  margin: .25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.embarked-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .5rem;
  border-radius: 6px;
  font-size: .78rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  transition: background .12s;
}
.embarked-item:hover {
  background: rgba(255,255,255,.06);
}
.embarked-item.stowed {
  border-left: 3px solid #3b82f6;
}
.embarked-item.deployed {
  border-left: 3px solid #22c55e;
}
.embarked-icon {
  font-size: .95rem;
  flex-shrink: 0;
}
.embarked-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.embarked-callsign {
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.embarked-status {
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.embarked-status.status-stowed {
  color: #93c5fd;
}
.embarked-status.status-active {
  color: #86efac;
}
.btn-deploy.btn-xs,
.btn-recover.btn-xs {
  padding: .15rem .35rem;
  font-size: .68rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.btn-ghost.btn-xs {
  padding: .15rem .3rem;
  font-size: .72rem;
  flex-shrink: 0;
  color: #94a3b8;
}
.btn-ghost.btn-xs:hover {
  color: #e2e8f0;
}
.modal-embarked {
  max-height: 140px;
  overflow-y: auto;
}

/* ── Asset list: stowed state ────────────────────────────────────────── */
.asset-list-item.stowed {
  opacity: .6;
}
.asset-item-stowed-badge {
  font-size: .65rem;
  color: #93c5fd;
  display: block;
  margin-top: 1px;
}
.asset-item-embarked-badge {
  font-size: .65rem;
  color: #7dd3fc;
  display: block;
  margin-top: 1px;
}
.status-stowed {
  color: #93c5fd !important;
  font-style: italic;
}
