/**
 * IRP Patrimonial - Components CSS
 * Botones, inputs, modales, toasts y otros componentes UI
 */

/* ========================================
   BOTONES
   ======================================== */

/* Botón Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

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

/* Botón Primario */
.btn-primary {
  background: var(--primary);
  color: white;
}

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

/* Botón Secundario */
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

/* Botón Ghost/Outline */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--bg-hover);
}

/* Botón Danger */
.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

/* Botón Success */
.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #27ae60;
}

/* Botón Warning */
.btn-warning {
  background: var(--warning, #f39c12);
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: #d68910;
}

/* Tamaños de botón */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 14px;
}

/* Botón Block (ancho completo) */
.btn-block {
  width: 100%;
  display: flex;
}

/* Contenedor de botones de exportar */
.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Botón Icon (cuadrado) */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.btn-icon.active {
  background: var(--primary);
  color: white;
}

/* Botón Toolbar */
.toolbar-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toolbar-btn.active {
  background: var(--primary);
  color: white;
}

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

/* ========================================
   INPUTS
   ======================================== */

/* Input Base */
.input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
}

.input:hover {
  border-color: var(--bg-hover);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(250, 92, 0, 0.2);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Number input: controles personalizados IRP Patrimonial */
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input[type="number"] {
  -moz-appearance: textfield;
}

.sv-number-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.sv-number-wrap .input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 10px;
}

.sv-number-buttons {
  flex: 0 0 30px;
  display: flex;
  flex-direction: column;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-left: 0;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  overflow: hidden;
}

.sv-number-btn {
  height: 50%;
  min-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sv-number-btn + .sv-number-btn {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sv-number-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Poligonal modal */
.hull-field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-primary);
}

.hull-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hull-option,
.hull-radio,
.hull-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.hull-option:hover,
.hull-radio:hover,
.hull-check:hover {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.08);
}

.hull-option.active {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.12);
  box-shadow: 0 0 0 2px rgba(250, 92, 0, 0.12);
}

.hull-option input,
.hull-radio input,
.hull-check input {
  flex: 0 0 auto;
  margin-top: 2px;
  accent-color: var(--primary);
}

.hull-option span,
.hull-radio span,
.hull-check span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hull-option strong,
.hull-radio strong,
.hull-check strong {
  font-size: 13px;
  color: var(--text-primary);
}

.hull-option small,
.hull-radio small,
.hull-check small,
.hull-hint {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

.hull-hint {
  display: block;
  margin-top: 5px;
}

.hull-hint-warning {
  color: var(--warning);
}

.hull-subpanel {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.025);
}

.hull-subtitle {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.hull-radio + .hull-radio {
  margin-top: 8px;
}

.hull-check.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hull-summary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.hull-summary i {
  margin-top: 2px;
  color: var(--primary);
}

/* Input Sizes */
.input-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* Textarea */
textarea.input {
  min-height: 80px;
  resize: vertical;
}

/* Select */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b0bec5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

/* Checkbox & Radio */
.checkbox-group,
.radio-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-group input,
.radio-group input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ========================================
   SLIDER (Range Input)
   ======================================== */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* ========================================
   MODALES
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

.modal-overlay.closing {
  animation: fadeOut 0.2s ease forwards;
}

.modal {
  background: var(--bg-panel);
  border-radius: var(--border-radius-lg);
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

.modal-overlay.closing .modal {
  animation: slideDown 0.2s ease forwards;
}

@keyframes slideDown {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* Tamaños de modal */
.modal-sm { width: 400px; }
.modal-md { width: 500px; }
.modal-lg { width: 640px; }
.modal-xl { width: 800px; }
.modal-fullscreen {
  width: 95vw;
  height: 90vh;
}

/* Modal Header */
.modal-header {
  padding: 15px 20px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title i {
  color: var(--primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--border-radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Modal Body */
.modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* Modal Footer */
.modal-footer {
  padding: 15px 20px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ========================================
   SETTINGS MODAL
   ======================================== */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  background: var(--bg-input);
  border-radius: var(--border-radius);
  padding: 15px;
}

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

.settings-section-title i {
  color: var(--primary);
  font-size: 14px;
}

.cache-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.cache-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.cache-stats strong {
  color: var(--text-primary);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  background: var(--bg-panel);
  border-left: 4px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  pointer-events: auto;
}

.toast.removing {
  animation: slideOut 0.3s ease forwards;
}

.toast-success { border-color: var(--success); }
.toast-warning { border-color: var(--warning); }
.toast-error { border-color: var(--danger); }
.toast-info { border-color: var(--info); }

.toast-icon {
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--info); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--border-radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================
   DROPDOWN
   ======================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.dropdown-menu-right {
  left: auto;
  right: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-item i {
  width: 16px;
  color: var(--text-secondary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ========================================
   TOOLTIPS
   ======================================== */
[data-tooltip] {
  position: relative;
}

/* Pseudo-element deshabilitado - reemplazado por tooltip JS dinámico */
[data-tooltip]::after {
  display: none;
}

/* Tooltip JS global */
#sv-tooltip {
  position: fixed;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-family);
  color: white;
  background: var(--secondary-dark);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  white-space: pre-line;
  text-align: left;
  line-height: 1.35;
  pointer-events: none;
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  max-width: 320px;
  overflow-wrap: break-word;
}

#sv-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-secondary);
}

.badge-primary { background: var(--primary); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-info { background: var(--info); color: white; }

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width var(--transition-normal);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 15px;
  text-align: center;
}

.empty-state > i {
  font-size: 28px;
  color: var(--text-muted);
  opacity: 0.4;
  margin-bottom: 8px;
}

.empty-state-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state p,
.empty-state-text {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  margin: 0;
}

/* Empty state compacto para panel de elementos */
.panel-elements .empty-state {
  padding: 15px 10px;
  height: 100%;
}

.panel-elements .empty-state > i {
  font-size: 22px;
  margin-bottom: 6px;
}

/* ========================================
   COLOR PICKER
   ======================================== */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.color-picker-option {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius);
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.color-picker-option:hover {
  transform: scale(1.1);
}

.color-picker-option.selected {
  border-color: white;
  transform: scale(1.05);
}

/* ========================================
   TABS
   ======================================== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  padding: 15px 0;
}

.tab-content.active {
  display: block;
}

/* ========================================
   ACCORDION
   ======================================== */
.accordion-item {
  border-bottom: 1px solid var(--border-color);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.accordion-header:hover {
  color: var(--primary);
}

.accordion-header i {
  transition: transform var(--transition-fast);
}

.accordion-item.open .accordion-header i {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.accordion-item.open .accordion-content {
  max-height: 500px;
}

.accordion-body {
  padding-bottom: 15px;
}

/* ========================================
   TOOL GRID
   ======================================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 4px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  background: var(--bg-input);
  border: none;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 9px;
}

.tool-btn i {
  font-size: 12px;
}

.tool-btn span {
  line-height: 1;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tool-btn.active {
  background: var(--primary);
  color: white;
}

.tool-btn.vip-tool {
  border: 1px solid #c8a84e;
}

.tool-btn.vip-tool:hover {
  border-color: #e0c068;
}

.tool-options {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tool-options-label {
  font-size: 11px;
  color: var(--text-secondary);
  width: 100%;
  margin-bottom: 4px;
}

/* ========================================
   LAYER LIST
   ======================================== */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.layer-group {
  margin-bottom: 8px;
}

.layer-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  transition: background var(--transition-fast);
}

.layer-item:hover {
  background: var(--bg-hover);
}

.layer-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.layer-item label {
  flex: 1;
  font-size: 13px;
  cursor: pointer;
}

.layer-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.layer-color-picker {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.layer-color-picker:hover {
  transform: scale(1.3);
  box-shadow: 0 0 6px rgba(250, 92, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ========================================
   FLOATING PANELS
   ======================================== */
.floating-panel {
  position: absolute;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toolbar);
  min-width: 200px;
}

.floating-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  font-size: 13px;
  font-weight: 500;
}

.floating-panel-header i {
  color: var(--primary);
}

.floating-panel-header span {
  flex: 1;
}

.floating-panel-body {
  padding: 12px;
}

.floating-panel.hidden {
  display: none !important;
}

/* ─── Panel Dragger ─── */
.floating-panel-header,
.history-panel-header,
.photo-list-header,
.track-info-header {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.floating-panel-header:active,
.history-panel-header:active,
.photo-list-header:active,
.track-info-header:active {
  cursor: grabbing;
}

.is-dragging {
  opacity: 0.95;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
  transition: none !important;
  user-select: none;
}

#utm-panel {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  z-index: 9999;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#utm-panel .floating-panel-body {
  padding: 12px;
}

#utm-panel .input-group {
  margin-bottom: 10px;
}

#utm-panel .input-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

#utm-panel .input-row {
  display: flex;
  gap: 8px;
}

#utm-panel .input-row .input-group {
  flex: 1;
}

#utm-panel .utm-vertices {
  margin: 10px 0;
  padding: 8px;
  background: var(--bg-dark);
  border-radius: var(--border-radius);
  max-height: 120px;
  overflow-y: auto;
}

#utm-panel .utm-vertices-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#utm-panel .utm-vertex-item {
  font-size: 11px;
  font-family: 'Consolas', monospace;
  color: var(--text-secondary);
  padding: 3px 0;
  border-bottom: 1px solid var(--border-color);
}

#utm-panel .utm-vertex-item:last-child {
  border-bottom: none;
}

#utm-panel .btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#utm-panel .btn-group-horizontal {
  display: flex;
  gap: 6px;
}

#search-panel {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 350px;
  z-index: 9999;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#search-panel .floating-panel-body {
  padding: 12px;
}

#search-panel .input {
  width: 100%;
  margin-bottom: 8px;
}

