/* SWTS Registro — dark HUD. Marca: #EA580C / #FDBA74 (no tocar). */
:root {
  --bg: #0c0d10;
  --surface: #14161b;
  --surface-2: #1a1d24;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(253, 186, 116, 0.28);
  --ink: #e9eaee;
  --ink-2: #a7abb6;
  --ink-3: #6c717e;
  --brand: #ea580c;
  --brand-soft: #fdba74;
  --serie-antes: #3b82f6;
  --serie-despues: #ea580c;
  --ok: #34d399;
  --radius: 10px;
  --font-display: "Fraunces", serif;
  --font-body: "Onest", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.55;
  min-height: 100vh;
}

/* ---------- atmósfera ---------- */
.bg-glow, .bg-grid { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg-glow {
  background:
    radial-gradient(900px 480px at 78% -10%, rgba(234, 88, 12, 0.13), transparent 60%),
    radial-gradient(700px 500px at -8% 108%, rgba(59, 130, 246, 0.05), transparent 60%);
}
.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 90%);
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(12, 13, 16, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--brand);
  position: relative;
  box-shadow: 0 0 18px rgba(234, 88, 12, 0.45);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px;
  border-radius: 50%; background: var(--brand-soft);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.06em;
}
.brand-text em {
  font-style: normal; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.22em; color: var(--ink-3);
}
.hud-chip {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px;
}

/* ---------- layout ---------- */
main { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; padding: 34px 28px 60px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }
h1 { font-size: 34px; letter-spacing: 0.01em; }
h2 { font-size: 20px; }
.kicker {
  font-family: var(--font-body); font-weight: 500; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.26em; color: var(--brand-soft);
  display: block; margin-bottom: 8px;
}
.sub { color: var(--ink-2); font-size: 14px; margin-top: 6px; }

/* ---------- tarjetas HUD ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card.hud::before, .card.hud::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
}
.card.hud::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong);
  border-top-left-radius: var(--radius);
}
.card.hud::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong);
  border-bottom-right-radius: var(--radius);
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { padding: 18px 20px; }
.stat .label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--ink-3); font-weight: 500;
}
.stat .value {
  font-family: var(--font-mono); font-size: 30px; font-weight: 600; margin-top: 6px;
  color: var(--ink);
}
.stat .value .unit { font-size: 13px; color: var(--ink-3); margin-left: 4px; }
.stat .value.accent { color: var(--brand-soft); }

/* ---------- lista consultantes ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1; min-width: 220px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.person {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px; cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
.person:hover { border-color: var(--line-strong); background: var(--surface-2); transform: translateX(3px); }
.person .who { display: flex; flex-direction: column; gap: 2px; }
.person .who strong { font-weight: 500; font-size: 15.5px; }
.person .who span { font-size: 12.5px; color: var(--ink-3); }
.person .meta { display: flex; align-items: center; gap: 18px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.person .meta b { color: var(--brand-soft); font-weight: 600; }
.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: 14px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------- formularios ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-2); }
label.field span {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 10px; font-weight: 500; color: var(--ink-3);
}
input, textarea, select {
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.18);
}
textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }

/* botones */
.btn {
  font-family: var(--font-body); font-weight: 500; font-size: 13px;
  letter-spacing: 0.04em; cursor: pointer; border-radius: 8px;
  padding: 10px 18px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink);
  transition: all 0.16s; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 22px rgba(234, 88, 12, 0.35);
}
.btn.primary:hover { background: #f97316; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- wizard ---------- */
.steps { display: flex; gap: 8px; margin: 20px 0 26px; }
.step-dot {
  flex: 1; height: 3px; border-radius: 2px; background: var(--line);
  position: relative; transition: background 0.3s;
}
.step-dot.done { background: var(--brand); box-shadow: 0 0 12px rgba(234, 88, 12, 0.5); }
.step-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--ink-3); margin-top: 8px; display: block;
}
.step-dot.done .step-label { color: var(--brand-soft); }

