:root {
  --pr: #123b55;
  --pl: #1f6078;
  --pa: #2e8b87;
  --ok: #21856f;
  --wa: #c17b2c;
  --da: #b64a4a;
  --pu: #405a8a;
  --bg: #eef3f5;
  --card: #ffffff;
  --tx: #152631;
  --mu: #61727d;
  --bo: #dbe4e8;
  --nav: 70px;
  --r: 20px;
  --rail: 268px;
  --sh: 0 1px 2px rgba(16, 43, 57, .04), 0 8px 24px rgba(16, 43, 57, .07);
  --sh-md: 0 12px 36px rgba(16, 43, 57, .11);
  --sh-lg: 0 24px 70px rgba(16, 43, 57, .16);
}

body {
  background:
    radial-gradient(circle at 15% 0%, rgba(46, 139, 135, .08), transparent 28rem),
    linear-gradient(180deg, #f5f8f9 0%, var(--bg) 100%);
}

.fi {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fi-solid { fill: currentColor; stroke: none; }

.brand-mark {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Acceso familiar */
.grad {
  background: #edf3f4;
  padding: 26px;
  align-items: center;
}

.grad::before { display: none; }

.auth-experience {
  width: min(1180px, 100%);
  min-height: min(730px, calc(100dvh - 52px));
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(390px, .82fr);
  overflow: hidden;
  border: 1px solid rgba(18, 59, 85, .1);
  border-radius: 30px;
  box-shadow: var(--sh-lg);
  background: #fff;
  position: relative;
  z-index: 1;
}

.auth-story {
  min-height: 680px;
  position: relative;
  overflow: hidden;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background: #123b55;
}

.auth-story::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 37, 54, .96) 0%, rgba(8, 37, 54, .68) 40%, rgba(8, 37, 54, .08) 78%),
    linear-gradient(0deg, rgba(8, 37, 54, .72), transparent 58%),
    url('assets/familia-hero-v2.jpg') center/cover no-repeat;
}

.auth-story > * { position: relative; z-index: 1; }

.story-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.story-brand .brand-mark {
  width: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .92);
}

.story-copy { max-width: 455px; }
.story-kicker,
.portal-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #83d1c7;
}

.story-copy h1 {
  margin: 14px 0 16px;
  max-width: 430px;
  font-size: clamp(38px, 4vw, 62px);
  line-height: 1.02;
  letter-spacing: -2.3px;
}

.story-copy p {
  max-width: 420px;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, .82);
}

.story-points {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.story-points span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .23);
  border-radius: 999px;
  background: rgba(8, 37, 54, .35);
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.auth-experience > .card {
  margin: 0;
  max-width: none;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 52px clamp(32px, 5vw, 66px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: none;
}

#authScreen .logo { text-align: left; margin-bottom: 28px; }
#authScreen .logo .ico {
  width: 58px;
  height: 58px;
  margin: 0 0 18px;
  padding: 6px;
  border-radius: 16px;
  background: #f4f8f8;
  border: 1px solid var(--bo);
  box-shadow: none;
}
#authScreen .logo .ico img { width: 100%; height: 100%; object-fit: contain; }
#authScreen .logo h1 { font-size: 27px; letter-spacing: -1px; }
#authScreen .logo p { margin-top: 7px; font-size: 13px; letter-spacing: 0; line-height: 1.5; }