#search-panel .search-results {
  max-height: 250px;
  overflow-y: auto;
}

#search-panel .search-result-item {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--border-radius);
  transition: background var(--transition-fast);
}

#search-panel .search-result-item:hover {
  background: var(--bg-hover);
}

#search-panel .search-result-item i {
  /* Color aplicado inline según el elemento */
}

#search-panel .search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.gps-marker .gps-dot {
  width: 14px;
  height: 14px;
  background: var(--success);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.gps-marker .gps-dot-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  background: var(--success);
  border-radius: 50%;
  opacity: 0;
  animation: gpsPulse 2s ease-out infinite;
  z-index: 1;
}

@keyframes gpsPulse {
  0% { 
    transform: translate(-50%, -50%) scale(0.3); 
    opacity: 0.8; 
  }
  100% { 
    transform: translate(-50%, -50%) scale(1.5); 
    opacity: 0; 
  }
}

/* ========================================
   CONTEXT MENU
   ======================================== */
.context-menu {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: var(--z-dropdown);
  padding: 4px 0;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-item i {
  width: 16px;
  color: var(--text-secondary);
  text-align: center;
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger i {
  color: var(--danger);
}

.context-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.context-menu-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ========================================
   POLYGON CONTROLS - Flotante inferior central
   ======================================== */
.polygon-controls {
  position: fixed;
  top: 50%;
  left: calc(var(--panel-width) + 10px);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-dark);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toolbar);
  border: 1px solid var(--border-color);
}

.polygon-controls .btn {
  white-space: nowrap;
}

.polygon-controls.hidden {
  display: none;
}

/* ========================================
   MEASURE PANEL - Flotante lateral
   ======================================== */
#measure-panel {
  position: fixed !important;
  top: 70px;
  left: calc(var(--panel-width) + 20px);
  width: 240px;
  max-height: 400px;
  z-index: 1000 !important;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#measure-panel .floating-panel-body {
  padding: 10px;
}

.measure-segments {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
  font-size: 12px;
}

.measure-segment {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  background: var(--bg-input);
  border-radius: 3px;
  margin-bottom: 4px;
}

.measure-segment-label {
  color: var(--text-secondary);
}

.measure-segment-value {
  font-weight: 600;
  color: var(--primary);
  font-family: 'Consolas', monospace;
}

.measure-totals {
  padding: 8px;
  background: var(--bg-darker);
  border-radius: var(--border-radius);
  margin-bottom: 10px;
}

.measure-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.measure-total-row:last-child {
  margin-bottom: 0;
}

.measure-total-row span {
  color: var(--text-secondary);
}

.measure-total-row strong {
  color: var(--primary);
  font-family: 'Roboto Mono', monospace;
}

.measure-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.measure-actions .btn {
  flex: 1;
}

/* ========================================
   ELEMENT ITEM (en panel izquierdo)
   ======================================== */
.element-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  background: var(--bg-input);
  border-radius: 0;
  margin-bottom: 1px;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.element-item:last-child {
  margin-bottom: 0;
}

.element-item:hover {
  background: var(--bg-hover);
}

.element-item.hidden-element {
  opacity: 0.5;
}

/* Drag States */
.element-item.drag-ready {
  background: var(--bg-hover);
  cursor: move;
}

.element-item.dragging {
  opacity: 0.5;
  background: var(--bg-hover);
  border: 1px dashed var(--primary);
}

.element-item.drag-over-top {
  border-top: 2px solid var(--primary);
  margin-top: -1px;
}

.element-item.drag-over-bottom {
  border-bottom: 2px solid var(--primary);
  margin-bottom: -1px;
}

/* ========================================
   SV-CHECK — Checkbox tri-state custom (v130)
   Forma cuadrada con cuadrado interno relleno (estado all),
   guion (estado partial) o vacío (estado none).
   Distinto al checkbox tradicional ☑ del panel Proyectos.
   ======================================== */
.sv-check {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
  box-sizing: border-box;
}

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

.sv-check[data-state="all"] {
  background: var(--primary);
  border-color: var(--primary);
}

.sv-check[data-state="all"]::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 1px;
}

.sv-check[data-state="partial"] {
  background: var(--primary);
  border-color: var(--primary);
}

.sv-check[data-state="partial"]::after {
  content: '';
  width: 8px;
  height: 2px;
  background: white;
  border-radius: 1px;
}

/* Variante en header de carpeta — alineación */
.sv-check.folder-check {
  margin-right: 2px;
}

/* Mantener el class antiguo .element-checkbox sin reglas activas (back-compat por si queda algún DOM viejo cacheado) */
.element-checkbox {
  display: none;
}

.element-color {
  width: 6px;
  height: 100%;
  min-height: 36px;
  border-radius: 3px;
  flex-shrink: 0;
}

.element-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.element-type {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.element-name {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.element-dims {
  font-size: 9px;
  color: var(--text-secondary);
  font-family: 'Consolas', monospace;
}

/* v130: .element-actions y .element-actions-grid eliminados — los botones de acción individual fueron migrados al menú contextual (right-click / long-press). Las clases antiguas se neutralizan por compatibilidad si algún DOM cacheado las usara. */
.element-actions,
.element-actions-grid {
  display: none !important;
}

.btn-xs {
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 10px;
}

/* Botones compactos del header de elementos */
#btn-create-folder,
#btn-import,
#btn-export {
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

#btn-create-folder:hover,
#btn-import:hover,
#btn-export:hover {
  color: var(--primary);
  background: rgba(250, 92, 0, 0.1);
}

/* Botón seleccionar todos en header */
#btn-select-all {
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

#btn-select-all:hover {
  color: var(--primary);
  background: rgba(250, 92, 0, 0.1);
}

#btn-select-all.active {
  color: var(--primary);
  background: rgba(250, 92, 0, 0.2);
}

/* v130: estado parcial (algunos seleccionados, no todos) */
#btn-select-all.partial {
  color: var(--primary);
  background: rgba(250, 92, 0, 0.08);
  position: relative;
}

#btn-select-all.partial::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 1.5px;
  background: var(--primary);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ========================================
   FOLDER SYSTEM (Carpetas)
   ======================================== */

/* Contenedor de carpeta */
.folder-container {
  margin-bottom: 2px;
  background: var(--bg-dark);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.folder-container.dragging {
  opacity: 0.5;
}

.folder-container.folder-drag-over-top {
  border-top: 2px solid var(--primary);
}

.folder-container.folder-drag-over-bottom {
  border-bottom: 2px solid var(--primary);
}

/* Header de carpeta */
.folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-input);
  cursor: grab;
  transition: all var(--transition-fast);
  border-left: 3px solid var(--primary);
}

.folder-header:active {
  cursor: grabbing;
}

.folder-header:hover {
  background: var(--bg-hover);
}

.folder-header.drop-target {
  background: rgba(250, 92, 0, 0.2);
  border-color: var(--primary);
}

/* Toggle de carpeta */
.folder-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.folder-toggle:hover {
  color: var(--text-primary);
}

.folder-toggle i {
  font-size: 10px;
  transition: transform var(--transition-fast);
}

/* Icono de carpeta */
.folder-icon {
  color: var(--primary);
  font-size: 14px;
  flex-shrink: 0;
}

/* Nombre de carpeta — máximo 2 líneas */
.folder-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.3;
  max-height: 2.6em; /* 2 lines × 1.3 line-height */
}

/* Contador de elementos en carpeta */
.folder-count {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-dark);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* v130: Botón hamburguesa y dropdown de carpeta eliminados — todas las acciones ahora están en el menú contextual (right-click / long-press sobre el header de la carpeta). Las clases antiguas se neutralizan por compatibilidad. */
.folder-actions,
.folder-menu-btn,
.folder-actions-dropdown,
.folder-action-btn,
.folder-actions-divider {
  display: none !important;
}

/* Contenido de carpeta */
.folder-content {
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.folder-container.collapsed .folder-content {
  display: none;
}

/* Zona de drop dentro de carpeta */
.folder-drop-zone {
  padding: 4px;
  padding-left: 20px;
  min-height: 40px;
  transition: all var(--transition-fast);
}

.folder-drop-zone.drop-target {
  background: rgba(250, 92, 0, 0.15);
  border: 2px dashed var(--primary);
  border-radius: var(--border-radius);
}

/* Carpeta vacía */
.folder-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Elementos dentro de carpetas */
.folder-drop-zone .element-item {
  margin-left: 0;
  border-radius: var(--border-radius);
}

/* Handle de arrastre de elementos */
.element-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.element-item:hover .element-drag-handle {
  opacity: 1;
}

.element-drag-handle:active {
  cursor: grabbing;
}

/* Drop target para elementos */
.element-item.drop-target {
  background: rgba(250, 92, 0, 0.2);
  border: 1px dashed var(--primary);
}

/* Drop zone principal activa */
#elements-list-content.main-drop-active {
  background: rgba(250, 92, 0, 0.1);
}

/* Color bar en elementos */
.element-color-bar {
  width: 4px;
  height: 100%;
  min-height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Contenido del elemento */
.element-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.element-content .element-type {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.element-content .element-type i {
  font-size: 10px;
}

.element-content .element-name {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botón menú del elemento */
.element-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.element-menu-btn:hover {
  background: var(--bg-dark);
  color: var(--text-primary);
}


/* ========================================
   BLOQUEO DE ELEMENTOS Y CARPETAS
   ======================================== */

/* Botón lock dentro del panel deslizante — naranja cuando activo */
.lock-action-btn.active-lock,
.btn-xs.lock-active {
  color: var(--primary) !important;
}

/* Overlay que cubre el item cuando está bloqueado */
.element-locked-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(21, 27, 32, 0.88);
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border-left: 3px solid var(--primary);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--transition-fast);
}

.element-locked-overlay i {
  font-size: 14px;
}

.element-locked-overlay:hover {
  background: rgba(21, 27, 32, 0.70);
}

.element-item.element-locked {
  position: relative;
}

.element-item.element-locked .element-locked-overlay {
  display: flex;
}

/* Overlay de carpeta bloqueada — cubre solo el folder-header */
.folder-locked-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(21, 27, 32, 0.88);
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border-left: 3px solid var(--primary);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  pointer-events: auto;
}

