/* --- Reset y base --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f4f7fa;
  color: #1a2634;
  padding: 20px;
}
.container {
  max-width: 1000px;
  margin: 0 auto;
}

/* --- Cabecera --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
  background: white;
  padding: 20px 25px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.header h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: #0b2b44;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  background: #2a7de1;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: #1a5bbf; }
.btn-secondary {
  background: #6c7a8d;
}
.btn-secondary:hover { background: #4e5a6b; }
.btn-danger {
  background: #d9534f;
}
.btn-danger:hover { background: #c9302c; }
.btn-success {
  background: #28a745;
}
.btn-success:hover { background: #1e7e34; }
.btn-warning {
  background: #f0ad4e;
  color: #1a2634;
}
.btn-warning:hover { background: #d58512; }
.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* --- Tarjetas de posición --- */
.position-card {
  background: white;
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border-left: 6px solid #2a7de1;
  transition: 0.2s;
}
.position-card.cerrada {
  border-left-color: #9aa6b5;
  opacity: 0.75;
}
.position-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.position-title {
  font-weight: 600;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 30px;
  background: #d4edda;
  color: #155724;
  text-transform: uppercase;
}
.badge.cerrada {
  background: #e2e6ea;
  color: #383d41;
}
.range-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 30px;
}
.range-status.in-range {
  color: #155724;
  background: #d4edda;
}
.range-status.out-of-range {
  color: #7a4b00;
  background: #fff3cd;
}
.sync-status {
  font-size: 0.85rem;
  color: #3d4a5a;
  margin: -18px 0 18px;
}
.position-details {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.9rem;
  color: #3d4a5a;
  margin: 6px 0 12px 0;
}
.position-details span {
  background: #f0f3f7;
  padding: 4px 12px;
  border-radius: 20px;
}
.position-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.fee-list {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e9ecef;
  font-size: 0.9rem;
}
.fee-item {
  background: #f8f9fa;
  padding: 6px 12px;
  border-radius: 30px;
  display: inline-block;
  margin: 4px 8px 4px 0;
}
.no-fees {
  color: #9aa6b5;
  font-style: italic;
}

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px);
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: white;
  padding: 28px 32px;
  border-radius: 24px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  animation: fadeIn 0.25s;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal h2 {
  margin-bottom: 18px;
  font-weight: 600;
}
.modal label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 500;
  font-size: 0.9rem;
}
.modal input, .modal textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d9e6;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  transition: 0.2s;
}
.modal input:focus, .modal textarea:focus {
  outline: none;
  border-color: #2a7de1;
  box-shadow: 0 0 0 3px rgba(42,125,225,0.15);
}
.modal textarea {
  resize: vertical;
  min-height: 60px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}
.btn-cancel {
  background: #e9ecef;
  color: #1a2634;
}
.btn-cancel:hover {
  background: #d1d9e6;
}

/* --- Utilidades --- */
.text-muted {
  color: #6c7a8d;
}
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- Responsive --- */
@media (max-width: 600px) {
  .header h1 { font-size: 1.4rem; }
  .modal { padding: 20px; }
  .position-card { padding: 14px; }
}
