/* ════════════════════════════════════════════════════════════
   PETRO RADAR // PERÚ
   Paleta: noche-petróleo #0A1118 · panel #101B24 · línea #1E2E3A
   ámbar crudo #F2A33C · verde #3DDC97 · rojo #FF5C5C
   Tipos: Fraunces (display) · JetBrains Mono (datos)
   ════════════════════════════════════════════════════════════ */
:root {
  --bg: #0A1118;
  --panel: #101B24;
  --panel-2: #0D161E;
  --line: #1E2E3A;
  --text: #E8EEF2;
  --muted: #7A8FA0;
  --amber: #F2A33C;
  --green: #3DDC97;
  --red: #FF5C5C;
  --cyan: #55C6E8;
  --mono: 'JetBrains Mono', monospace;
  --display: 'Fraunces', serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-color: var(--line) var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  min-height: 100vh;
}
em { font-style: italic; }

/* ── Gate ── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(242,163,60,.08), transparent 60%),
    var(--bg); }
.gate-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 32px; text-align: center; }
.gate-mark { color: var(--amber); font-size: 22px; animation: pulse 2.4s infinite; }
.gate-title { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 10px 0 4px; }
.gate-title em { color: var(--amber); }
.gate-sub { color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.gate-card input { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 16px; padding: 12px 14px; border-radius: 8px; text-align: center;
  letter-spacing: .3em; outline: none; }
.gate-card input:focus { border-color: var(--amber); }
.gate-err { color: var(--red); font-size: 12px; margin-top: 10px; }
.gate-card button { width: 100%; margin-top: 14px; background: var(--amber); color: #1A1206; border: 0;
  font-family: var(--mono); font-weight: 700; font-size: 14px; padding: 12px; border-radius: 8px; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease; }
.gate-card button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(242,163,60,.25); }

/* ── Topbar ── */
.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(10,17,24,.92); backdrop-filter: blur(8px); z-index: 1000; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-family: var(--display); font-weight: 400; font-size: 22px; }
.brand h1 em { color: var(--amber); }
.brand-tag { color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .15em; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); transition: background .3s; }
.brand-dot.on { background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.clock { color: var(--muted); font-size: 12px; }
.logout { color: var(--muted); text-decoration: none; font-size: 12px; border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 6px; }
.logout:hover { color: var(--text); border-color: var(--muted); }

/* ── Layout ── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 22px; display: grid; gap: 22px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--display); font-weight: 400; font-size: 18px; }
.fine { color: var(--muted); font-size: 11px; line-height: 1.6; padding: 12px 18px 16px; }
.fine strong { color: var(--text); font-weight: 500; }

/* ── Cotizaciones ── */
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.q-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  display: grid; gap: 6px; position: relative; overflow: hidden; }
.q-card header { display: flex; justify-content: space-between; align-items: baseline; }
.q-eyebrow { color: var(--amber); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.q-sym { color: var(--muted); font-size: 10px; }
.q-price { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-chg { font-size: 12px; }
.q-chg.up { color: var(--green); } .q-chg.down { color: var(--red); }
.q-spark { width: 100%; height: 34px; }
.q-spark polyline { fill: none; stroke: var(--cyan); stroke-width: 1.4; opacity: .9; }
.q-spark.up polyline { stroke: var(--green); }
.q-spark.down polyline { stroke: var(--red); }
.q-derived .q-price { color: var(--amber); }
.q-note { color: var(--muted); font-size: 10px; line-height: 1.5; }

/* ── Radar ── */
.radar { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: stretch; }
.map-legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 18px; color: var(--muted); font-size: 11px;
  border-top: 1px solid var(--line); }
.map-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lg-inbound { background: var(--amber); }
.lg-tanker { background: var(--cyan); }
.lg-port { background: transparent; border: 2px solid var(--green); border-radius: 2px !important; }
.ws-status { font-size: 11px; color: var(--muted); }
.ws-status.ok { color: var(--green); }
.ws-status.err { color: var(--red); }

#vfWrap { height: 560px; background: var(--panel-2); }
#vfWrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.vf-link { color: var(--cyan); text-decoration: none; }
.vf-link:hover { text-decoration: underline; }

.list-panel { display: flex; flex-direction: column; }
.vessel-list { flex: 1; overflow-y: auto; max-height: 470px; padding: 10px 12px; display: grid; gap: 10px; align-content: start; }
.vessel-list .empty { color: var(--muted); font-size: 12px; line-height: 1.7; padding: 12px 8px; }
.count { color: var(--muted); font-size: 11px; }

.v-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: grid; gap: 7px; cursor: pointer; transition: border-color .15s; }
.v-card:hover { border-color: var(--muted); }
.v-card.inbound { border-left: 3px solid var(--amber); }
.v-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.v-name { font-weight: 700; font-size: 13px; }
.v-mmsi { color: var(--muted); font-size: 10px; }
.v-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 11px; }
.v-meta b { color: var(--text); font-weight: 500; }
.v-eta { display: flex; justify-content: space-between; align-items: baseline; }
.v-eta-main { color: var(--amber); font-size: 13px; font-weight: 700; }
.v-eta-sub { color: var(--muted); font-size: 10px; }
.v-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.v-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--amber)); }

/* ── Calculadora ── */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.calc-inputs { padding: 18px; display: grid; gap: 12px; border-right: 1px solid var(--line); }
.calc-inputs label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.calc-inputs input { background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 14px; padding: 9px 12px; border-radius: 7px; outline: none; }
.calc-inputs input:focus { border-color: var(--amber); }
.calc-result { padding: 18px; display: grid; gap: 10px; align-content: start; }
.cr-verdict { font-family: var(--display); font-size: 24px; font-weight: 600; }
.cr-verdict.ok { color: var(--green); }
.cr-verdict.no { color: var(--red); }
.cr-verdict.neutral { color: var(--amber); }
.cr-line { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted);
  border-bottom: 1px dashed var(--line); padding-bottom: 7px; }
.cr-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.cr-note { color: var(--muted); font-size: 11px; line-height: 1.6; }

/* ── Footer ── */
.foot { display: grid; gap: 4px; padding: 18px 22px 30px; color: var(--muted); font-size: 10px;
  border-top: 1px solid var(--line); text-align: center; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .wrap { padding: 12px 10px; gap: 16px; }
  .radar { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .calc-inputs { border-right: 0; border-bottom: 1px solid var(--line); }

  /* El mapa manda en móvil: ocupa casi toda la pantalla,
     de borde a borde, sin marcos que le roben espacio. */
  #vfWrap { height: 78vh; min-height: 480px; }
  .map-panel { margin: 0 -10px; border-radius: 0; border-left: 0; border-right: 0; }
  .map-panel .panel-head { padding: 12px 14px; }
  .map-legend { gap: 10px; padding: 8px 14px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