.folder-locked-overlay i {
  font-size: 14px;
}

.folder-locked-overlay:hover {
  background: rgba(21, 27, 32, 0.70);
}

.folder-header {
  position: relative;
}

.folder-container.folder-locked .folder-locked-overlay {
  display: flex;
}


/* ========================================
   MENÚ RADIAL DE CONTEXTO
   ======================================== */

#radial-menu {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  /* el centro del menú es el origen (0,0) relativo al punto de click */
}

/* ── Centro (botón cerrar) ── */
.radial-menu-center {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%) scale(0);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 2px solid var(--primary);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  transition:
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   0.2s ease,
    background 0.15s ease;
  z-index: 2;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.radial-menu.active .radial-menu-center {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}

.radial-menu-center:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Ring (contenedor de items y labels) ── */
.radial-menu-ring {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* ── Botones radiales ── */
.radial-menu-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1.5px solid rgba(255,255,255,0.1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  /* Estado inicial: en el origen, sin escala */
  transform: translate(-50%, -50%) scale(0);
  transition:
    transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity   0.22s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  box-shadow: 0 3px 14px rgba(0,0,0,0.45);
  z-index: 1;
}

/* Cuando el menú está activo → volar al destino */
.radial-menu.active .radial-menu-item {
  transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1);
  opacity: 1;
  pointer-events: all;
}

.radial-menu-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--text-primary);
  transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.15) !important;
}

.radial-menu-item.is-active {
  border-color: var(--primary);
  color: var(--primary);
}

.radial-menu-item.danger:hover {
  background: var(--danger, #e74c3c);
  border-color: var(--danger, #e74c3c);
  color: #fff;
}

.radial-menu-item.warning:hover {
  background: #f39c12;
  border-color: #f39c12;
  color: #fff;
}

/* ── Etiquetas ── */
.radial-menu-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate(calc(-50% + var(--lx)), calc(-50% + var(--ly)));
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 20, 25, 0.88);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: opacity 0.15s ease;
  z-index: 3;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.radial-menu-label.visible {
  opacity: 1;
}

/* ── Líneas de conexión (opcional: pulse ring en centro) ── */
.radial-menu.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(250, 92, 0, 0.25);
  pointer-events: none;
}

/* ========================================
   SEARCH RESULTS
   ======================================== */
.search-results {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 10px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-item i {
  color: var(--primary);
}

.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ========================================
   ELEMENT POPUP
   ======================================== */
.element-popup .leaflet-popup-content-wrapper {
  padding: 0;
  overflow: visible;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

.element-popup .leaflet-popup-content {
  margin: 0;
  width: 320px !important;
  min-width: 320px;
}

.element-popup .leaflet-popup-tip {
  background: var(--bg-panel);
}

.popup-content {
  padding: 16px;
}

.popup-field {
  margin-bottom: 14px;
}

.popup-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-section {
  margin-bottom: 14px;
}

.popup-section > label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.registros-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.registro-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
}

.registro-row label {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-transform: none;
  margin-bottom: 0;
}

.registro-row label i {
  color: var(--primary);
  width: 16px;
  font-size: 14px;
}

.registro-row select {
  width: 130px;
  flex-shrink: 0;
}

.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.popup-actions .btn {
  flex: 1;
}

/* ========================================
   ELEMENT EDIT POPUP (Panel flotante)
   ======================================== */
.element-edit-popup {
  position: fixed;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  animation: slideIn 0.2s ease;
}

.element-edit-popup .floating-panel-header {
  cursor: grab;
}

.element-edit-popup .floating-panel-body {
  padding: 16px;
}

.element-edit-popup .popup-field {
  margin-bottom: 14px;
}

.element-edit-popup .popup-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.element-edit-popup .popup-field .input {
  width: 100%;
}

.element-edit-popup .popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.element-edit-popup .popup-actions .btn {
  flex: 1;
}

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

/* ========================================
   ELEMENT LABEL (Tooltip)
   ======================================== */
.element-label {
  background: rgba(21, 27, 32, 0.9) !important;
  border: 1px solid var(--primary) !important;
  border-radius: 4px !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-md) !important;
}

.element-label::before {
  border-top-color: var(--primary) !important;
}

/* Ocultar etiquetas cuando el mapa tiene la clase labels-hidden */
.labels-hidden .element-label {
  display: none !important;
}

/* Mostrar etiqueta al hacer hover aunque las labels estén ocultas */
.labels-hidden .element-label.label-hover-show {
  display: block !important;
  opacity: 1 !important;
  z-index: 9999 !important;
  pointer-events: none;
}

/* ========================================
   DRAWING LABELS
   Siempre visibles — ignoran labels-hidden.
   Usadas durante el dibujo en tiempo real.
   ======================================== */
.drawing-label {
  background: rgba(21, 27, 32, 0.92) !important;
  border: 1px solid var(--primary) !important;
  border-radius: 4px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-md) !important;
  white-space: nowrap !important;
}

.drawing-label::before {
  border-top-color: var(--primary) !important;
}

/* Segmento activo (cursor → último punto): naranja para diferenciarlo */
.segment-distance-label.active-segment span {
  background: rgba(250, 92, 0, 0.92);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
  font-weight: 700;
}

/* ========================================
   IFRAME OVERLAY
   ======================================== */
.iframe-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 0.2s ease;
}

.iframe-container {
  width: 95vw;
  height: 95vh;
  background: var(--bg-darker);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.iframe-container.iframe-narrow {
  width: 45vw;
  max-width: 540px;
}

.iframe-container.iframe-wide {
  width: 85vw;
  max-width: 1100px;
  height: 55vh;
}

.iframe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
}

.iframe-container iframe {
  flex: 1;
  width: 100%;
  border: none;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 27, 32, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-modal) + 100);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.loading-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  color: var(--text-primary);
}

.loading-spinner i {
  font-size: 40px;
  color: var(--primary);
}

/* ========================================
   COLOR PICKER
   ======================================== */
.color-option {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: white;
  box-shadow: 0 0 0 2px var(--primary);
}

/* ========================================
   HELP CONTENT
   ======================================== */
.help-content h4 {
  font-size: 14px;
  margin: 15px 0 10px;
  color: var(--primary);
}

.help-content h4:first-child {
  margin-top: 0;
}

.help-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-shortcuts div {
  font-size: 13px;
}

kbd {
  background: var(--bg-input);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Consolas', monospace;
  border: 1px solid var(--border-color);
}

/* ========================================
   BLINK ANIMATION
   ======================================== */
.blink {
  animation: blink 0.3s ease-in-out 4 !important;
}

.blink-marker {
  animation: blink-marker-glow 0.3s ease-in-out 4 !important;
}

.blink-item {
  animation: blink-bg 0.3s ease-in-out 4 !important;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.1; }
}

@keyframes blink-marker-glow {
  0%, 100% { 
    opacity: 1;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5));
  }
  50% { 
    opacity: 0.4;
    filter: drop-shadow(0 0 15px rgba(250, 92, 0, 1)) drop-shadow(0 0 30px rgba(250, 92, 0, 0.8));
  }
}

@keyframes blink-bg {
  0%, 100% { background: transparent; }
  50% { background: var(--primary); }
}

/* ========================================
   GEOMETRY EDITING (Leaflet.Editable)
   ======================================== */

/* Vértices principales - solo cambiar apariencia, no posición */
.leaflet-div-icon.leaflet-vertex-icon {
  background: var(--primary) !important;
  border: 2px solid white !important;
  border-radius: 50% !important;
  cursor: move !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4) !important;
}

.leaflet-div-icon.leaflet-vertex-icon:hover {
  background: #ff7733 !important;
}

/* Puntos medios - para añadir vértices */
.leaflet-div-icon.leaflet-middle-icon {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 2px solid var(--primary) !important;
  border-radius: 50% !important;
  cursor: crosshair !important;
  opacity: 0.7 !important;
}

.leaflet-div-icon.leaflet-middle-icon:hover {
  opacity: 1 !important;
  background: var(--primary) !important;
}

/* Waypoints en modo edición */
.editing-enabled {
  cursor: move !important;
}

/* Línea de arrastre */
.leaflet-drag-target {
  cursor: move !important;
}

/* Marcador de arrastre para mover todo el elemento */
.drag-handle-marker {
  background: transparent !important;
  border: none !important;
}

.drag-handle {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: move;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.drag-handle i {
  color: white;
  font-size: 12px;
}

.drag-handle:hover {
  transform: scale(1.15);
  background: #ff7733;
}

.drag-handle:active {
  transform: scale(1.1);
  background: #e55000;
}

/* Group drag handle (mover múltiples elementos en bloque) */
.group-drag-handle-marker {
  background: transparent !important;
  border: none !important;
}

.group-drag-handle {
  position: relative;
  width: 38px;
  height: 38px;
  background: white;
  border: 3px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: move;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45), 0 0 0 3px rgba(250, 92, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.group-drag-handle i {
  color: var(--primary);
  font-size: 14px;
}

.group-drag-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Roboto', sans-serif;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  line-height: 1;
}

.group-drag-handle:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 14px rgba(0,0,0,0.45), 0 0 0 5px rgba(250, 92, 0, 0.25);
}