.role-q { text-align: left; color: var(--tx); font-size: 14px; }
.role-card {
  padding: 15px;
  border-radius: 16px;
  background: #f7fafb;
  border-color: var(--bo);
}
.role-card:hover { background: #eff7f6; border-color: #a8cfca; }
.role-ic {
  color: var(--pr);
  background: #e8f3f2 !important;
  box-shadow: inset 0 0 0 1px rgba(46, 139, 135, .14);
}
.role-ic .fi { width: 24px; height: 24px; }
.role-ar { color: var(--pa); }

.cloud-entry {
  margin-top: 16px;
  padding: 14px 15px;
  border-radius: 14px;
  background: #f5f7f9;
  border: 1px solid var(--bo);
  font-size: 12px;
  line-height: 1.5;
  color: var(--mu);
}
.cloud-entry a { color: var(--pr) !important; text-decoration: none; }

.field label { color: #536773; }
.field input,
.df-field input {
  min-height: 46px;
  background: #f8fafb;
  border-color: #d7e1e5;
}
.field input:focus,
.df-field input:focus {
  border-color: var(--pa);
  box-shadow: 0 0 0 4px rgba(46, 139, 135, .13);
}
.pweye { color: var(--pr); }
.pweye .fi { width: 18px; height: 18px; }
.btn-pri {
  background: var(--pr);
  box-shadow: 0 8px 20px rgba(18, 59, 85, .22);
}
.btn-pri:hover { box-shadow: 0 12px 28px rgba(18, 59, 85, .27); }
.swap-link { color: var(--pa); }
.set-pwd-banner { background: #eef7f6; border-color: #c7e4e0; color: #215f5b; }

/* Aplicación familiar: escritorio */
#app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--bg);
}

#familyRail {
  grid-column: 1;
  grid-row: 1 / -1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 26px 18px 20px;
  background: #0d3147;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.rail-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.rail-brand .brand-mark { width: 43px; height: 43px; padding: 4px; border-radius: 13px; background: #fff; }
.rail-brand b { display: block; font-size: 15px; }
.rail-brand small { display: block; margin-top: 2px; color: rgba(255,255,255,.58); font-size: 10px; }

.rail-student {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(255,255,255,.055);
}
.rail-avatar { width: 39px; height: 39px; border-radius: 12px; display: grid; place-items: center; background: #e7f4f2; color: var(--pr); font-size: 15px; font-weight: 800; overflow: hidden; flex: 0 0 auto; }
.rail-avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.rail-student b { display:block; max-width: 150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size: 12.5px; }
.rail-student small { display:block; max-width: 150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:3px; color:rgba(255,255,255,.55); font-size:9.5px; }

.rail-label { padding: 0 11px 8px; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; color: rgba(255,255,255,.42); }
.family-side-nav { display: flex; flex-direction: column; gap: 4px; }
.family-side-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 11px;
  color: rgba(255,255,255,.68);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  transition: .18s ease;
}
.family-side-btn:hover { color:#fff; background:rgba(255,255,255,.07); }
.family-side-btn.on { color:#fff; background:#1d5367; box-shadow: inset 3px 0 #79c9c0; }
.family-side-btn .fi { width: 19px; height: 19px; }
.rail-footer { margin-top:auto; padding:16px 10px 0; border-top:1px solid rgba(255,255,255,.08); color:rgba(255,255,255,.48); font-size:9.5px; line-height:1.55; }

#appHead {
  grid-column: 2;
  grid-row: 1;
  min-height: 76px;
  padding: 14px clamp(18px, 3vw, 36px);
  background: rgba(255,255,255,.94);
  color: var(--tx);
  border-bottom: 1px solid var(--bo);
  box-shadow: none;
  backdrop-filter: blur(14px);
}
#appHead::after { display:none; }
.hd-av { background:#e8f3f2; color:var(--pr); box-shadow:none; border:1px solid #cfe3e1; }
.hd-name { color:var(--tx); text-shadow:none; font-size:15px; }
.hd-sub { color:var(--mu); }
.hd-print,
.hd-more {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background:#f4f7f8;
  color:var(--pr);
  border:1px solid var(--bo);
  border-radius:11px;
  backdrop-filter:none;
}
.hd-print:hover,.hd-more:hover { background:#eaf3f3; border-color:#bedbd7; }
.hd-print .fi,.hd-more .fi { width:17px;height:17px; }
.hd-badge { padding:5px 10px; }

#switchBar { grid-column:2; grid-row:2; padding:9px clamp(18px,3vw,36px); background:#fff; }
#content { grid-column:2; grid-row:3; }
#bottomNav { display:none; }
.wrap { max-width: 1180px; padding: 24px clamp(18px,3vw,36px) 42px; }

.page-intro {
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:18px;
  margin-bottom:18px;
}
.page-intro h2 { margin-top:5px; font-size:clamp(22px,2.4vw,32px); letter-spacing:-1px; }
.page-intro p { margin-top:7px; color:var(--mu); font-size:12.5px; line-height:1.55; }
.sync-pill { display:inline-flex; align-items:center; gap:7px; padding:8px 11px; border-radius:999px; background:#eaf4f2; color:#216a64; font-size:10px; font-weight:800; white-space:nowrap; }

.family-alert {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:13px;
  margin-bottom:14px;
  padding:15px 16px;
  border-radius:16px;
  border:1px solid var(--bo);
  background:#fff;
  box-shadow:var(--sh);
}
.family-alert-icon { width:42px;height:42px;border-radius:12px;display:grid;place-items:center; }
.family-alert-icon .fi { width:21px;height:21px; }
.family-alert b { display:block; font-size:13px; }
.family-alert p { margin-top:3px; color:var(--mu); font-size:11.5px; line-height:1.45; }
.family-alert.danger { border-color:#eccaca; }
.family-alert.danger .family-alert-icon { color:#a53d3d;background:#faecec; }
.family-alert.warning { border-color:#edd5b6; }
.family-alert.warning .family-alert-icon { color:#a56522;background:#fbf1e5; }
.family-alert.success { border-color:#c5dfd8; }
.family-alert.success .family-alert-icon { color:#216f60;background:#e8f4f1; }

.family-grid { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(280px,.85fr); gap:16px; align-items:start; }
.family-panel { background:#fff; border:1px solid var(--bo); border-radius:18px; padding:17px; box-shadow:var(--sh); }
.family-panel + .family-panel { margin-top:14px; }
.panel-head { display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:13px; }
.panel-head h3 { font-size:14px;letter-spacing:-.2px; }
.panel-head button { color:var(--pa);font-size:10.5px;font-weight:800; }

.kpis { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.kpi { padding:13px; border-radius:15px; box-shadow:none; }
.kpi:hover { transform:none; box-shadow:none; }
.kpi-ico { width:38px;height:38px;border-radius:11px;font-size:inherit;box-shadow:none; }
.kpi-ico .fi { width:20px;height:20px; }
.kpi-v { font-size:20px; }
.kpi-l { font-size:8.5px; }

.quick-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.quick-action {
  display:flex;
  align-items:center;
  gap:9px;
  padding:11px;
  border:1px solid var(--bo);
  border-radius:13px;
  background:#f8fafb;
  color:var(--tx);
  text-align:left;
  font-size:10.5px;
  font-weight:800;
  transition:.18s ease;
}
.quick-action:hover { transform:translateY(-1px);border-color:#a9cfca;background:#eef7f6; }
.quick-action .fi { color:var(--pa);width:19px;height:19px; }

.family-event { display:flex;gap:11px;align-items:flex-start;padding:11px 0;border-top:1px solid #edf1f3; }
.family-event:first-of-type { border-top:0; padding-top:0; }
.event-date { width:44px;flex:0 0 auto;border-radius:10px;padding:6px 3px;background:#edf5f4;color:var(--pr);text-align:center; }
.event-date strong { display:block;font-size:16px;line-height:1; }
.event-date span { display:block;margin-top:3px;font-size:8px;font-weight:800;text-transform:uppercase; }
.family-event b { font-size:11.5px; }
.family-event p { margin-top:3px;color:var(--mu);font-size:10px;line-height:1.4; }

.timeline { gap:7px; }
.tl-item { box-shadow:none;border-radius:12px;padding:11px 12px; }
.tl-item:hover { transform:none;box-shadow:none; }
.tl-ico { width:31px;height:31px;display:grid;place-items:center;border-radius:9px;background:#f2f6f7;color:var(--pr);font-size:inherit; }
.tl-ico .fi { width:16px;height:16px; }

.cbanner { border-radius:12px; }
.sec-title { color:#536773; }

.mat-card,.asist-hero,.astat,.tv-card,.doc-card { box-shadow:var(--sh); }

/* Mensajería recuperada */
#tabMensajes { height:100%; }
.message-shell { max-width:960px;height:100%;margin:0 auto;padding:24px clamp(18px,3vw,36px) 36px;display:flex;flex-direction:column; }
.message-card { min-height:0;flex:1;display:flex;flex-direction:column;background:#fff;border:1px solid var(--bo);border-radius:20px;box-shadow:var(--sh);overflow:hidden; }
.message-head { padding:16px 18px;border-bottom:1px solid var(--bo);display:flex;align-items:center;gap:12px; }
.message-head-icon { width:40px;height:40px;border-radius:12px;background:#e9f4f2;color:var(--pr);display:grid;place-items:center; }
.message-head-icon .fi { width:20px;height:20px; }
.message-head h3 { font-size:14px; }
.message-head p { margin-top:2px;color:var(--mu);font-size:10.5px; }
#chatArea { flex:1;min-height:240px;overflow-y:auto;padding:18px;background:#f7fafb;display:flex;flex-direction:column;gap:11px; }
#chatEmpty { margin:auto;text-align:center;color:var(--mu);font-size:12px;line-height:1.6; }
#chatEmpty .fi { width:34px;height:34px;color:#90aaa8;margin-bottom:8px; }
.chat-compose { padding:12px;border-top:1px solid var(--bo);display:flex;align-items:flex-end;gap:9px;background:#fff; }
#chatInput { flex:1;min-height:44px;max-height:90px;resize:none;padding:11px 13px;border:1px solid var(--bo);border-radius:13px;background:#f8fafb;font:inherit;font-size:12.5px;outline:none; }
#chatInput:focus { border-color:var(--pa);box-shadow:0 0 0 3px rgba(46,139,135,.12); }
#chatSend { width:44px;height:44px;border-radius:12px;display:grid;place-items:center;background:var(--pr);color:#fff; }
#chatSend .fi { width:19px;height:19px; }
.msg-bubble.padre { background:var(--pr); }
.msg-from .fi { width:13px;height:13px; }

/* Menú móvil de funciones adicionales */
.more-sheet { position:fixed;inset:0;z-index:340;display:flex;align-items:flex-end;justify-content:center;padding:16px;background:rgba(7,30,43,.58);backdrop-filter:blur(5px); }
.more-card { width:min(460px,100%);padding:18px;border-radius:22px;background:#fff;box-shadow:var(--sh-lg); }
.more-card-head { display:flex;align-items:center;justify-content:space-between;margin-bottom:12px; }
.more-card-head h3 { font-size:15px; }
.more-close { width:34px;height:34px;border-radius:10px;background:#eef3f5;color:var(--mu);display:grid;place-items:center; }
.more-actions { display:grid;grid-template-columns:1fr 1fr;gap:8px; }
.more-actions button { min-height:70px;padding:12px;border:1px solid var(--bo);border-radius:14px;background:#f8fafb;color:var(--tx);font-size:10.5px;font-weight:800;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:7px; }
.more-actions .fi { width:20px;height:20px;color:var(--pa); }

@media (max-width: 980px) {
  :root { --rail: 232px; }
  .family-grid { grid-template-columns:1fr; }
  .kpis { grid-template-columns:1fr 1fr; }
}

@media (max-width: 760px) {
  .grad { padding:0;align-items:stretch; }
  .auth-experience { min-height:100dvh;display:block;border:0;border-radius:0;box-shadow:none; }
  .auth-story { min-height:280px;padding:24px;justify-content:flex-end; }
  .auth-story::before { background:linear-gradient(0deg,rgba(8,37,54,.88),rgba(8,37,54,.15) 72%),url('assets/familia-hero-v2.jpg') center/cover no-repeat; }
  .story-brand { position:absolute;top:20px;left:20px; }
  .story-copy h1 { margin:10px 0 8px;font-size:31px;line-height:1.05;letter-spacing:-1.2px; }
  .story-copy p { font-size:12px;line-height:1.5; }
  .story-points { display:none; }
  .auth-experience > .card { min-height:auto;padding:28px 22px 34px; }
  #authScreen .logo { margin-bottom:18px; }
  #authScreen .logo .ico { display:none; }
  #authScreen .logo h1 { font-size:23px; }

  #app { display:flex;flex-direction:column; }
  #familyRail { display:none; }
  #appHead { min-height:64px;padding:10px 12px; }
  .hd-av { width:42px;height:42px;border-radius:12px; }
  .hd-name { font-size:13px; }
  .hd-sub { font-size:9px; }
  .hd-badge { display:none; }
  .hd-print { width:35px;min-width:35px;min-height:35px;padding:0; }
  .hd-more { min-height:35px;padding:0 10px;font-size:10px; }
  #switchBar { padding:7px 10px; }
  #bottomNav { display:flex;height:var(--nav); }
  .nav-btn { min-width:0;text-transform:none;letter-spacing:0;font-size:9px; }
  .nav-ico { width:38px;height:28px; }
  #content { flex:1; }
  .wrap { padding:16px 11px calc(var(--nav) + 16px); }
  .page-intro { align-items:flex-start;margin-bottom:13px; }
  .page-intro h2 { font-size:22px; }
  .page-intro p { font-size:11px; }
  .sync-pill { padding:7px 8px;font-size:8.5px; }
  .family-alert { grid-template-columns:auto minmax(0,1fr);padding:12px; }
  .family-alert > button { display:none; }
  .family-grid { gap:12px; }
  .family-panel { border-radius:16px;padding:14px; }
  .family-panel + .family-panel { margin-top:12px; }
  .kpis { gap:8px; }
  .kpi { padding:11px;gap:8px; }
  .kpi-ico { width:34px;height:34px; }
  .kpi-v { font-size:18px; }
  .quick-action { padding:10px 9px; }
  .message-shell { padding:12px 10px calc(var(--nav) + 10px); }
  .message-card { border-radius:16px; }
}

@media (max-width: 380px) {
  .auth-story { min-height:245px; }
  .story-copy h1 { font-size:27px; }
  .auth-experience > .card { padding:24px 17px 28px; }
  .kpis { grid-template-columns:1fr 1fr; }
}

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