/* ═══════════════════════════════════════════════════════════════
   Portal HSE IntegraPro — main.css v1.0
   Dark theme corporativo · Mobile-first · WCAG AA
═══════════════════════════════════════════════════════════════ */

:root {
  /* Surface */
  --bg:        #0a0e1a;
  --bg-2:      #111827;
  --bg-3:      #1a2336;
  --bg-4:      #1f2d42;

  /* Lines */
  --line:      rgba(255,255,255,0.06);
  --line-2:    rgba(255,255,255,0.12);

  /* Text */
  --text:      #e2e8f4;
  --text-2:    #9aa8c0;
  --text-3:    #5d6d85;

  /* Brand */
  --brand:     #00d4b8;
  --brand-2:   #00b89c;
  --brand-d:   rgba(0,212,184,0.10);
  --brand-b:   rgba(0,212,184,0.30);

  /* Product colors */
  --c-safeguard:    #22c55e;
  --c-ms-inspector: #00d4b8;
  --c-ms-inventary: #f59e0b;
  --c-nexus:        #4f9cf9;

  /* States */
  --ok:        #22c55e;
  --warn:      #f59e0b;
  --err:       #ef4444;

  /* Radius */
  --r-sm:      6px;
  --r:         10px;
  --r-md:      14px;
  --r-lg:      20px;

  /* Shadows */
  --sh:        0 4px 16px rgba(0,0,0,0.40);
  --sh-lg:     0 12px 40px rgba(0,0,0,0.55);

  /* Layout */
  --container: 1180px;
  --header-h:  64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Skip link para A11y */
.skip-link {
  position: absolute; top: -40px; left: 8px;
  background: var(--brand); color: var(--bg);
  padding: 8px 12px; border-radius: var(--r-sm);
  z-index: 200; font-weight: 600;
}
.skip-link:focus { top: 8px; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }

/* ─── Header ─────────────────────────────────────────────── */
.hdr {
  height: var(--header-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.hdr-inner {
  max-width: var(--container);
  margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
}
.brand-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 16px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand-logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark::before {
  content: 'IP'; font-size: 11px; color: var(--bg);
  font-weight: 800; letter-spacing: -0.5px;
}
.brand-sub {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400; font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.hdr-nav { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); border-color: var(--text-3); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: var(--bg);
  border-color: var(--brand);
  font-weight: 600;
}
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: var(--bg); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }

.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ─── Container ──────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  padding: 80px 20px 60px;
  text-align: center;
  background: radial-gradient(ellipse at top, rgba(0,212,184,0.08), transparent 60%);
}
.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 18px;
}
.hero h1 .accent { color: var(--brand); }
.hero p {
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--text-2);
  max-width: 640px;
  margin: 0 auto 28px;
  line-height: 1.6;
}
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ─── Section ────────────────────────────────────────────── */
.section { padding: 60px 0; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.section-head p {
  color: var(--text-2);
  max-width: 580px;
  margin: 0 auto;
}

/* ─── Cards Grid ─────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}
.product-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 24px;
  display: flex; flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.product-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--brand));
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-color, var(--brand));
  box-shadow: var(--sh);
}
.product-icon {
  width: 44px; height: 44px;
  background: var(--card-color-bg, var(--brand-d));
  border: 1px solid var(--card-color, var(--brand));
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.product-name {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.product-desc {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 18px;
  flex-grow: 1;
  line-height: 1.5;
}
.product-price {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 4px;
}
.product-price-amount {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--card-color, var(--brand));
  letter-spacing: -0.02em;
}
.product-price-period {
  font-size: 13px;
  color: var(--text-3);
}
.product-trial {
  font-size: 12px;
  color: var(--ok);
  margin-bottom: 14px;
}

/* ─── Bundles ────────────────────────────────────────────── */
.bundles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.bundle-card {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 24px;
  position: relative;
  display: flex; flex-direction: column;
}
.bundle-badge {
  position: absolute; top: 16px; right: 16px;
  background: var(--brand);
  color: var(--bg);
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.bundle-name {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 700;
  margin-bottom: 8px;
}
.bundle-desc {
  font-size: 13px; color: var(--text-2);
  margin-bottom: 14px;
}
.bundle-products {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.bundle-pill {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--pill-color, var(--brand));
  border-radius: var(--r-sm);
  color: var(--text-2);
}

/* ─── Auth pages (login, registro) ───────────────────────── */
.auth-wrap {
  min-height: calc(100vh - var(--header-h));
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 36px 28px;
  box-shadow: var(--sh-lg);
}
.auth-title {
  font-family: 'Syne', sans-serif;
  font-size: 24px; font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.auth-sub {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 24px;
}
.auth-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-2);
}

/* ─── Forms ──────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-d);
}
.field input[aria-invalid="true"] {
  border-color: var(--err);
}
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--err); margin-top: 4px; display: none; }
.field-error.visible { display: block; }

/* Honeypot anti-bot */
.hp { position: absolute; left: -10000px; top: -10000px; opacity: 0; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
  display: none;
}
.alert.visible { display: block; }
.alert-error { background: rgba(239,68,68,0.10); border: 1px solid var(--err); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.10); border: 1px solid var(--ok); color: #86efac; }
.alert-info { background: rgba(0,212,184,0.10); border: 1px solid var(--brand); color: #7dd3c0; }

/* ─── Panel (Mi cuenta) ──────────────────────────────────── */
.panel-wrap { padding: 32px 0 60px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.panel-head h1 {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 768px) {
  .panel-grid { grid-template-columns: 320px 1fr; }
}
.panel-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px;
}
.panel-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv-k { color: var(--text-3); font-size: 13px; }
.kv-v { color: var(--text); font-size: 13px; font-weight: 500; }

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-2);
}
.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state p { font-size: 13px; margin-bottom: 18px; }

.sub-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--card-color, var(--brand));
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.sub-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.sub-card-name {
  font-weight: 600;
  font-size: 14px;
}
.sub-card-status {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-d); color: var(--brand);
  border: 1px solid var(--brand-b);
}
.sub-card-meta {
  font-size: 12px;
  color: var(--text-3);
}

/* ─── Footer ─────────────────────────────────────────────── */
.ftr {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  padding: 28px 0;
  margin-top: 60px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}
.ftr a { color: var(--text-2); }

/* ─── Loading state ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r);
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ─── Mobile tweaks ──────────────────────────────────────── */
@media (max-width: 640px) {
  .hdr-inner { padding: 0 14px; gap: 8px; }
  .brand-sub { display: none; }
  .container { padding: 0 14px; }
  .hero { padding: 50px 14px 40px; }
  .auth-card { padding: 28px 20px; }
  .btn { padding: 9px 14px; font-size: 13px; }
}

/* ─── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