.group-drag-handle:active {
  transform: scale(1.1);
  background: #fff3ec;
}

/* ========================================
   SCALE GUIDE
   ======================================== */
.scale-handle-marker {
  background: transparent !important;
  border: none !important;
}

.scale-handle {
  width: 22px;
  height: 22px;
  background: #2196F3;
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.45);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.scale-handle i {
  color: white;
  font-size: 10px;
}

.scale-handle:hover {
  transform: scale(1.2);
  background: #42A5F5;
  box-shadow: 0 3px 12px rgba(33, 150, 243, 0.55);
}

.scale-handle:active {
  cursor: ew-resize;
  transform: scale(1.1);
  background: #1976D2;
}

/* ========================================
   ROTATION GUIDE
   ======================================== */
.rotation-guide-circle {
  pointer-events: none;
}

.rotation-handle-marker {
  background: transparent !important;
  border: none !important;
}

.rotation-handle {
  width: 26px;
  height: 26px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(250, 92, 0, 0.4);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rotation-handle i {
  color: white;
  font-size: 11px;
}

.rotation-handle:hover {
  transform: scale(1.2);
  background: #ff7733;
  box-shadow: 0 3px 12px rgba(250, 92, 0, 0.5);
}

.rotation-handle:active {
  cursor: grabbing;
  transform: scale(1.1);
  background: #e55000;
}

.rotation-angle-tooltip {
  background: rgba(21, 27, 32, 0.9) !important;
  border: 1px solid var(--primary) !important;
  color: var(--primary) !important;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px !important;
  border-radius: 4px;
  white-space: nowrap;
}

.rotation-angle-tooltip::before {
  border-top-color: var(--primary) !important;
}

/* Rotation panel section */
.gt-rotation-info {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
}

.gt-rotation-info.gt-info-success {
  color: var(--success);
  background: rgba(46, 204, 113, 0.08);
}

.gt-rotation-controls {
  padding: 0 4px;
}

.gt-rotation-angle {
  margin-bottom: 10px;
}

.gt-rotation-angle label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.gt-rotation-angle input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
}

.gt-rotation-angle input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gt-rotation-actions {
  display: flex;
  gap: 6px;
}

.gt-rotation-actions .btn {
  flex: 1;
  font-size: 12px;
}

/* ========================================
   HISTORY PANEL (Undo/Redo)
   ======================================== */
.history-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
  color: var(--text-primary);
}

.history-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

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

.history-item:hover {
  background: var(--bg-lighter);
}

.history-item:hover ~ .history-item {
  background: rgba(250, 92, 0, 0.1);
}

.history-item i {
  color: var(--primary);
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.history-item-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.history-panel-footer {
  padding: 10px 16px;
  background: var(--bg-darker);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.history-panel-footer small {
  color: var(--text-secondary);
  font-size: 11px;
}

/* ========================================
   TOOL BUTTON STATES
   ======================================== */

/* Estado presionando (para acciones instantáneas) */
.tool-btn.pressing {
  background: var(--primary) !important;
  color: white !important;
}

/* Efecto de progreso para press-and-hold */
.tool-btn.pressing::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: white;
  animation: pressProgress 0.5s linear forwards;
}

@keyframes pressProgress {
  from { width: 0; }
  to { width: 100%; }
}

/* ========================================
   SEGMENT DISTANCE LABELS (on map)
   ======================================== */
.segment-distance-label {
  background: transparent !important;
  border: none !important;
}

.segment-distance-label span {
  display: inline-block;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(250, 92, 0, 0.5);
}

.segment-distance-label.closing span {
  background: rgba(250, 92, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Segmento de cierre (área) */
.measure-segment.closing-segment {
  background: rgba(250, 92, 0, 0.1);
  border-left: 2px solid var(--primary);
}

/* ========================================
   ALTITUDE PANEL
   ======================================== */
#altitude-panel {
  position: fixed !important;
  top: 70px;
  left: calc(var(--panel-width) + 20px);
  width: 260px;
  max-height: 400px;
  z-index: 1000 !important;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#altitude-panel .floating-panel-body {
  padding: 10px;
}

.altitude-points {
  max-height: 250px;
  overflow-y: auto;
}

.altitude-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px 10px;
  font-size: 13px;
}

.altitude-point {
  background: var(--bg-input);
  border-radius: var(--border-radius);
  padding: 10px;
  margin-bottom: 8px;
}

.altitude-point:last-child {
  margin-bottom: 0;
}

.altitude-point-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.altitude-point-name {
  font-weight: 500;
  color: var(--text-primary);
}

.altitude-value {
  color: #4CAF50;
  font-size: 14px;
}

.altitude-error {
  color: var(--danger);
  font-size: 12px;
}

.altitude-point-coords {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'Roboto Mono', monospace;
}

.altitude-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.altitude-actions .btn {
  flex: 1;
}

/* ========================================
   ALTITUDE MARKER & TOOLTIP
   ======================================== */
.altitude-marker {
  background: transparent !important;
  border: none !important;
}

.altitude-tooltip {
  background: rgba(76, 175, 80, 0.9) !important;
  border: none !important;
  color: white !important;
  font-weight: 500;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.altitude-tooltip::before {
  border-top-color: rgba(76, 175, 80, 0.9) !important;
}

/* ========================================
   VIEWSHED PANEL
   ======================================== */
#viewshed-panel {
  position: fixed !important;
  top: 70px;
  left: calc(var(--panel-width) + 20px);
  width: 280px;
  z-index: 1000 !important;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#viewshed-panel .floating-panel-header i {
  color: #4CAF50;
}

#viewshed-panel .floating-panel-body {
  padding: 10px;
}

/* Progress */
.viewshed-progress {
  padding: 10px 0;
}

.viewshed-progress-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.viewshed-progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.viewshed-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #66BB6A);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.viewshed-progress-detail {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Results */
.viewshed-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.viewshed-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  font-size: 12px;
}

.viewshed-stat i {
  color: var(--text-secondary);
  width: 14px;
  text-align: center;
  font-size: 11px;
}

.viewshed-stat-label {
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap;
}

.viewshed-stat-value {
  color: var(--text-primary);
  font-weight: 500;
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
}

.viewshed-stat-highlight {
  color: #4CAF50;
  font-size: 13px;
}

/* Actions */
.viewshed-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.viewshed-actions .btn {
  flex: 1;
}

/* Observer marker */
.viewshed-observer-marker {
  background: transparent !important;
  border: none !important;
}

.viewshed-observer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(76, 175, 80, 0.9);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  color: white;
  font-size: 13px;
}

/* ========================================
   PATHFINDER PANEL
   ======================================== */
#pathfinder-panel {
  position: fixed !important;
  top: 70px;
  left: calc(var(--panel-width) + 20px);
  width: 290px;
  z-index: 1000 !important;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#pathfinder-panel .floating-panel-header i {
  color: #FF9800;
}

#pathfinder-panel .floating-panel-body {
  padding: 10px;
}

.pathfinder-waypoints {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.pathfinder-empty {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 12px 8px;
  font-style: italic;
}

.pathfinder-wp-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  font-size: 11px;
}

.pathfinder-wp-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #FF9800;
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.pathfinder-wp-coord {
  flex: 1;
  color: var(--text-primary);
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
}

.pathfinder-wp-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px;
  font-size: 10px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.pathfinder-wp-remove:hover {
  opacity: 1;
  color: #e74c3c;
}

.pathfinder-calc-actions {
  margin-bottom: 8px;
}

.pathfinder-profile-container {
  margin-top: 6px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  padding: 6px;
  position: relative;
}

.pathfinder-profile-container canvas {
  width: 100%;
  height: 100px;
  display: block;
}

/* Pathfinder waypoint markers on map */
.pathfinder-marker {
  background: transparent !important;
  border: none !important;
}

.pathfinder-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(255, 152, 0, 0.9);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  color: white;
  font-size: 11px;
  font-weight: 700;
}

/* ========================================
   KML LAYER TOOLTIP
   ======================================== */
.kml-tooltip {
  background: rgba(33, 33, 33, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  font-weight: 500;
  font-size: 12px;
  padding: 6px 10px !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.kml-tooltip::before {
  border-top-color: rgba(33, 33, 33, 0.95) !important;
}

/* ========================================
   GEOMETRY TOOLS PANEL
   ======================================== */
#geometry-tools-panel {
  position: fixed;
  top: 70px;
  right: 420px;
  width: 280px;
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#geometry-tools-panel .floating-panel-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#geometry-tools-panel .floating-panel-body::-webkit-scrollbar {
  width: 4px;
}

#geometry-tools-panel .floating-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

#geometry-tools-panel .floating-panel-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

#geometry-tools-panel .floating-panel-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

#geometry-tools-panel.hidden {
  display: none;
}

.gt-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.gt-section:last-child {
  border-bottom: none;
}

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

.gt-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.gt-section-title i {
  color: var(--primary);
  font-size: 14px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-dark);
  transition: 0.3s;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* SNAP Options */
.gt-snap-options {
  transition: opacity 0.2s ease;
}

.gt-snap-options.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.gt-snap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.gt-snap-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-dark);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.gt-snap-option:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.gt-snap-option input {
  display: none;
}

.gt-snap-option input:checked ~ i {
  color: var(--primary);
}

.gt-snap-option input:checked ~ span {
  color: var(--text-primary);
}

.gt-snap-option i {
  font-size: 12px;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
}

.gt-snap-tolerance {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gt-snap-tolerance label {
  font-size: 11px;
  color: var(--text-muted);
}

.gt-snap-tolerance input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--bg-dark);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.gt-snap-tolerance input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.gt-snap-tolerance input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Boolean Operations */
.gt-boolean-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-dark);
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.gt-boolean-info i {
  font-size: 12px;
}

