/* ================================================
   AironPump — Plataforma · Design System "Dark + Gold Premium"
   Portado del sistema visual de OPD (portal.css).
   ================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,700;0,800;1,700&display=swap');

:root {
  --gold: #D4A843;
  --gold-light: #E8C96A;
  --gold-dark: #B8922E;
  --gold-glow: rgba(212,168,67,0.20);
  --dark-950: #0A0A0B;
  --dark-900: #111113;
  --dark-800: #1A1A1E;
  --dark-700: #232328;
  --dark-600: #2E2E35;
  --dark-500: #3A3A42;
  --text: #F5F5F5;
  --text-primary: #F5F5F5;
  --text-secondary: #B0B0B8;
  --text-dim: #78787F;
  --text-muted: #78787F;
  --green: #2ECC71;
  --red: #E74C3C;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --sidebar-w: 260px;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  /* compat con CSS antiguo */
  --surface: var(--dark-800);
  --surface-2: var(--dark-700);
  --danger: var(--red);
  --ok: var(--green);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body {
  font-family: var(--font-sans); color: var(--text-primary); line-height: 1.6;
  background: var(--dark-950); min-height: 100vh; overflow-x: hidden;
}
/* Fondo decorativo: rejilla + glows dorados (fijo, no interfiere) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(212,168,67,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,168,67,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}
body::after {
  content: ""; position: fixed; top: -200px; left: -120px; width: 600px; height: 600px;
  z-index: 0; pointer-events: none; border-radius: 50%; filter: blur(120px); opacity: 0.22;
  background: radial-gradient(circle, rgba(212,168,67,0.30), transparent 70%);
}
h1, h2, h3 { font-family: var(--font-serif); font-weight: 800; line-height: 1.2; }
a { color: var(--gold); text-decoration: none; }
input, button, textarea, select { font-family: inherit; }

/* ─── AUTH / páginas centradas (login, registro, invite, lead) ─── */
.centro { position: relative; z-index: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
  background: linear-gradient(135deg, rgba(26,26,30,0.95), rgba(17,17,19,0.98));
  border: 1px solid rgba(212,168,67,0.15); border-radius: 22px;
  padding: 36px 30px; box-shadow: 0 32px 80px rgba(0,0,0,0.55);
}
.card--ancha { max-width: 720px; }
.marca { text-align: center; font-family: var(--font-serif); font-size: 1.6rem; color: var(--gold); margin-bottom: 4px; }
.subtitulo { text-align: center; color: var(--text-secondary); margin: 0 0 22px; font-size: 0.9rem; }

label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin: 14px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="color"], select, textarea {
  width: 100%; padding: 12px 14px; background: var(--dark-800);
  border: 1px solid var(--dark-600); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.92rem; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 16px; margin-top: 16px; border: none;
  border-radius: var(--radius-sm); font-size: 0.92rem; font-weight: 700; cursor: pointer;
  transition: all var(--transition);
}
.btn--gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #1a1a1d; }
.btn--gold:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--gold-glow); }
.btn--ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--dark-500); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.sep { text-align: center; color: var(--text-muted); margin: 16px 0; font-size: 0.8rem; }
.pie { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); }
.pie a, a.portal-link { color: var(--gold); }
.msg { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; display: none; }
.msg--error { background: rgba(231,76,60,0.12); border: 1px solid rgba(231,76,60,0.3); color: #ff7b6e; display: block; }
.msg--ok { background: rgba(46,204,113,0.12); border: 1px solid rgba(46,204,113,0.3); color: #5eeba0; display: block; }

/* ─── SHELL: sidebar (PC) + topbar/drawer (móvil) ─── */
.app { position: relative; z-index: 1; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; z-index: 100;
  background: linear-gradient(180deg, rgba(17,17,19,0.98), rgba(10,10,11,0.99));
  border-right: 1px solid rgba(212,168,67,0.1);
  display: flex; flex-direction: column; overflow-y: auto; transition: transform var(--transition);
}
.sidebar__logo { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(212,168,67,0.08); }
.sidebar__logo-icon { font-size: 1.6rem; filter: drop-shadow(0 0 8px rgba(212,168,67,0.4)); display: flex; }
.sidebar__logo-icon img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; display: block; }
.sidebar__logo-name { font-family: var(--font-serif); font-size: 1rem; font-weight: 800; }
.sidebar__logo-sub { font-size: 0.7rem; color: var(--gold); }
.sidebar__nav { flex: 1; padding: 16px 12px; }
.sidebar__nav-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); padding: 0 8px; margin: 14px 0 8px; }
.sidebar__link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); transition: all var(--transition);
  margin-bottom: 2px; cursor: pointer; width: 100%; text-align: left; background: none; border: none;
}
.sidebar__link:hover { background: rgba(212,168,67,0.06); color: var(--text-primary); }
.sidebar__link--active { background: rgba(212,168,67,0.12); color: var(--gold); font-weight: 600; }
.sidebar__link-ico { font-size: 1rem; width: 1.2rem; text-align: center; }
/* Grupos plegables del menú */
.sidebar__grouphdr {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); transition: all var(--transition);
  margin-bottom: 2px; cursor: pointer; width: 100%; text-align: left; background: none; border: none; font-family: inherit;
}
.sidebar__grouphdr:hover { background: rgba(212,168,67,0.06); color: var(--text-primary); }
.sidebar__group.is-open > .sidebar__grouphdr { color: var(--text-primary); }
.sidebar__grouphdr-txt { flex: 1; }
.sidebar__chev { font-size: 0.7rem; color: var(--text-muted); transition: transform var(--transition); }
.sidebar__group.is-open .sidebar__chev { transform: rotate(90deg); }
.sidebar__groupitems { overflow: hidden; max-height: 0; transition: max-height var(--transition); }
.sidebar__group.is-open .sidebar__groupitems { max-height: 260px; }
.sidebar__groupitems .sidebar__link { padding-left: 32px; font-size: 0.85rem; }
.sidebar__footer { padding: 14px; border-top: 1px solid rgba(212,168,67,0.08); }
.sidebar__logout {
  width: 100%; padding: 9px; background: rgba(231,76,60,0.08); border: 1px solid rgba(231,76,60,0.2);
  border-radius: var(--radius-sm); color: #ff7b6e; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all var(--transition);
}
.sidebar__logout:hover { background: rgba(231,76,60,0.16); }

