/* ============================================================================
   CoachPro — diseño claro y minimalista
   Fondo gris muy claro, tarjetas blancas, un solo acento (índigo), tipografía
   Inter. Todo en variables para que cada entrenador pueda cambiar el acento.
   ========================================================================== */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e7e9ee;
  --line-2: #f0f1f4;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #9aa1ad;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --verde: #047857;  --verde-soft: #ecfdf5;
  --ambar: #b45309;  --ambar-soft: #fffbeb;
  --rojo: #dc2626;   --rojo-soft: #fef2f2;
  --gris-soft: #f3f4f6;
  --r: 12px;
  --r-lg: 16px;
  --r-btn: 10px;
  --r-in: 10px;
  --r-sm: 9px;
  --r-modal: 18px;
  --font-texto: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-titulo: var(--font-texto);
  --sombra: 0 1px 2px rgba(16, 24, 40, .05);
  --sombra-2: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --side: 236px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-texto);
  background: var(--bg); color: var(--ink); line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; font-family: var(--font-titulo); }
.oculto { display: none !important; }
/* iconos: heredan el color del texto salvo que se les dé uno */
svg[viewBox="0 0 24 24"]:not([stroke]) { stroke: currentColor; }
.muted { color: var(--ink-2); }
.tenue { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.sep { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }

/* ---------------- estructura ---------------- */
.layout { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--card);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; z-index: 20;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.marca-logo {
  width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.marca b { font-size: 15.5px; display: block; font-family: var(--font-titulo); }
.marca span { font-size: 12px; color: var(--ink-3); display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; font-size: 14.5px;
}
.nav a svg { width: 19px; height: 19px; flex: 0 0 auto; stroke: currentColor; }
.nav a:hover { background: var(--gris-soft); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .grupo { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 14px 10px 6px; }
.side-pie { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.side-pie .demo { display: inline-block; margin-top: 6px; font-size: 11.5px; color: var(--ambar); background: var(--ambar-soft); padding: 2px 8px; border-radius: 99px; }

.main { margin-left: var(--side); flex: 1; min-width: 0; padding: 26px 32px 60px; max-width: 1200px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 23px; font-weight: 700; }
.top .sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.top .acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; margin-bottom: 10px; cursor: pointer; background: none; border: 0; padding: 0; }
.volver:hover { color: var(--ink); }

/* barra inferior (móvil) */
.tabbar { display: none; }

/* ---------------- tarjetas y rejillas ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sombra); }
.card + .card { margin-top: 14px; }
.card-t { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-t h3 { font-size: 15.5px; font-weight: 650; }
.card-t .acc { margin-left: auto; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card + .card { margin-top: 0; }

.kpi { padding: 16px 18px; }
.kpi .k-l { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-v { font-family: var(--font-titulo); font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .k-s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------------- botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--r-btn);
  padding: 9px 15px; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap;
}
.btn:hover { background: var(--gris-soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 17px; height: 17px; stroke: currentColor; }
.btn-pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-pri:hover { background: var(--accent); filter: brightness(1.07); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--gris-soft); color: var(--ink); }
.btn-danger { color: var(--rojo); }
.btn-danger:hover { background: var(--rojo-soft); border-color: #fecaca; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: var(--r-btn); }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; }

/* ---------------- formularios ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .ayuda { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-in);
  padding: 10px 12px; font-size: 14.5px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 84px; resize: vertical; }
.form { display: grid; gap: 14px; }
.form.g2 { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.buscar { position: relative; }
.buscar svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; stroke: var(--ink-3); }
.buscar .input { padding-left: 36px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.seg { display: inline-flex; background: var(--gris-soft); border-radius: var(--r-btn); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: var(--r-btn); font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--sombra); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs { scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------- etiquetas ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-verde { color: var(--verde); background: var(--verde-soft); }
.b-ambar { color: var(--ambar); background: var(--ambar-soft); }
.b-rojo { color: var(--rojo); background: var(--rojo-soft); }
.b-gris { color: var(--ink-2); background: var(--gris-soft); }
.b-acc { color: var(--accent); background: var(--accent-soft); }
.b-plano::before { display: none; }

/* ---------------- listas ---------------- */
.lista { display: flex; flex-direction: column; }
.fila {
  display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line-2);
}
.fila:last-child { border-bottom: 0; }
.fila.click { cursor: pointer; border-radius: var(--r); padding-left: 8px; padding-right: 8px; }
.fila.click:hover { background: var(--gris-soft); }
.fila .t { font-weight: 600; font-size: 14.5px; }
.fila .s { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  font-weight: 700; font-size: 13.5px; color: #fff;
}
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.hora { font-weight: 700; font-size: 14px; min-width: 64px; }

.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
.tabla td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.click { cursor: pointer; }
.tabla tr.click:hover td { background: var(--gris-soft); }
.tabla-wrap { overflow-x: auto; }

.vacio { text-align: center; padding: 34px 16px; color: var(--ink-2); }
.vacio .v-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 12px; }
.vacio .v-ico svg { width: 22px; height: 22px; stroke: currentColor; }
.vacio b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.vacio p { margin: 0 auto 14px; max-width: 360px; font-size: 14px; }

.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: 14px; }
.aviso.ambar { background: var(--ambar-soft); color: #78350f; }
.aviso.acc { background: var(--accent-soft); color: #312e81; }
.aviso.rojo { background: var(--rojo-soft); color: #7f1d1d; }

/* ---------------- modal / hoja ---------------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(17, 24, 39, .42); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--card); border-radius: var(--r-modal); width: 100%; max-width: 560px; box-shadow: var(--sombra-2); animation: sube .18s ease; }
.modal.ancho { max-width: 820px; }
.modal-cab { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal-cab h2 { font-size: 18px; font-weight: 700; }
.modal-cab .x { margin-left: auto; }
.modal-cuerpo { padding: 12px 20px 18px; }
.modal-pie { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-pie .izq { margin-right: auto; }
@keyframes fade { from { opacity: 0 } }
@keyframes sube { from { transform: translateY(12px); opacity: 0 } }

.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #111827; color: #fff; border: 1px solid rgba(255, 255, 255, .12); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--sombra-2); animation: sube .2s; }
.toast.err { background: var(--rojo); }

/* ---------------- agenda ---------------- */
.semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.dia-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); min-height: 180px; display: flex; flex-direction: column; }
.dia-col.hoy { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dia-cab { padding: 10px 10px 8px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.dia-cab b { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.dia-cab span { font-size: 20px; font-weight: 700; }
.dia-col.hoy .dia-cab span { color: var(--accent); }
.dia-citas { padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.cita {
  border-radius: var(--r-sm); padding: 6px 8px; font-size: 12.5px; cursor: pointer; border-left: 3px solid var(--accent);
  background: var(--accent-soft); line-height: 1.3;
}
.cita b { display: block; font-size: 12px; }
.cita.ok { border-left-color: var(--verde); background: var(--verde-soft); }
.cita.falta { border-left-color: var(--rojo); background: var(--rojo-soft); }
.cita.cancel { border-left-color: var(--ink-3); background: var(--gris-soft); text-decoration: line-through; color: var(--ink-3); }
.cita .conf { color: var(--verde); font-weight: 700; }

.estado-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.estado-btns button { border: 1px solid var(--line); background: var(--card); border-radius: var(--r-btn); padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.estado-btns button.on.asistio { background: var(--verde-soft); border-color: #a7f3d0; color: var(--verde); }
.estado-btns button.on.falto { background: var(--rojo-soft); border-color: #fecaca; color: var(--rojo); }
.estado-btns button.on.cancelo { background: var(--gris-soft); color: var(--ink); }

/* ---------------- rutinas ---------------- */
.rut-dia { border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 12px; background: var(--card); }
.rut-dia-cab { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.rut-dia-cab .input { max-width: 260px; font-weight: 600; }
.rut-ej { display: grid; grid-template-columns: minmax(0, 1fr) 64px 76px 76px 70px auto; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line-2); }
.rut-ej:last-child { border-bottom: 0; }
.rut-ej .input { padding: 7px 9px; font-size: 13.5px; }
.rut-ej-cab { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ej-card { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; background: var(--card); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.ej-card:hover { border-color: var(--accent); }
.ej-ico { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }

/* gráfico */
.graf { width: 100%; height: 160px; }
.barra-prog { height: 8px; border-radius: 99px; background: var(--gris-soft); overflow: hidden; }
.barra-prog i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------------- acceso ---------------- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.acceso-izq { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 88px); background: var(--card); }
.acceso-der { background: var(--accent); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.acceso-der h2 { font-size: 34px; line-height: 1.15; font-weight: 750; max-width: 440px; }
.acceso-der ul { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 12px; font-size: 15.5px; opacity: .95; }
.acceso-der li { display: flex; gap: 10px; align-items: center; }
.acceso-der li i { width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-style: normal; font-size: 12px; }
.acceso-der::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .06); right: -140px; bottom: -160px; }
.acceso-caja { width: 100%; max-width: 380px; }
.acceso-caja h1 { font-size: 26px; font-weight: 750; margin: 26px 0 6px; }
.acceso-caja .form { margin-top: 22px; }
.acceso-alt { margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.acceso-alt a { font-weight: 600; cursor: pointer; }
.error { color: var(--rojo); font-size: 13.5px; }

/* ---------------- factura (impresión) ---------------- */
.factura { background: #fff; color: #111; padding: 32px; max-width: 720px; margin: 0 auto; font-size: 14px; }
.factura h1 { font-size: 22px; }
.factura table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.factura th, .factura td { padding: 10px 8px; border-bottom: 1px solid #e5e7eb; text-align: left; }
.factura .total { font-size: 18px; font-weight: 700; text-align: right; margin-top: 16px; }
@media print {
  body.imprimiendo > *:not(#impresion) { display: none !important; }
  body.imprimiendo #impresion { display: block !important; }
  body.imprimiendo { background: #fff; }
}
#impresion { display: none; }

/* ---------------- móvil ---------------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .semana { grid-template-columns: repeat(7, minmax(120px, 1fr)); overflow-x: auto; }
}
@media (max-width: 860px) {
  .side { display: none; }
  .main { margin-left: 0; padding: 18px 16px 96px; }
  .top h1 { font-size: 21px; }
  .g2, .g3, .g-2-1, .form.g2 { grid-template-columns: 1fr; }
  .acceso { grid-template-columns: 1fr; }
  .acceso-der { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--barra, rgba(255, 255, 255, .96));
    backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 4px 0; }
  .tabbar a svg { width: 22px; height: 22px; stroke: currentColor; }
  .tabbar a.on { color: var(--accent); }
  .modal-fondo { align-items: flex-end; padding: 0; }
  .modal { border-radius: var(--r-modal) var(--r-modal) 0 0; max-height: 92vh; overflow-y: auto; }
  .semana { display: flex; flex-direction: column; }
  .dia-col { min-height: 0; }
  .dia-cab { display: flex; align-items: baseline; gap: 8px; }
  .dia-cab span { font-size: 17px; }
  .cita { display: flex; gap: 10px; align-items: baseline; font-size: 14px; padding: 9px 10px; }
  .cita b { display: inline; min-width: 62px; font-size: 13.5px; }
  .rut-ej { grid-template-columns: 1fr 1fr 1fr; }
  .rut-ej > :first-child { grid-column: 1 / -1; }
  .rut-ej-cab { display: none; }
  .rut-dia-cab .input { max-width: none; flex: 1; }
  .rut-dia-cab .tenue { display: none; }
  .ocultar-m { display: none !important; }
  .grid.fijo3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.fijo2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* filas con botones de pasar lista: los botones bajan a su propia línea */
  .fila:has(.estado-btns) { flex-wrap: wrap; }
  .fila .estado-btns { width: 100%; padding-left: 0; }
  .fila .estado-btns button { flex: 1; padding: 8px 6px; }
  .top .acciones { margin-left: 0; width: 100%; }
  .top .acciones .btn { flex: 1; }
}

/* ============================================================================
   MARCA: logo con iniciales y teléfono de muestra
   ========================================================================== */
.logo-mono {
  display: grid; place-items: center; flex: 0 0 auto; font-weight: 800; letter-spacing: -.02em;
  background: var(--accent); color: var(--accent-ink); font-family: var(--font-titulo);
}
.marca .logo-img, .marca .logo-mono { width: 34px !important; height: 34px !important; }

.tel {
  width: 280px; flex: 0 0 auto; border-radius: 42px; padding: 10px; background: #0b0d12;
  box-shadow: 0 30px 60px -20px rgba(17, 24, 39, .45), inset 0 0 0 2px #2a2d36; font-family: var(--font-texto);
}
.tel-pantalla { border-radius: 33px; overflow: hidden; background: var(--bg); height: 560px; display: flex; flex-direction: column; position: relative; }
.tel-portada { padding: 14px 18px 22px; position: relative; transition: background .4s; }
.tel-portada.vivo { animation: fluir 9s ease-in-out infinite; }
.tel-hora { font-size: 12px; font-weight: 700; opacity: .9; margin-bottom: 16px; }
.tel-marca { display: flex; align-items: center; gap: 10px; }
.tel-marca b { display: block; font-family: var(--font-titulo); font-size: 15px; line-height: 1.15; }
.tel-marca span { display: block; font-size: 11.5px; opacity: .85; }
.tel-hola { font-family: var(--font-titulo); font-weight: 750; font-size: 21px; margin-top: 18px; }
.tel-bien { font-size: 12.5px; opacity: .9; margin-top: 4px; line-height: 1.4; }
.tel-cuerpo { padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-top: -10px; position: relative; flex: 1; }
.tel-prox { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .25); }
.tel-prox small, .tel-kpis small, .tel-rut small { display: block; font-size: 10.5px; color: var(--ink-3); }
.tel-prox b { display: block; font-family: var(--font-titulo); font-size: 16px; margin: 2px 0 8px; }
.tel-prox div { display: flex; gap: 6px; }
.tel-prox span { font-size: 11.5px; font-weight: 700; padding: 6px 12px; border-radius: var(--r-btn); border: 1px solid var(--line); color: var(--ink-2); }
.tel-prox span:first-child { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tel-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tel-kpis div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.tel-kpis b { font-family: var(--font-titulo); font-size: 18px; }
.tel-rut { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.tel-rut i { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--accent-soft); }
.tel-rut b { font-size: 13px; display: block; }
.tel-tabs { display: flex; justify-content: space-around; padding: 10px 0 14px; background: var(--card); border-top: 1px solid var(--line); font-size: 9px; color: var(--ink-3); }
.tel-tabs .on { color: var(--accent); }

/* ============================================================================
   ESTUDIO "Crea tu app"
   ========================================================================== */
.estudio { position: fixed; inset: 0; z-index: 150; background: var(--bg); display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 46%); animation: fade .3s; }
.estudio-izq { overflow-y: auto; padding: 34px clamp(20px, 5vw, 64px) 40px; display: flex; flex-direction: column; }
.estudio-der { background: radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 70%), var(--card); border-left: 1px solid var(--line); display: grid; place-items: center; position: relative; overflow: hidden; }
.estudio-der::before, .estudio-der::after { content: ''; position: absolute; border-radius: 50%; background: var(--accent); opacity: .07; animation: flotar 12s ease-in-out infinite; }
.estudio-der::before { width: 340px; height: 340px; top: -90px; right: -110px; }
.estudio-der::after { width: 220px; height: 220px; bottom: -60px; left: -50px; animation-delay: -6s; }
.estudio-der .tel { position: relative; z-index: 1; animation: telEntra .7s cubic-bezier(.2, .9, .3, 1.2); }
.estudio-der .etiqueta-vivo { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--card); padding: 5px 12px; border-radius: 99px; box-shadow: var(--sombra); display: flex; gap: 6px; align-items: center; }
.etiqueta-vivo i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; animation: latido 1.4s infinite; }
.pasos { display: flex; gap: 6px; margin: 18px 0 26px; }
.pasos span { flex: 1; height: 5px; border-radius: 99px; background: var(--line); position: relative; overflow: hidden; }
.pasos span.hecho::after, .pasos span.on::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform-origin: left; animation: llenarX .5s ease-out both; }
.estudio h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.estudio .lead { color: var(--ink-2); font-size: 15.5px; margin: 8px 0 24px; max-width: 520px; }
.paso { animation: pasoEntra .45s cubic-bezier(.2, .8, .3, 1); }
.estudio-pie { margin-top: auto; padding-top: 26px; display: flex; gap: 10px; align-items: center; }
.estudio-pie .btn-pri { padding: 12px 22px; font-size: 15px; }
.opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.opcion { border: 2px solid var(--line); border-radius: var(--r); background: var(--card); padding: 14px 12px; cursor: pointer; text-align: center; transition: border-color .15s, transform .15s, box-shadow .15s; font-weight: 600; font-size: 13.5px; }
.opcion:hover { transform: translateY(-2px); box-shadow: var(--sombra-2); }
.opcion.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.opcion .muestra { font-size: 30px; font-weight: 700; display: block; margin-bottom: 4px; color: var(--ink); }
.colores { display: flex; flex-wrap: wrap; gap: 12px; }
.colores button { width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; position: relative; transition: transform .18s cubic-bezier(.3, .8, .4, 1.6); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.colores button:hover { transform: scale(1.12); }
.colores button.on { transform: scale(1.12); box-shadow: 0 0 0 3px var(--card), 0 0 0 5px currentColor; }
.colores button.on::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; animation: pop .3s; }
.color-libre { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px dashed var(--ink-3); position: relative; cursor: pointer; display: grid; place-items: center; font-size: 20px; color: var(--ink-3); }
.color-libre input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.subir { border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 22px; display: flex; gap: 16px; align-items: center; cursor: pointer; background: var(--card); transition: border-color .15s, background .15s; position: relative; }
.subir:hover, .subir.arrastrando { border-color: var(--accent); background: var(--accent-soft); }
.subir input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.construyendo { position: fixed; inset: 0; z-index: 160; background: var(--bg); display: grid; place-items: center; text-align: center; padding: 24px; animation: fade .3s; }
.construyendo .anillo { width: 92px; height: 92px; border-radius: 50%; border: 6px solid var(--accent-soft); border-top-color: var(--accent); animation: girar 1s linear infinite; margin: 0 auto 26px; }
.construyendo .lista-pasos { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; text-align: left; min-width: 280px; }
.construyendo .lista-pasos div { display: flex; gap: 10px; align-items: center; color: var(--ink-3); transition: color .3s; font-weight: 500; }
.construyendo .lista-pasos div.ok { color: var(--ink); }
.construyendo .lista-pasos i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; transition: all .3s; }
.construyendo .lista-pasos .ok i { background: var(--verde); border-color: var(--verde); animation: pop .35s; }
.listo-logo { animation: rebote 1s cubic-bezier(.3, 1.6, .5, 1) both; display: inline-block; }

@media (max-width: 860px) {
  .estudio { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .estudio-der { order: -1; border-left: 0; border-bottom: 1px solid var(--line); height: 250px; place-items: start center; padding-top: 14px; }
  .estudio-der .tel { transform: scale(.52); transform-origin: top center; animation: none; }
  .estudio-der .etiqueta-vivo { top: 10px; bottom: auto; left: 12px; transform: none; font-size: 11px; padding: 4px 10px; }
  .estudio-der { padding-top: 40px; height: 280px; }
  .estudio-izq { padding: 22px 18px 24px; }
  .estudio h1 { font-size: 24px; }
}

/* ============================================================================
   ANIMACIONES — la app se siente viva
   ========================================================================== */
@keyframes aparece { from { opacity: 0; transform: translateY(12px); } }
@keyframes llenar { from { width: 0; } }
@keyframes llenarX { from { transform: scaleX(0); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } }
@keyframes latido { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.75); } }
@keyframes fluir { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes flotar { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-24px, 18px) scale(1.08); } }
@keyframes telEntra { from { transform: translateY(40px) rotate(-4deg); opacity: 0; } }
@keyframes pasoEntra { from { opacity: 0; transform: translateX(18px); } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes rebote { 0% { transform: scale(0) rotate(-20deg); } 100% { transform: none; } }
@keyframes dibujar { from { stroke-dashoffset: 1; } }
@keyframes brillo { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes ondaBtn { to { transform: scale(4); opacity: 0; } }

.entrada > * { animation: aparece .45s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.card, .ej-card, .dia-col, .opcion { transition: transform .2s ease, box-shadow .2s ease, border-color .2s; }
.card[data-ir]:hover, .kpi:hover, .ej-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(16, 24, 40, .25); }
.btn { position: relative; overflow: hidden; transition: background .12s, border-color .12s, box-shadow .12s, transform .1s; }
.btn:active { transform: scale(.97); }
.btn-pri { box-shadow: 0 6px 16px -8px var(--accent); }
.onda { position: absolute; border-radius: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; background: currentColor; opacity: .25; pointer-events: none; animation: ondaBtn .55s ease-out forwards; }
.barra-prog i { animation: llenar 1s cubic-bezier(.2, .8, .3, 1) both; }
.graf-linea { stroke-dasharray: 1; animation: dibujar 1.2s cubic-bezier(.4, 0, .2, 1) both; }
.graf-area { animation: fade 1.2s .3s both; }
.graf circle { animation: pop .4s both; animation-delay: calc(.4s + var(--i, 0) * 90ms); transform-box: fill-box; transform-origin: center; }
.estado-btns button.on { animation: pop .3s; }
.nav a { transition: background .15s, color .15s, padding-left .2s; }
.nav a:hover { padding-left: 14px; }
.nav a.on { position: relative; }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); animation: llenarX .3s; }
.tabbar a.on { transform: translateY(-1px); }
.tabs button { transition: color .15s, border-color .25s; }
.kpi .k-v { font-variant-numeric: tabular-nums; }
.modal { animation: modalEntra .32s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes modalEntra { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.toast { animation: toastEntra .35s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes toastEntra { from { opacity: 0; transform: translateY(20px) scale(.9); } }
.avatar { transition: transform .2s; }
.fila:hover .avatar { transform: scale(1.08) rotate(-4deg); }
.cita { transition: transform .15s, box-shadow .15s; }
.cita:hover { transform: translateX(3px); box-shadow: 0 6px 14px -8px var(--accent); }
.acceso-der .burbuja { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); animation: flotar 10s ease-in-out infinite; }
.vacio .v-ico { animation: flotar 5s ease-in-out infinite; }

#confeti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* ============================================================================
   LOOK COMPLETO: modo oscuro, fondo de la app y efectos
   (las clases las pone Marca.aplicar en <html>, o en el teléfono de muestra)
   ========================================================================== */
#fondoApp { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#app, #portal { position: relative; z-index: 1; }
.fondo-app { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.fa-aurora { background: var(--bg); }
.fa-aurora i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .32; animation: aurora 22s ease-in-out infinite; }
.tema-oscuro .fa-aurora i, .tema-oscuro.fa-aurora i { opacity: .42; }
.fa-aurora i:nth-child(1) { width: 55vmax; height: 55vmax; background: var(--accent); top: -18vmax; left: -12vmax; }
.fa-aurora i:nth-child(2) { width: 45vmax; height: 45vmax; background: var(--accent-2); bottom: -16vmax; right: -10vmax; animation-delay: -8s; animation-duration: 26s; }
.fa-aurora i:nth-child(3) { width: 30vmax; height: 30vmax; background: var(--accent); top: 40%; left: 45%; opacity: .18; animation-delay: -14s; animation-duration: 30s; }
@keyframes aurora { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(8vmax, 6vmax) scale(1.12); } 66% { transform: translate(-6vmax, 4vmax) scale(.92); } }
.fa-cuadricula {
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px; animation: rejilla 40s linear infinite;
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 75%);
}
.fa-cuadricula::after { content: ''; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; background: var(--accent); filter: blur(110px); opacity: .14; top: -30vmax; left: 50%; transform: translateX(-50%); }
@keyframes rejilla { to { background-position: 46px 46px, 46px 46px; } }
.fa-puntos {
  background-image: radial-gradient(var(--ink-3) 1.1px, transparent 1.6px); background-size: 22px 22px; opacity: .45;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.fa-foto { background-attachment: fixed !important; }

/* tarjetas de cristal */
.fx-cristal .card, .fx-cristal .side, .fx-cristal .dia-col, .fx-cristal .rut-dia, .fx-cristal .ej-card, .fx-cristal .modal,
.fx-cristal .tel-prox, .fx-cristal .tel-kpis div, .fx-cristal .tel-rut, .fx-cristal .tabbar, .fx-cristal .p-tabs {
  -webkit-backdrop-filter: blur(16px) saturate(1.35); backdrop-filter: blur(16px) saturate(1.35);
}
.fx-cristal.tema-oscuro .card, .fx-cristal .tema-oscuro .card { border-color: rgba(255, 255, 255, .1); }
.con-fondo .side { background: var(--card); }

/* brillo neón */
.fx-brillo .btn-pri { box-shadow: 0 0 0 1px var(--accent), 0 10px 28px -6px var(--accent-glow); }
.fx-brillo .btn-pri:hover { box-shadow: 0 0 0 1px var(--accent), 0 12px 36px -4px var(--accent-glow); }
.fx-brillo .card:hover, .fx-brillo .kpi:hover { box-shadow: 0 0 0 1px var(--accent-soft), 0 16px 44px -14px var(--accent-glow); }
.fx-brillo .kpi .k-v, .fx-brillo .tel-num { text-shadow: 0 0 24px var(--accent-glow); }
.fx-brillo .nav a.on { box-shadow: inset 0 0 0 1px var(--accent-soft), 0 0 20px -6px var(--accent-glow); }
.fx-brillo .logo-mono, .fx-brillo .logo-img { box-shadow: 0 0 24px var(--accent-glow); }
.fx-brillo .barra-prog i { box-shadow: 0 0 14px var(--accent-glow); }
.fx-brillo .p-prox, .fx-brillo .tel-prox span:first-child { box-shadow: 0 14px 40px -12px var(--accent-glow); }
.fx-brillo .graf-linea { filter: drop-shadow(0 0 6px var(--accent-glow)); }
.fx-brillo .dia-col.hoy { box-shadow: 0 0 0 1px var(--accent), 0 0 30px -8px var(--accent-glow); }
.fx-brillo .tabbar a.on svg, .fx-brillo .p-tabs a.on svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }

/* degradado de dos colores */
.fx-degradado .btn-pri, .fx-degradado .logo-mono, .fx-degradado .barra-prog i, .fx-degradado .p-prox,
.fx-degradado .tel-prox span:first-child, .fx-degradado .nav a.on::before, .fx-degradado .pasos span::after { background: var(--grad); border-color: transparent; }
.fx-degradado .top h1, .fx-degradado .card-t h3, .fx-degradado .kpi .k-v, .fx-degradado .tel-titulo, .fx-degradado .tel-num, .fx-degradado .estudio h1 {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fx-degradado .kpi .k-v [data-contar] { color: transparent; }
.fx-degradado .kpi .k-v:has(.badge) { background: none; color: inherit; }
.fx-degradado .ej-ico, .fx-degradado .vacio .v-ico { background: var(--grad); color: var(--accent-ink); }

/* títulos en mayúsculas */
.fx-mayus h1, .fx-mayus h2, .fx-mayus h3, .fx-mayus .marca b, .fx-mayus .p-hola, .fx-mayus .p-cuando, .fx-mayus .tel-hola,
.fx-mayus .tel-marca b, .fx-mayus .tel-titulo, .fx-mayus .p-cab b, .fx-mayus .kpi .k-l { text-transform: uppercase; letter-spacing: .03em; }

/* modo oscuro: pequeños ajustes de contraste */
.tema-oscuro .aviso.ambar { color: #fde68a; }
.tema-oscuro .aviso.acc { color: var(--ink); }
.tema-oscuro .aviso.rojo { color: #fecaca; }
.tema-oscuro .estado-btns button.on.asistio { border-color: rgba(52, 211, 153, .4); }
.tema-oscuro .estado-btns button.on.falto { border-color: rgba(248, 113, 113, .4); }
.tema-oscuro .btn-danger:hover { border-color: rgba(248, 113, 113, .35); }
.tema-oscuro .modal-fondo { background: rgba(0, 0, 0, .6); }
.tema-oscuro .p-red { background: rgba(255, 255, 255, .12); }
.tema-oscuro .logo-img { background: transparent !important; }

/* teléfono de muestra */
.tel-pantalla > .fondo-app { z-index: 0; }
.tel-portada, .tel-cuerpo, .tel-tabs { position: relative; z-index: 1; }
.tel .fa-aurora i { filter: blur(30px); }
.tel .fa-aurora i:nth-child(1) { width: 260px; height: 260px; top: -60px; left: -80px; }
.tel .fa-aurora i:nth-child(2) { width: 220px; height: 220px; bottom: -60px; right: -70px; }
.tel .fa-aurora i:nth-child(3) { width: 140px; height: 140px; }
.tel .fa-cuadricula { background-size: 26px 26px; }
.tel .fa-foto { background-attachment: scroll !important; }
.tel-titulo { font-family: var(--font-titulo); font-weight: 750; font-size: 15px; color: var(--ink); margin-top: 2px; }
.tel-tabs { background: var(--barra, var(--card)); }

/* ---------- informes, planes de suscripción y aviso de prueba (v0.4) ---------- */
.graf.barras rect { transform-box: fill-box; transform-origin: bottom; animation: crecer .8s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes crecer { from { transform: scaleY(0); } }
.plan-card { text-align: center; padding: 22px 18px; }
.plan-card.destacado { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--sombra-2); }
.plan-precio { font-family: var(--font-titulo); font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 2px; color: var(--ink); }
.plan-precio span { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.aviso-plan { align-items: center; }
.aviso-plan .btn { flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .graf.barras rect { animation: none; } }

/* ---------- arreglos de diseño (v0.4) ---------- */
/* el estudio, "creando tu app" y el teléfono de muestra llevan su propia marca:
   el color del texto tiene que salir de SUS variables, no de las del panel */
.estudio, .construyendo, .tel { color: var(--ink); }
.estudio.fx-degradado h1 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Anton y Bebas solo tienen un grosor: que el navegador no las "engorde" a la fuerza */
html, .estudio, .tel, .construyendo { font-synthesis-weight: none; }
.btn svg { flex-shrink: 0; }
.kpi .k-v .badge { font-family: var(--font-texto); letter-spacing: 0; text-transform: none; }
.acceso-caja .marca span { max-width: none; white-space: normal; }
.solo-m { display: none; }
.rut-campo { display: block; min-width: 0; }
.rut-campo > span { display: none; }
/* gráfico de progreso: puntos y textos en HTML sobre la línea */
.graf-caja { position: relative; height: 170px; margin-top: 6px; }
.graf-caja .graf { position: absolute; inset: 0; width: 100%; height: 100%; }
.graf-punto { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--card-solida, #fff); border: 2px solid var(--accent); animation: pop .4s both; animation-delay: calc(.4s + var(--i, 0) * 90ms); }
.graf-v { position: absolute; transform: translate(-50%, -170%); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.graf-l { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
@media (max-width: 860px) {
  .estudio-der { height: 300px; }
  .estudio-der .tel { transform: scale(.44); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .solo-m { display: inline; }
  .rut-ej { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rut-ej > :last-child { grid-column: 1 / -1; justify-content: flex-end; }
  .rut-campo > span { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-3); margin: 0 0 3px 2px; text-transform: uppercase; letter-spacing: .03em; }
}
@media (prefers-reduced-motion: reduce) { .graf-punto { animation: none; } }
/* en iPhone, un campo de menos de 16px hace que la pantalla se amplíe sola al tocarlo */
@media (max-width: 860px) { .input, .select, .textarea, .rut-ej .input, .rut-ej .input[data-k="nota"] { font-size: 16px !important; } }