.gt-boolean-info.gt-info-success {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.gt-boolean-info.gt-info-warning {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
}

.gt-boolean-info.gt-info-error {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.gt-boolean-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.gt-boolean-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-dark);
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
}

.gt-boolean-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.gt-boolean-btn:active {
  transform: scale(0.97);
}

.gt-boolean-btn i {
  font-size: 13px;
  width: 16px;
  text-align: center;
}

.gt-boolean-btn span {
  font-size: 11px;
  font-weight: 500;
}

.gt-boolean-status {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(230, 126, 34, 0.1);
  border: 1px solid var(--primary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gt-boolean-status.hidden {
  display: none;
}

.gt-status-text {
  font-size: 11px;
  color: var(--primary);
}

/* Boolean Dialog */
.boolean-dialog {
  text-align: center;
}

.boolean-dialog p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.boolean-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.boolean-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-dark);
  border-radius: var(--border-radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.boolean-preview-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.boolean-preview-item:hover .boolean-cut-icon {
  opacity: 1;
  color: var(--primary);
}

.boolean-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.boolean-name {
  flex: 1;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boolean-cut-icon {
  opacity: 0.3;
  font-size: 14px;
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.boolean-hint {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  margin-bottom: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.boolean-hint i {
  font-size: 12px;
  color: var(--primary);
}

/* ========================================
   SIMPLIFY SECTION
   ======================================== */
.gt-simplify-info {
  font-size: 11px;
  padding: 8px 10px;
  background: var(--bg-dark);
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  margin-bottom: 8px;
}

.gt-simplify-info.gt-info-success {
  background: rgba(46, 204, 113, 0.1);
  color: #2ecc71;
}

.gt-simplify-info i {
  margin-right: 6px;
}

.gt-simplify-controls.hidden {
  display: none;
}

.gt-simplify-tolerance {
  margin-bottom: 10px;
}

.gt-simplify-tolerance label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.gt-simplify-tolerance input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-dark);
  border-radius: 2px;
  outline: none;
}

.gt-simplify-tolerance input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
}

.gt-simplify-tolerance input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.gt-simplify-stats {
  font-size: 11px;
  padding: 8px 10px;
  background: rgba(46, 204, 113, 0.1);
  border-radius: var(--border-radius-sm);
  color: #2ecc71;
  margin-bottom: 10px;
  text-align: center;
}

.gt-simplify-stats.hidden {
  display: none;
}

.gt-simplify-stats i {
  margin-right: 6px;
}

.gt-simplify-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gt-simplify-actions .btn {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  font-size: 11px;
  padding: 6px 8px;
}

/* ========================================
   SNAP INDICATOR (On Map)
   ======================================== */
.snap-indicator {
  position: fixed;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: opacity 0.1s ease;
}

.snap-indicator.hidden {
  opacity: 0;
  visibility: hidden;
}

.snap-indicator-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--primary);
  border-radius: 50%;
  animation: snap-pulse 1s ease-in-out infinite;
}

.snap-indicator-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.snap-indicator-icon i {
  font-size: 8px;
  color: white;
}

/* Snap type variations */
.snap-indicator.snap-vertex .snap-indicator-ring {
  border-color: #27ae60;
}
.snap-indicator.snap-vertex .snap-indicator-icon {
  background: #27ae60;
}

.snap-indicator.snap-edge .snap-indicator-ring {
  border-color: #3498db;
}
.snap-indicator.snap-edge .snap-indicator-icon {
  background: #3498db;
}

.snap-indicator.snap-midpoint .snap-indicator-ring {
  border-color: #9b59b6;
}
.snap-indicator.snap-midpoint .snap-indicator-icon {
  background: #9b59b6;
}

.snap-indicator.snap-perpendicular .snap-indicator-ring {
  border-color: #e74c3c;
}
.snap-indicator.snap-perpendicular .snap-indicator-icon {
  background: #e74c3c;
}

.snap-indicator.snap-intersection .snap-indicator-ring {
  border-color: #f39c12;
}
.snap-indicator.snap-intersection .snap-indicator-icon {
  background: #f39c12;
}

@keyframes snap-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
}

/* Snap guide line */
.snap-guide-line {
  stroke: var(--primary);
  stroke-width: 1;
  stroke-dasharray: 4, 4;
  opacity: 0.7;
}

/* ========================================
   RESPONSIVE - Geometry Tools
   ======================================== */

/* Superwide screens — keep panel near the sidebar, not floating in the middle */
@media (min-width: 2200px) {
  #geometry-tools-panel {
    right: 420px;
  }
}

@media (max-width: 1200px) {
  #geometry-tools-panel {
    right: 20px;
    top: auto;
    bottom: 80px;
    width: 260px;
    max-height: calc(100vh - 160px);
  }
}

@media (max-width: 768px) {
  #geometry-tools-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 70px;
    max-height: calc(100vh - 140px);
  }
  
  .gt-snap-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .gt-boolean-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .gt-boolean-btn span {
    display: none;
  }
}


/* ========================================
   SECCIONAR PANEL
   ======================================== */
#seccionar-panel {
  position: fixed !important;
  top: 70px;
  left: calc(var(--panel-width) + 20px);
  width: 290px;
  z-index: 1000 !important;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#seccionar-panel .floating-panel-header i {
  color: #FF7043;
}

#seccionar-panel .floating-panel-body {
  padding: 10px;
}

.seccionar-instructions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 112, 67, 0.08);
  border-radius: var(--border-radius);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 10px;
}

.seccionar-instructions i {
  color: #FF7043;
  margin-top: 1px;
  font-size: 12px;
  flex-shrink: 0;
}

.seccionar-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.seccionar-poly-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 180px;
  overflow-y: auto;
}

.seccionar-poly-list::-webkit-scrollbar {
  width: 4px;
}

.seccionar-poly-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.seccionar-empty {
  text-align: center;
  padding: 14px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.6;
}

.seccionar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--bg-input);
  border-radius: var(--border-radius);
  font-size: 12px;
}

.seccionar-item-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.seccionar-item-name {
  flex: 1;
  color: var(--text-primary);
}

.seccionar-item-pts {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: 'Roboto Mono', monospace;
}

.seccionar-item .btn-icon {
  opacity: 0.5;
  transition: opacity 0.2s;
}

.seccionar-item:hover .btn-icon {
  opacity: 1;
}

#seccionar-panel .viewshed-progress-fill {
  background: linear-gradient(90deg, #FF7043, #FF8A65);
}

#seccionar-panel .viewshed-stat-highlight {
  color: #FF7043;
}

/* ========================================
   HEATMAP PANEL
   ======================================== */
#heatmap-panel {
  position: fixed !important;
  top: 70px;
  left: calc(var(--panel-width) + 20px);
  width: 290px;
  z-index: 1000 !important;
  background: var(--bg-panel);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

#heatmap-panel .floating-panel-header i {
  color: #FF5722;
}

#heatmap-panel .floating-panel-body {
  padding: 10px;
}

.heatmap-highlight {
  color: #FF5722 !important;
  font-size: 13px;
}

/* Sliders */
.heatmap-sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.heatmap-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.heatmap-slider-label {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 52px;
}

.heatmap-slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: #FF5722;
}

.heatmap-slider-value {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Roboto Mono', monospace;
  min-width: 36px;
  text-align: right;
}

/* Gradient legend */
.heatmap-gradient-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.heatmap-gradient-bar {
  flex: 1;
  display: flex;
  gap: 1px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.heatmap-gradient-labels {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Export actions */
#heatmap-export-actions {
  flex-wrap: wrap;
}

#heatmap-export-actions .btn {
  font-size: 11px;
  padding: 5px 8px;
}

#heatmap-panel .viewshed-progress-fill {
  background: linear-gradient(90deg, #FF5722, #FF8A65);
}

/* Heatmap image overlay - smooth interpolation at all zoom levels */
.geosv-heatmap-overlay {
  image-rendering: auto;
}

/* ========================================
   DAS EXPORT / DOWNLOAD BUTTONS
   ======================================== */

/* Header actions container - botón de descarga + chevron */
.das-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  pointer-events: auto;
}

/* Checkbox "Seleccionar todo" en headers de sección/subsección */
.das-select-all-cb {
  width: 14px;
  height: 14px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
  accent-color: var(--primary);
  flex-shrink: 0;
  margin: 0;
}

/* Botón de descarga en acordeón */
.das-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: rgba(250, 92, 0, 0.15);
  color: var(--primary);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.das-download-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

/* Modal de exportación */
.das-export-modal {
  padding: 4px 0;
}

.das-export-info {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.das-export-info i {
  color: var(--primary);
}

.das-export-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.das-export-formats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.das-export-format-option {
  cursor: pointer;
}

.das-export-format-option input[type="radio"] {
  display: none;
}

.das-export-format-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  transition: all 0.2s ease;
}

.das-export-format-option input[type="radio"]:checked + .das-export-format-card {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.1);
}

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

.das-export-format-card i {
  font-size: 20px;
  color: var(--text-secondary);
}

.das-export-format-option input[type="radio"]:checked + .das-export-format-card i {
  color: var(--primary);
}

.das-export-format-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.das-export-format-desc {
  font-size: 10px;
  color: var(--text-secondary);
}

/* Progress bar */
.das-export-progress {
  margin-top: 16px;
}

.das-export-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.das-export-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #ff8a3d);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.das-export-progress-text {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ========================================
   MULTI-FORMAT EXPORT MODAL
   ======================================== */

.export-modal-body {
  padding: 4px 0;
}

.export-modal-body .export-filename-group {
  margin-bottom: 16px;
}