.scale-block { display: flex; flex-direction: column; gap: 18px; margin: 18px 0; }
.scale {
  display: grid; grid-template-columns: 170px 1fr 52px; gap: 16px; align-items: center;
}
.scale .name { font-size: 13.5px; color: var(--ink-2); }
.scale .name small { display: block; font-size: 10.5px; color: var(--ink-3); }
.scale output {
  font-family: var(--font-mono); font-size: 20px; font-weight: 600; text-align: right;
  color: var(--brand-soft);
}
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; padding: 0;
  background: linear-gradient(90deg, var(--brand) var(--fill, 50%), var(--surface-2) var(--fill, 50%));
  border: none; border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-soft); border: 3px solid var(--bg);
  box-shadow: 0 0 0 1.5px var(--brand), 0 0 14px rgba(234, 88, 12, 0.55);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--brand-soft); border: 3px solid var(--bg);
  box-shadow: 0 0 0 1.5px var(--brand); cursor: grab;
}

/* HRV panel */
.hrv-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 20px; background: var(--surface-2); }
.hrv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hrv-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--ink-3); font-weight: 500; }
.hrv-live {
  display: flex; align-items: baseline; gap: 20px; margin: 14px 0;
  font-family: var(--font-mono);
}
.hrv-live .bpm { font-size: 42px; font-weight: 600; color: var(--brand-soft); }
.hrv-live .bpm.pulsing { animation: pulse 1s infinite; }
.hrv-live small { color: var(--ink-3); font-size: 11px; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.hrv-bar { height: 4px; background: var(--surface); border-radius: 2px; overflow: hidden; margin: 10px 0 14px; }
.hrv-bar i { display: block; height: 100%; width: 0%; background: var(--brand); transition: width 0.9s linear; }
.hrv-manual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.hrv-note { font-size: 11.5px; color: var(--ink-3); margin: 8px 0 0; }

/* ---------- gráfica ---------- */
.chart-card { margin-bottom: 22px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-tip {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity 0.12s;
  background: #1e2129; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; transform: translate(-50%, -110%);
  white-space: nowrap; z-index: 5;
}
.chart-tip b { font-family: var(--font-mono); }
.axis-text { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
.grid-line { stroke: rgba(255,255,255,0.05); }

/* ---------- tabla sesiones ---------- */
table.sessions { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sessions th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--ink-3); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
table.sessions td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
table.sessions td.num { font-family: var(--font-mono); }
.delta-up { color: var(--ok); font-weight: 600; }
.delta-flat { color: var(--ink-3); }

/* ---------- login & equipo ---------- */
.topbar-right { display: flex; align-items: center; gap: 10px; }
#userbox { display: flex; align-items: center; gap: 8px; }
.login-wrap { display: flex; justify-content: center; padding-top: 7vh; }
.login-card { width: 100%; max-width: 420px; padding: 34px; }
.owner-badge {
  font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--brand-soft); border: 1px solid var(--line-strong); border-radius: 5px;
  padding: 2px 7px; margin-left: 8px; vertical-align: 2px;
}

/* ---------- reporte ---------- */
.report-brand { display: none; }

/* ---------- footer ---------- */
.disclaimer {
  position: relative; z-index: 1;
  max-width: 1060px; margin: 0 auto; padding: 22px 28px 40px;
  color: var(--ink-3); font-size: 11.5px; border-top: 1px solid var(--line);
}
.disclaimer p { max-width: 72ch; margin: 0; }

/* aparición */
.view { animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  main { padding: 22px 16px 50px; }
  .scale { grid-template-columns: 1fr 60px; }
  .scale .name { grid-column: 1 / -1; }
  h1 { font-size: 26px; }
}

/* ---------- impresión (reporte en claro) ---------- */
@media print {
  :root { --ink: #16181d; --ink-2: #3d4250; --ink-3: #6c717e; }
  body { background: #fff; color: #16181d; font-weight: 400; }
  .bg-glow, .bg-grid, .topbar, .no-print, .btn { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { background: #fff; border-color: #ddd; break-inside: avoid; }
  .card.hud::before, .card.hud::after { display: none; }
  .stat .value, .scale output { color: #ea580c; }
  .kicker { color: #ea580c; }
  table.sessions td, table.sessions th { border-color: #ddd; color: #3d4250; }
  .chart-tip { display: none; }
  .axis-text { fill: #888; }
  .grid-line { stroke: #eee; }
  .report-brand {
    display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
    border-bottom: 2px solid #ea580c; padding-bottom: 14px;
  }
  .disclaimer { color: #6c717e; border-color: #ddd; }
  .person, .toolbar { display: none; }
}
