/* =====================================================================
   Operaciones (solo operaciones.html). Mismo fondo gris oscuro que Mensajes.
   Reutiliza tarjetas, botones, etiquetas, campos y barras de panel.css.
   ===================================================================== */

body.page-ops { background: #1b1b1b; }
/* Fondo: img/img_operacion.jpg fija (no se mueve al hacer scroll) y oscurecida para que todo se lea.
   Capa fija en vez de background-attachment: fixed, que falla en iPhone/iPad (igual que en el panel).
   El sol queda en el centro de la pantalla: un velo radial extra lo apaga detrás de las tarjetas. */
body.page-ops::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 45% at 50% 45%, rgba(10, 10, 10, 0.45), transparent 70%),
    linear-gradient(180deg, rgba(10, 10, 10, 0.70), rgba(10, 10, 10, 0.88)),
    url("../img/img_operacion.jpg") center 40% / cover no-repeat,
    #1b1b1b;
  pointer-events: none;
}
.ops-head { margin-bottom: 24px; }

/* ---------- 1. Tipos: cuatro tarjetas ---------- */
.op-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
/* Tarjetas algo translúcidas (se intuye el fondo) sin perder legibilidad */
.op-type { display: flex; flex-direction: column; gap: 12px; background: rgba(28, 28, 28, 0.88); }
/* Icono de cada tipo (img/iconos_op/), con un brillo dorado tenue detrás */
.op-type-img {
  height: 140px;
  margin: -4px -4px 0;
  background: radial-gradient(ellipse at center, rgba(201, 162, 39, 0.12), transparent 65%);
}
.op-type-img img { display: block; width: 100%; height: 140px; object-fit: contain; }
.op-type-title { margin: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--gray-100); }
.op-type-text { margin: 0; color: var(--gray-300); font-size: 0.92rem; line-height: 1.5; }
.op-type-stats { display: flex; gap: 24px; margin: 0; padding-top: 12px; border-top: 1px solid var(--gray-800); }
.op-type-stats dt, .op-row-facts dt {
  color: var(--gray-500);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.op-type-stats dd { margin: 2px 0 0; color: var(--gray-100); font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
/* Mismo alto en las cuatro aunque el texto ocupe una o dos líneas */
.op-type-btn { margin-top: auto; min-height: 58px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 14px; font-size: 0.9rem; letter-spacing: 0.05em; }
.op-row-actions .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; background: none; }

/* ---------- 2 y 3. Listas de operaciones ---------- */
.ops-mine, .ops-friends { background: rgba(28, 28, 28, 0.9); margin-bottom: 20px; }
.ops-mine .card-title:focus { outline: none; }
.mine-tabs { margin-bottom: 10px; }
.tab-count { margin-left: 2px; }
.mine-help { margin: 0 0 16px; color: var(--gray-500); font-size: 0.88rem; min-height: 1.3em; }
.op-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.op-empty { grid-column: 1 / -1; padding: 8px 0; }
.op-row {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 16px 21px;
  border: 1px solid var(--gray-700);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}
.op-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.op-row-title { margin: 0; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--gray-100); }
.op-row-place { margin: 2px 0 0; color: var(--gray-500); font-size: 0.85rem; }
.op-row-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.op-row-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.op-row-facts dd { margin: 2px 0 0; color: var(--gray-100); font-size: 0.92rem; overflow-wrap: anywhere; }
.op-row-ships { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; }
.op-row-ships .ship-hex { --hex-w: 34px; }
.op-row-facts .op-clock { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.op-row-facts .op-owe { color: var(--gold-light); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.op-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: auto; }
.op-note { color: var(--gray-500); font-size: 0.82rem; }
.op-friend-note { margin: 0; color: var(--gray-300); font-style: italic; }
.friend-state { color: var(--gray-300); font-size: 0.88rem; }

/* Tripulación en fila */
.op-crew { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.op-crew-item { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; }
.op-crew-item .crew-initial { grid-row: span 2; width: 28px; height: 28px; font-size: 0.8rem; }
.op-crew-item.is-me { border-color: var(--gold); }
.op-crew-name { color: var(--gray-100); font-size: 0.85rem; line-height: 1.1; }
.op-crew-role { color: var(--gray-500); font-size: 0.72rem; line-height: 1.1; }

/* Reparto (pendientes de pagar) */
.op-pay-progress { margin: 0 0 -6px; color: var(--gray-300); font-size: 0.85rem; }
.op-pay { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.op-pay-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.op-pay-row .crew-initial { width: 30px; height: 30px; font-size: 0.85rem; }
.op-pay-name { color: var(--gray-100); }
.op-pay-amount { color: var(--gray-100); font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.op-pay-state { color: #5fd38a; font-size: 0.85rem; min-width: 150px; text-align: right; }

/* ---------- Ventana: nueva sesión ---------- */
.new-op-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 12px; }
/* Ubicación: atajos (habituales) y sistema · astro · zona */
.new-op-where { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.new-op-where legend { padding: 0; margin-bottom: 2px; }
.new-op-habs-row { display: flex; align-items: baseline; gap: 10px; }
.new-op-habs-row[hidden] { display: none; }
.new-op-habs-label { flex: none; color: var(--gray-500); font-size: 0.8rem; }
.new-op-habs { display: flex; flex-wrap: wrap; gap: 6px; }
.new-op-hab { padding: 4px 11px; border: 1px solid var(--gray-700); border-radius: 999px; background: none; color: var(--gray-300); font: inherit; font-size: 0.82rem; cursor: pointer; }
.new-op-hab:hover { border-color: var(--gold); color: var(--gold-light); }
.new-op-hab[aria-pressed="true"] { border-color: var(--gold); background: rgba(201, 162, 39, 0.14); color: var(--gold-light); }
.new-op-hab:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.new-op-where-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: 12px; }
.new-op-slots { max-width: 200px; }
.new-op-dialog .field input:disabled { opacity: 0.5; }
@media (max-width: 600px) {
  .new-op-where-row { grid-template-columns: 1fr 1fr; }
  .new-op-where-row .field:last-child { grid-column: 1 / -1; }
  .new-op-habs-row { flex-direction: column; gap: 6px; }
}
.new-op-dialog .field select, .new-op-dialog .field input { width: 100%; max-width: none; }
.new-op-friends { margin: 0; padding: 0; border: none; }
.new-op-friends legend { padding: 0; margin-bottom: 8px; }
.new-op-friend-list { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.new-op-dialog > form > .check { color: var(--gray-300); }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .op-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .op-types { grid-template-columns: 1fr; }
  .op-type-img { height: 110px; }
  .op-type-img img { height: 110px; }
  .op-list { grid-template-columns: 1fr; }
  .op-row-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op-row-head { flex-direction: column; }
  .op-row-tags { justify-content: flex-start; }
  .op-pay-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .op-pay-row > :last-child { grid-column: 2 / -1; justify-self: start; text-align: left; min-width: 0; }
  .mine-tabs button { flex: 1 1 auto; }
}

/* ---------- Próximas (programadas) ---------- */
.op-row--planned { border-color: rgba(96, 165, 250, 0.35); }
.op-row--planned .op-plan-left { color: #8cc0ff; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.op-rsvp { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.op-rsvp button:disabled { opacity: 0.45; cursor: not-allowed; }
.op-rsvp-note { flex: 1 1 220px; }
/* Crear: empezar ahora o programar */
.new-op-when { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.new-op-when-opts { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.new-op-plan[hidden], .new-op-plan-note[hidden] { display: none; }
.new-op-plan input { color-scheme: dark; }
/* «Crear otra igual»: de qué operación es la copia */
.new-op-copy { margin: -4px 0 4px; padding: 8px 12px; border-left: 3px solid var(--gold); background: rgba(201, 162, 39, 0.08); color: var(--gray-300); }

/* Cada operación lleva el color de su tipo a la izquierda (el mismo que en el panel) y su icono */
.op-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--t, var(--gray-700)); }
.op-row--planned::before { background: linear-gradient(var(--t), rgba(96, 165, 250, 0.7)); }
/* Programadas vencidas (más de 12 h después de la hora, sin empezar): apagadas, aparte */
.planned-over { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--gray-800); }
.planned-over-title { margin: 0 0 4px; color: var(--gray-300); font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase; }
.op-row--overdue { border-style: dashed; border-color: var(--gray-700); }
.op-row--overdue::before { opacity: 0.4; }
.op-row--overdue .op-row-head, .op-row--overdue .op-row-facts { opacity: 0.8; }
.op-plan-ago { color: #d9a25f; font-size: 0.85rem; }
.op-row-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.op-row-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--t, var(--gold)) 55%, transparent); background: color-mix(in srgb, var(--t, var(--gold)) 12%, transparent); }
.op-row-ico-img { width: 30px; height: 30px; object-fit: contain; }
.op-row-ico-img[hidden] { display: none; }