.export-modal-body .export-filename-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.export-modal-body .export-filename-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Roboto Mono', monospace;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.export-modal-body .export-filename-input:focus {
  border-color: var(--primary);
}

.export-modal-body .export-formats-title {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.export-modal-body .export-formats-title i {
  font-size: 11px;
}

.export-formats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.export-format-check {
  cursor: pointer;
  display: block;
}

.export-format-check input[type="checkbox"] {
  display: none;
}

.export-format-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  transition: all 0.2s ease;
  position: relative;
}

.export-format-check input[type="checkbox"]:checked + .export-format-card {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.08);
}

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

.export-format-card .format-icon {
  font-size: 18px;
  color: var(--text-secondary);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.export-format-check input[type="checkbox"]:checked + .export-format-card .format-icon {
  color: var(--primary);
}

.export-format-card .format-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.export-format-card .format-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.export-format-card .format-desc {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.export-format-card .format-check-icon {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.export-format-check input[type="checkbox"]:checked + .export-format-card .format-check-icon {
  opacity: 1;
}

.export-format-check.is-locked .export-format-card {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.08);
}

.export-format-check.is-locked .export-format-card .format-icon {
  color: var(--primary);
}

.export-format-check.is-locked .export-format-card .format-check-icon {
  opacity: 1;
}


.export-format-composite {
  position: relative;
}

.export-format-composite > input[type="checkbox"] {
  display: none;
}

.export-format-composite > input[type="checkbox"]:checked + .export-format-card {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.08);
}

.export-format-composite > input[type="checkbox"]:checked + .export-format-card .format-icon {
  color: var(--primary);
}

.export-format-composite > input[type="checkbox"]:checked + .export-format-card .format-check-icon {
  opacity: 1;
}

.export-kmz-toggle {
  position: absolute;
  right: 28px;
  bottom: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.export-kmz-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid var(--border-color);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}

.export-kmz-toggle input[type="checkbox"]::before {
  content: "";
  width: 6px;
  height: 6px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: var(--primary);
  clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 18%, 84% 4%, 38% 68%);
}

.export-kmz-toggle input[type="checkbox"]:checked {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.10);
}

.export-kmz-toggle input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.export-kmz-toggle.is-active {
  color: var(--primary);
}

.export-modal-note {
  margin-top: 12px;
  padding: 8px 10px;
  background: rgba(250, 92, 0, 0.06);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  gap: 6px;
}

.export-modal-note.visible {
  display: flex;
}

.export-modal-note i {
  color: var(--primary);
  flex-shrink: 0;
}

/* ========================================
   MOVE TO FOLDER MODAL
   ======================================== */

.move-folder-modal {
  padding: 4px 0;
}

.move-folder-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.move-folder-subtitle strong {
  color: var(--text-primary);
}

.move-folder-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.move-folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.move-folder-item:hover {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.08);
}

.move-folder-current {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.05);
  opacity: 0.6;
  cursor: default;
}

.move-folder-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.move-folder-disabled:hover {
  border-color: var(--border-color);
  background: var(--bg-tertiary);
}

.move-folder-item.move-folder-selected {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.15);
}

.move-folder-item.move-folder-selected .move-folder-icon {
  color: var(--primary);
}

.move-folder-icon {
  font-size: 16px;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.move-folder-item:hover .move-folder-icon,
.move-folder-current .move-folder-icon {
  color: var(--primary);
}

.move-folder-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.move-folder-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.move-folder-count {
  font-size: 11px;
  color: var(--text-muted);
}

.move-folder-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(250, 92, 0, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.move-folder-badge-disabled {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
}

/* ========================================
   DROP OVERLAY (Drag & Drop global)
   ======================================== */
#drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(21, 27, 32, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#drop-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 60px;
  border: 3px dashed var(--primary);
  border-radius: 16px;
  background: rgba(250, 92, 0, 0.05);
}

.drop-overlay-content > i {
  font-size: 48px;
  color: var(--primary);
  animation: dropBounce 1.5s ease infinite;
}

.drop-overlay-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-overlay-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

@keyframes dropBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ============================================================
   Cuadro de Datos Técnicos
   ============================================================ */
.technical-sheet-modal .modal-body {
  padding-top: 14px;
}

.technical-sheet-filename-group {
  margin-bottom: 14px;
}

.technical-sheet-filename-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.technical-sheet-filename-group input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-size: 13px;
}

.technical-sheet-filename-group input:focus {
  outline: none;
  border-color: rgba(250, 92, 0, 0.6);
  box-shadow: 0 0 0 2px rgba(250, 92, 0, 0.15);
}


.technical-sheet-mode-group {
  margin-bottom: 14px;
}

.technical-sheet-mode-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.technical-sheet-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.technical-sheet-mode-option input {
  margin-top: 2px;
}

.technical-sheet-mode-option strong,
.technical-sheet-mode-option small {
  display: block;
  line-height: 1.25;
}

.technical-sheet-mode-option strong {
  color: var(--text-primary);
  font-size: 12px;
}

.technical-sheet-mode-option small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.technical-sheet-selection-wrap {
  margin-bottom: 14px;
  max-height: 170px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(0,0,0,0.12);
}

.technical-sheet-selection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.technical-sheet-selection-table th,
.technical-sheet-selection-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  vertical-align: top;
}

.technical-sheet-selection-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(24, 34, 40, 0.98);
  color: var(--text-primary);
  font-weight: 700;
}

.technical-sheet-selection-table td {
  color: var(--text-secondary);
}

.technical-sheet-selection-table td:nth-child(1),
.technical-sheet-selection-table td:nth-child(4),
.technical-sheet-selection-table td:nth-child(5) {
  white-space: nowrap;
}

.technical-sheet-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.technical-sheet-summary-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.technical-sheet-summary-card span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.technical-sheet-summary-card strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.3;
}

.technical-sheet-preview-wrap {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  overflow: auto;
  max-height: 52vh;
  background: rgba(0,0,0,0.12);
}

.technical-sheet-preview-card {
  min-width: 720px;
  padding: 18px 18px 14px;
  background: #f3f5f7;
  color: #111827;
}

.technical-sheet-preview-title,
.technical-sheet-preview-subtitle,
.technical-sheet-preview-total {
  border: 1px solid #303030;
  background: #c8d9ea;
  padding: 7px 10px;
  text-align: center;
  font-weight: 700;
}

.technical-sheet-preview-title {
  font-size: 24px;
}

.technical-sheet-preview-subtitle {
  background: #d6e4f2;
  border-top: none;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.technical-sheet-preview-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
}

.technical-sheet-preview-table th,
.technical-sheet-preview-table td {
  border: 1px solid #303030;
  padding: 8px 10px;
  font-size: 13px;
  text-align: center;
}

.technical-sheet-preview-table th {
  background: #c8d9ea;
  font-weight: 700;
}

.technical-sheet-preview-table td:nth-child(4),
.technical-sheet-preview-table td:nth-child(5) {
  font-variant-numeric: tabular-nums;
}

.technical-sheet-preview-total {
  background: #efefef;
  border-top: none;
  font-size: 15px;
}

.technical-sheet-preview-total + .technical-sheet-preview-total {
  border-top: none;
}

.technical-sheet-note {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.technical-sheet-note i {
  color: var(--primary);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .technical-sheet-mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .technical-sheet-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .technical-sheet-preview-card {
    min-width: 640px;
    padding: 14px;
  }

  .technical-sheet-preview-title {
    font-size: 18px;
  }
}


/* ============================================================
   Print Export Modal
   ============================================================ */

.cdt-export-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cdt-export-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cdt-export-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.cdt-export-field label i {
  margin-right: 6px;
  color: var(--text-muted);
}

.cdt-export-field input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-input);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.cdt-export-field input[type="text"]::placeholder {
  color: var(--text-muted);
}

.cdt-export-field input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(250, 92, 0, 0.18);
  background: var(--bg-hover);
}

.cdt-export-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cdt-export-option {
  display: block;
  cursor: pointer;
}

.cdt-export-option input {
  display: none;
}

.cdt-export-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.cdt-export-option:hover span {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.cdt-export-option input:checked + span {
  border-color: var(--primary);
  background: rgba(250, 92, 0, 0.14);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(250, 92, 0, 0.22);
}

.cdt-export-option input:checked + span i {
  color: var(--primary);
}

.cdt-export-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.cdt-export-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.cdt-export-note {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}


.cdt-export-modal .modal-body {
  background: var(--bg-panel);
}

.cdt-export-modal .modal-footer .btn-primary {
  background: var(--primary);
  color: #fff;
}

.cdt-export-modal .modal-footer .btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.cdt-export-modal .modal-footer .btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
}

.cdt-export-modal .modal-footer .btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

@media (max-width: 640px) {
  .cdt-export-options {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   NOTAS — Badge panel + tooltip
   ============================================================ */

/* Badge en esquina superior-derecha de element-item / folder-header */
.note-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  padding: 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.note-badge i {
  font-size: 11px;
  color: #FFD600;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.note-badge:hover {
  transform: scale(1.2);
  opacity: 0.85;
}

/* Tooltip de nota: post-it dibujado con CSS y texto escrito encima */
.note-tooltip {
  position: fixed;
  z-index: 9999;
  width: 188px;
  min-height: 168px;
  pointer-events: none;
  animation: note-tooltip-appear 0.15s ease;
}

@keyframes note-tooltip-appear {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1);       }
}

.note-tooltip-paper {
  position: relative;
  width: 188px;
  min-height: 168px;
  box-sizing: border-box;
  padding: 42px 24px 28px 24px;
  overflow: hidden;
  transform: rotate(-1deg);
  background:
    linear-gradient(180deg,
      #ffd91a 0%,
      #ffd91a 28%,
      #ffe764 29%,
      #ffeb6b 70%,
      #ffe25a 100%);
  border-radius: 2px 2px 28px 2px;
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.34),
    0 3px 7px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.note-tooltip-paper::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 42px;
  z-index: 0;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.95), rgba(255, 221, 28, 0.90));
  box-shadow: inset 0 -1px 0 rgba(210, 160, 0, 0.12);
}