/* App bar móvil de la shell (sidebar) */
.appbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 200;
  background: rgba(17,17,19,0.95); backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(212,168,67,0.1); align-items: center; gap: 12px; padding: 0 16px;
}
.appbar__menu { background: none; border: none; color: var(--gold); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.appbar__title { flex: 1; font-family: var(--font-serif); font-size: 0.95rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.5); }

/* Cabecera simple (páginas aún no migradas a la shell con sidebar) */
.topbar {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 24px; background: rgba(17,17,19,0.92);
  border-bottom: 1px solid rgba(212,168,67,0.12); backdrop-filter: blur(12px);
}
.topbar .marca { margin: 0; font-size: 1.1rem; }
.contenido { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; padding: 28px 24px 60px; }
.scrim--show { display: block; }

/* Contenido anclado a la izquierda (tras el sidebar), ancho compacto y margen a la derecha (estilo OPD). */
.main { margin-left: var(--sidebar-w); min-height: 100vh; padding: 28px 56px 60px 36px; max-width: 1180px; }

/* ─── Dashboard ─── */
.dash-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-header__eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.dash-header__title { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.dash-header__sub { font-size: 0.9rem; color: var(--text-secondary); margin-top: 4px; }

.grid-info, .dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 0 0 28px; }
.metric, .dash-stat {
  background: linear-gradient(135deg, var(--dark-800), var(--dark-700));
  border: 1px solid rgba(212,168,67,0.1); border-radius: var(--radius); padding: 18px 20px;
  transition: border-color var(--transition);
}
.metric:hover, .dash-stat:hover { border-color: rgba(212,168,67,0.25); }
.metric .n { font-size: 1.5rem; font-weight: 800; color: var(--gold); line-height: 1.1; word-break: break-word; }
.metric .l { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

h2 { font-family: var(--font-serif); font-size: 1.2rem; margin: 26px 0 14px; }
h3 { font-size: 1rem; }

/* Cards de contenido (listas de clientes, rutinas, etc.) */
.contenido .card, .main .card {
  max-width: none; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--dark-800), var(--dark-700));
  border: 1px solid rgba(212,168,67,0.1); box-shadow: none;
}
.contenido .card:hover, .main .card:hover { border-color: rgba(212,168,67,0.22); }
.main { position: relative; z-index: 1; }

.chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  background: rgba(212,168,67,0.10); color: var(--gold); border: 1px solid rgba(212,168,67,0.22);
}

/* Botón de ayuda "?" con tooltip (hover en PC, tap/focus en móvil). Componente global. */
.help { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; border-radius:50%; border:1px solid rgba(212,168,67,.5); color:var(--gold); font-size:.62rem; font-weight:700; cursor:help; margin-left:5px; vertical-align:middle; position:relative; flex:0 0 auto; }
.help:hover, .help:focus { background:rgba(212,168,67,.16); outline:none; }
.help::after { content:attr(data-tip); position:absolute; top:150%; left:0; width:max-content; max-width:220px; background:#16161a; color:var(--text-secondary); border:1px solid rgba(255,255,255,.14); border-radius:8px; padding:8px 10px; font-size:.74rem; font-weight:500; line-height:1.45; text-transform:none; letter-spacing:normal; white-space:normal; text-align:left; opacity:0; pointer-events:none; transition:opacity .15s; z-index:60; box-shadow:0 10px 26px rgba(0,0,0,.45); }
.help:hover::after, .help:focus::after { opacity:1; }

.aviso-gate {
  position: relative; z-index: 1; background: linear-gradient(135deg, rgba(212,168,67,0.06), rgba(212,168,67,0.02));
  border: 1px solid rgba(212,168,67,0.25); border-radius: var(--radius);
  padding: 32px; text-align: center; max-width: 480px; margin: 60px auto;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); top: 0; height: 100vh; }
  .sidebar--open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.6); }
  .appbar { display: flex; }
  .main { margin-left: 0; padding: 72px 18px 48px; max-width: 100vw; }
}
@media (max-width: 480px) {
  .grid-info, .dash-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric, .dash-stat { padding: 14px; }
  .metric .n { font-size: 1.2rem; }
  .card { padding: 28px 20px; }
}