.note-tooltip-paper::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 76px;
  height: 54px;
  z-index: 1;
  background:
    radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.23) 0%, rgba(0,0,0,0.14) 32%, transparent 63%),
    linear-gradient(135deg, rgba(255, 245, 117, 0.98), rgba(247, 205, 41, 0.98));
  clip-path: polygon(28% 100%, 100% 20%, 100% 100%);
  box-shadow: -10px -7px 14px rgba(0, 0, 0, 0.10);
}

.note-tooltip-text {
  position: relative;
  z-index: 2;
  width: 100%;
  max-height: 98px;
  overflow: hidden;
  color: #263034;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  font-family: "Segoe Print", "Comic Sans MS", "Bradley Hand", cursive;
  font-size: 12px;
  line-height: 1.34;
  font-weight: 400;
  letter-spacing: 0;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 1px 0 rgba(255,255,255,0.20);
}

/* ========================================
   WORKSPACE AUDIT TOOLTIP
   Autoría colaborativa limpia: sin avatar visible, solo tooltip al hover
   ======================================== */
#panel-elements-section.ws-mode-on .element-item[data-tooltip],
#panel-elements-section.ws-mode-on .folder-header[data-tooltip] {
  cursor: default;
}

#panel-elements-section.ws-mode-on .element-item[data-tooltip]:hover,
#panel-elements-section.ws-mode-on .folder-header[data-tooltip]:hover {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}

#panel-elements-section:not(.ws-mode-on) .element-item[data-tooltip],
#panel-elements-section:not(.ws-mode-on) .folder-header[data-tooltip] {
  cursor: default;
}

/* ========================================
   SEARCH PANEL - SCOPES AND EXTENDED RESULTS
   ======================================== */
#search-panel .search-scope-options {
  display: grid;
  gap: 6px;
  margin: 0 0 10px 0;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.025);
}

#search-panel .search-scope-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

#search-panel .search-scope-option input {
  margin: 0;
  accent-color: var(--primary);
}

#search-panel .search-results-summary {
  padding: 5px 8px 8px;
  font-size: 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

#search-panel .search-result-item {
  align-items: flex-start;
  gap: 9px;
}

#search-panel .search-result-item i {
  width: 16px;
  text-align: center;
  margin-top: 2px;
  color: var(--primary);
}

#search-panel .search-result-content {
  min-width: 0;
  flex: 1;
}

#search-panel .search-result-title {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#search-panel .search-result-meta,
#search-panel .search-result-match {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.25;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#search-panel .search-result-match {
  color: var(--text-secondary);
}

#search-panel .search-result-go {
  flex-shrink: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid rgba(250, 92, 0, 0.45);
  border-radius: 8px;
  background: rgba(250, 92, 0, 0.08);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

#search-panel .search-result-go:hover {
  background: rgba(250, 92, 0, 0.16);
  border-color: rgba(250, 92, 0, 0.7);
}

#search-panel .search-result-go i {
  width: auto;
  margin: 0;
  font-size: 10px;
  line-height: 1;
}

#search-panel .search-result-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 5px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 9px;
  line-height: 1.2;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

/* ========================================
   CIRAS filter panel
   ======================================== */
.cira-filter-panel {
  position: fixed;
  top: 64px;
  left: 364px;
  transform: none;
  width: min(292px, calc(100vw - 18px));
  max-height: calc(100vh - 82px);
  background: var(--bg-panel);
  border: 1px solid rgba(250, 92, 0, 0.45);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: calc(var(--z-modal) + 40);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.cira-filter-panel.hidden {
  display: none;
}

.cira-filter-header {
  min-height: 28px;
  padding: 0 8px;
  cursor: move;
  user-select: none;
}

.cira-filter-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.cira-filter-title i {
  color: var(--primary);
  font-size: 11px;
}

.cira-filter-body {
  padding: 6px 8px;
  overflow: visible;
  flex: 0 0 auto;
}

.cira-filter-count {
  margin-bottom: 5px;
  padding: 5px 7px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
}

.cira-filter-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 10.5px;
}

.cira-filter-loading i {
  color: var(--primary);
}

.cira-filter-controls {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px;
  align-items: end;
}

.cira-filter-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cira-filter-field span {
  color: var(--text-secondary);
  font-size: 9.5px;
  font-weight: 700;
}

.cira-filter-field select {
  width: 100%;
  height: 24px;
  padding: 2px 22px 2px 7px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 10.5px;
  line-height: 1.15;
  outline: none;
  cursor: pointer;
}

.cira-filter-field select option {
  font-size: 10.5px;
}

.cira-filter-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(250, 92, 0, 0.35);
}

.cira-filter-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 5px 8px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-dark);
  border-radius: 0 0 10px 10px;
}

.cira-filter-footer .btn {
  min-height: 24px;
  padding: 0 10px;
  font-size: 10.5px;
  border-radius: 6px;
}

.cira-filter-close {
  width: 24px;
  height: 24px;
  min-width: 24px;
  font-size: 18px;
}

@media (max-width: 420px) {
  .cira-filter-panel {
    top: 58px;
    width: calc(100vw - 16px);
  }

  .cira-filter-controls {
    grid-template-columns: 70px minmax(0, 1fr);
  }
}


/* ========================================
   CIRA MC consultation panel
   ======================================== */
.sigda-popup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 6px;
}

.sigda-popup-action {
  width: 100%;
  justify-content: center;
  gap: 6px;
}

.sigda-popup-mc-actions {
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.sigda-popup-mc-label {
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sigda-popup-mc-button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.sigda-popup-mc-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.sigda-popup-mc-button:active:not(:disabled) {
  transform: translateY(1px);
}

.sigda-popup-mc-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Compatibilidad con versiones anteriores del botón de ícono */
.sigda-popup-mc-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cira-mc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 23, 0.38);
  backdrop-filter: blur(3px);
  z-index: 20000;
}

.cira-mc-backdrop.hidden {
  display: none;
}

.cira-mc-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  width: min(1180px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 56px));
  transform: translate(-50%, -50%);
  background: var(--bg-panel);
  border: 1px solid rgba(250, 92, 0, 0.45);
  border-radius: var(--border-radius-lg);
  box-shadow: none;
  z-index: 20010;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cira-mc-panel.hidden {
  display: none;
}

.cira-mc-header {
  min-height: 38px;
  padding: 0 10px;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}

.cira-mc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.cira-mc-title i {
  color: var(--primary);
  font-size: 12px;
}

.cira-mc-body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.cira-mc-status,
.cira-mc-alert {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 180px;
  padding: 18px;
  color: var(--text-secondary);
  font-size: 12px;
}

.cira-mc-status i,
.cira-mc-alert i {
  color: var(--primary);
}

.cira-mc-frame-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--bg-dark);
}

.cira-mc-top-pane {
  height: 60%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 60%) minmax(320px, 40%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cira-mc-document-pane {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.cira-mc-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg-panel);
}

.cira-mc-pdf-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  overflow: hidden;
}

.cira-mc-pdf-head {
  min-height: 32px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.cira-mc-pdf-head a,
.cira-mc-pdf-open {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(250, 92, 0, 0.52);
  border-radius: 999px;
  background: rgba(250, 92, 0, 0.18);
  color: var(--primary-light, #ff8a38);
  text-decoration: none;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.cira-mc-pdf-head a:hover,
.cira-mc-pdf-open:hover {
  background: rgba(250, 92, 0, 0.28);
  border-color: var(--primary);
  color: var(--primary-light, #ff8a38);
}

.cira-mc-pdf-frame {
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #111b20;
}

.cira-mc-pdf-unavailable {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.cira-mc-pdf-unavailable i {
  color: var(--primary);
  font-size: 18px;
}

.cira-mc-map-module {
  height: 40%;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--bg-panel);
  box-shadow: none;
  backdrop-filter: none;
}

.cira-mc-map-head {
  min-height: 38px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.cira-mc-map-title {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.cira-mc-map-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 700;
}

.cira-mc-map-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.cira-mc-add-portal,
.cira-mc-download-kmz {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(250, 92, 0, 0.52);
  border-radius: 999px;
  background: rgba(250, 92, 0, 0.18);
  color: var(--primary-light, #ff8a38);
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cira-mc-add-portal:hover:not(:disabled),
.cira-mc-download-kmz:hover:not(:disabled) {
  background: rgba(250, 92, 0, 0.28);
  border-color: var(--primary);
}

.cira-mc-add-portal:disabled,
.cira-mc-download-kmz:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cira-mc-map-preview {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #101b20;
  overflow: hidden;
}

.cira-mc-map-preview .leaflet-control-zoom {
  border: 0;
  margin: 7px;
  box-shadow: none;
}

.cira-mc-map-preview .leaflet-control-zoom a {
  width: 24px;
  height: 24px;
  line-height: 24px;
  background: rgba(28, 44, 52, 0.94);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.cira-mc-map-status {
  min-height: 24px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.2;
  flex-shrink: 0;
}

.cira-mc-map-status i {
  color: var(--primary);
  font-size: 10px;
}

.cira-mc-map-status-success i {
  color: #6ee7a9;
}

.cira-mc-map-status-warning i {
  color: #ffd166;
}

.cira-mc-map-status-error i {
  color: #ff6b6b;
}

.cira-mc-muted {
  color: var(--text-muted);
  font-size: 11px;
}

@media (max-width: 920px) {
  .cira-mc-top-pane {
    grid-template-columns: 1fr;
  }

  .cira-mc-document-pane {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .cira-mc-pdf-pane {
    display: none;
  }
}

@media (max-width: 760px) {
  .cira-mc-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 76px);
  }

  .cira-mc-top-pane {
    height: 58%;
  }

  .cira-mc-map-module {
    height: 42%;
    min-height: 205px;
  }

  .cira-mc-map-head {
    min-height: 40px;
    padding: 7px 8px;
  }

  .cira-mc-add-portal,
  .cira-mc-download-kmz {
    padding: 0 8px;
    font-size: 10px;
  }
}

/* Ortogonal por dimensiones */
.orthogonal-dim-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.orthogonal-dim-help {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 2px;
}

.orthogonal-dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.orthogonal-dim-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
}

@media (max-width: 520px) {
  .orthogonal-dim-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   SIGDA official document search
   ======================================== */
.sigda-popup-doc-actions {
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.sigda-popup-doc-label {
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sigda-popup-doc-button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid rgba(250, 92, 0, 0.45);
  border-radius: 999px;
  background: rgba(250, 92, 0, 0.16);
  color: var(--primary-light, #ff8a38);
  font-size: 10.5px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sigda-popup-doc-button:hover {
  background: rgba(250, 92, 0, 0.26);
  border-color: var(--primary);
}

.sigda-popup-doc-button:active {
  transform: translateY(1px);
}

.sigda-popup-doc-button i {
  font-size: 10px;
}

.sigda-doc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 23, 0.38);
  backdrop-filter: blur(3px);
  z-index: 20020;
}

.sigda-doc-backdrop.hidden {
  display: none;
}

.sigda-doc-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  width: min(980px, calc(100vw - 36px));
  height: min(780px, calc(100vh - 56px));
  transform: translate(-50%, -50%);
  background: var(--bg-panel);
  border: 1px solid rgba(250, 92, 0, 0.42);
  border-radius: var(--border-radius-lg);
  box-shadow: none;
  z-index: 20030;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sigda-doc-panel.hidden {
  display: none;
}

.sigda-doc-header {
  min-height: 38px;
  padding: 0 10px;
  cursor: default;
  user-select: none;
  flex-shrink: 0;
}

.sigda-doc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  font-size: 13px;
  font-weight: 750;
  color: var(--text-primary);
}

.sigda-doc-title i {
  color: var(--primary);
  font-size: 12px;
}

.sigda-doc-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-dark);
}

.sigda-doc-loading {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.sigda-doc-loading-card {
  width: min(520px, 100%);
  padding: 22px;
  border: 1px solid rgba(250, 92, 0, 0.24);
  border-radius: 14px;
  background: rgba(16, 27, 32, 0.72);
  text-align: center;
}

.sigda-doc-loading-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(250, 92, 0, 0.16);
  color: var(--primary-light, #ff8a38);
}

.sigda-doc-loading-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sigda-doc-loading-name {
  margin-top: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.sigda-doc-loading-hint {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.sigda-doc-progress-card {
  text-align: left;
}

.sigda-doc-progress-card .sigda-doc-loading-title,
.sigda-doc-progress-card .sigda-doc-loading-name,
.sigda-doc-progress-card .sigda-doc-loading-hint {
  text-align: center;
}

.sigda-doc-progress-track {
  position: relative;
  height: 8px;
  margin: 18px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sigda-doc-progress-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 10%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(250, 92, 0, 0.75), rgba(255, 138, 56, 0.95));
  box-shadow: 0 0 14px rgba(250, 92, 0, 0.28);
  transition: width 0.45s ease;
}

.sigda-doc-progress-current {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.sigda-doc-progress-current strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.sigda-doc-progress-current span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.sigda-doc-progress-steps {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.sigda-doc-progress-step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.3;
}

.sigda-doc-progress-step span {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 900;
}

.sigda-doc-progress-step strong {
  color: inherit;
  font-size: 10.5px;
  font-weight: 800;
}

.sigda-doc-progress-step.is-active {
  color: var(--text-primary);
}

.sigda-doc-progress-step.is-active span {
  background: rgba(250, 92, 0, 0.2);
  border-color: rgba(250, 92, 0, 0.5);
  color: var(--primary-light, #ff8a38);
}

.sigda-doc-progress-step.is-complete {
  color: var(--text-secondary);
}

.sigda-doc-progress-step.is-complete span {
  background: rgba(110, 231, 169, 0.12);
  border-color: rgba(110, 231, 169, 0.25);
  color: #6ee7a9;
}

.sigda-doc-alert {
  margin: 14px;
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 12px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  color: var(--text-secondary);
  font-size: 12px;
}

.sigda-doc-alert i {
  color: #ff6b6b;
  margin-top: 2px;
}

.sigda-doc-alert strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.sigda-doc-result {
  padding: 12px;
}

.sigda-doc-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(250, 92, 0, 0.15), rgba(16, 27, 32, 0.84));
}

.sigda-doc-hero-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(250, 92, 0, 0.16);
  color: var(--primary-light, #ff8a38);
  flex-shrink: 0;
}

.sigda-doc-kicker {
  color: var(--primary-light, #ff8a38);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sigda-doc-hero h3 {
  margin: 3px 0 6px;
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.25;
}

.sigda-doc-hero p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.sigda-doc-badges {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.sigda-doc-badges span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sigda-doc-status-found .sigda-doc-badges span:first-child {
  background: rgba(110, 231, 169, 0.14);
  color: #6ee7a9;
}

.sigda-doc-status-ambiguous .sigda-doc-badges span:first-child {
  background: rgba(255, 209, 102, 0.14);
  color: #ffd166;
}

.sigda-doc-status-not_found .sigda-doc-badges span:first-child,
.sigda-doc-status-error .sigda-doc-badges span:first-child {
  background: rgba(255, 107, 107, 0.13);
  color: #ff8f8f;
}

.sigda-doc-section {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: var(--bg-panel);
}

.sigda-doc-section h4 {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.sigda-doc-section h4 i {
  color: var(--primary);
  font-size: 11px;
}

.sigda-doc-facts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sigda-doc-fact {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.sigda-doc-fact span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.sigda-doc-fact strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sigda-doc-downloads,
.sigda-doc-evidence-list,
.sigda-doc-source-list,
.sigda-doc-trace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sigda-doc-download-card,
.sigda-doc-evidence-card,
.sigda-doc-source-row,
.sigda-doc-trace-card {
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.sigda-doc-download-card,
.sigda-doc-trace-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sigda-doc-download-card > div,
.sigda-doc-trace-card-main {
  min-width: 0;
}

.sigda-doc-download-card strong,
.sigda-doc-evidence-title,
.sigda-doc-source-row strong,
.sigda-doc-trace-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sigda-doc-download-card span,
.sigda-doc-source-row span,
.sigda-doc-trace-card span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sigda-doc-link-button,
.sigda-doc-secondary-button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid rgba(250, 92, 0, 0.52);
  border-radius: 999px;
  background: rgba(250, 92, 0, 0.18);
  color: var(--primary-light, #ff8a38);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.sigda-doc-link-button:hover,
.sigda-doc-secondary-button:hover {
  background: rgba(250, 92, 0, 0.28);
  border-color: var(--primary);
  color: var(--primary-light, #ff8a38);
}

.sigda-doc-link-disabled {
  color: var(--text-muted);
  font-size: 10.5px;
}

.sigda-doc-download-note,
.sigda-doc-trace-card p,
.sigda-doc-trace-hint {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.sigda-doc-download-note {
  color: var(--text-secondary);
}

.sigda-doc-traceability {
  border-color: rgba(255, 209, 102, 0.16);
  background: rgba(255, 209, 102, 0.035);
}

.sigda-doc-traceability h4 i {
  color: #ffd166;
}

.sigda-doc-trace-hint {
  margin: -2px 0 10px;
  color: var(--text-muted);
}

.sigda-doc-trace-card {
  border-color: rgba(255, 209, 102, 0.12);
}

.sigda-doc-download-note b,
.sigda-doc-trace-card p b {
  color: var(--text-primary);
  font-weight: 850;
}

.sigda-doc-evidence-card p {
  margin: 6px 0;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

.sigda-doc-evidence-card span {
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.sigda-doc-evidence-title a,
.sigda-doc-source-row a {
  color: var(--primary-light, #ff8a38);
  text-decoration: none;
}

.sigda-doc-evidence-title a:hover,
.sigda-doc-source-row a:hover {
  text-decoration: underline;
}

.sigda-doc-empty {
  padding: 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.13);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.sigda-doc-warnings {
  border-color: rgba(255, 209, 102, 0.22);
  background: rgba(255, 209, 102, 0.055);
}

.sigda-doc-warnings ul {
  margin: 0;
  padding-left: 17px;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

.sigda-doc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sigda-doc-chips span {
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 10.5px;
  line-height: 1.2;
}

.sigda-doc-footer-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.sigda-doc-secondary-button {
  min-height: 30px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 840px) {
  .sigda-doc-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 76px);
  }

  .sigda-doc-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sigda-doc-badges {
    grid-column: 1 / -1;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sigda-doc-facts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .sigda-popup-doc-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .sigda-popup-doc-button {
    width: 100%;
  }

  .sigda-doc-result {
    padding: 8px;
  }

  .sigda-doc-hero,
  .sigda-doc-section {
    border-radius: 12px;
    padding: 10px;
  }

  .sigda-doc-facts-grid {
    grid-template-columns: 1fr;
  }

  .sigda-doc-download-card,
  .sigda-doc-trace-card {
    align-items: stretch;
    flex-direction: column;
  }

  .sigda-doc-link-button {
    width: 100%;
  }
}

@media (min-width: 760px) {
  .sigda-doc-progress-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
