/* =========================================================
   PSICONEXT · Portal de Psicología y Agenda Web
   Temas: metálicos (plata, oro, acero, cobre, grafito)
          plásticos (turquesa, coral, lavanda)
   ========================================================= */

:root {
    --font: Arial, Helvetica, 'Liberation Sans', sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    --bg: #eef1f4;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #dfe5ec 0%, transparent 60%), linear-gradient(180deg, #f3f5f8, #e6eaef);
    --surface: #ffffff;
    --surface-2: #f5f7f9;
    --text: #1d2733;
    --muted: #66727f;
    --border: #d9dfe6;
    --primary: #4a6078;
    --primary-strong: #34465a;
    --primary-soft: #e3e9f0;
    --on-primary: #ffffff;
    --accent: #8a9bae;
    --btn: linear-gradient(135deg, #6c829a 0%, #4a6078 45%, #34465a 100%);
    --metal: linear-gradient(135deg, #f4f6f8 0%, #cfd6dd 25%, #f9fafb 45%, #aeb8c2 70%, #e8ecf0 100%);
    --side: linear-gradient(165deg, #e9edf1 0%, #c3ccd5 40%, #eef1f4 62%, #a7b1bb 100%);
    --side-text: #1f2b38;
    --side-muted: #4f5d6b;
    --side-active: rgba(255, 255, 255, .75);
    --side-active-text: #1f3a57;
    --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 8px 24px rgba(20, 30, 45, .08);
    --shadow-lg: 0 20px 60px rgba(15, 25, 40, .25);
    --gloss: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%);

    --ok: #1f9d6b; --ok-soft: #dcf5ea;
    --warn: #c98a12; --warn-soft: #fbefd5;
    --danger: #d0443c; --danger-soft: #fbe1df;
    --info: #2f78c4; --info-soft: #deebf9;
}

[data-theme="metal-oro"] {
    --bg: #f5f1e8;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #f1e5c6 0%, transparent 60%), linear-gradient(180deg, #faf7f0, #efe8d8);
    --surface-2: #faf7ef; --border: #e6dcc3; --text: #2b2414; --muted: #7a6d52;
    --primary: #9a7a2c; --primary-strong: #6b5423; --primary-soft: #f5ecd3;
    --accent: #c9a24a;
    --btn: linear-gradient(135deg, #e6c86f 0%, #b8913a 40%, #8a6a24 70%, #c9a24a 100%);
    --metal: linear-gradient(135deg, #fbf1cf 0%, #d9b65e 30%, #fff4d2 50%, #b8913a 75%, #f0d993 100%);
    --side: linear-gradient(165deg, #2f2612 0%, #5e4a1f 45%, #2a210f 100%);
    --side-text: #f7e7b8; --side-muted: #cdb67c;
    --side-active: linear-gradient(135deg, #f4dd92, #c9a24a); --side-active-text: #2b2414;
}

[data-theme="metal-acero"] {
    --bg: #eaf0f6;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #d3e1ef 0%, transparent 60%), linear-gradient(180deg, #f1f5f9, #e1e8f0);
    --surface-2: #f3f7fb; --border: #d3dde8; --text: #14263a; --muted: #5a6d82;
    --primary: #2f6fae; --primary-strong: #1f4f80; --primary-soft: #dde9f6;
    --accent: #6f8fb0;
    --btn: linear-gradient(135deg, #5b95cf 0%, #2f6fae 45%, #1f4f80 100%);
    --metal: linear-gradient(135deg, #eef4fa 0%, #b3c6da 30%, #f5f9fc 50%, #8aa4bf 75%, #dbe6f1 100%);
    --side: linear-gradient(165deg, #1f3a57 0%, #3b5f86 38%, #20374f 70%, #142637 100%);
    --side-text: #e7f0fa; --side-muted: #a9c0d8;
    --side-active: linear-gradient(135deg, #f1f6fb, #b9cde2); --side-active-text: #14263a;
}

[data-theme="metal-cobre"] {
    --bg: #f6efec;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #f0d8cc 0%, transparent 60%), linear-gradient(180deg, #fbf6f4, #efe3de);
    --surface-2: #fbf5f2; --border: #ead8d0; --text: #2e1a12; --muted: #82625a;
    --primary: #b0643e; --primary-strong: #7f4127; --primary-soft: #f7e3d9;
    --accent: #c27c5c;
    --btn: linear-gradient(135deg, #e0a07f 0%, #b0643e 45%, #7f4127 100%);
    --metal: linear-gradient(135deg, #fbe9e0 0%, #d99c7e 30%, #fff1ea 50%, #b0643e 75%, #f0c7b3 100%);
    --side: linear-gradient(165deg, #4a2517 0%, #8a4a2e 45%, #3d1e12 100%);
    --side-text: #fde9df; --side-muted: #e3b8a2;
    --side-active: linear-gradient(135deg, #fde2d4, #e0a07f); --side-active-text: #2e1a12;
}

[data-theme="grafito"] {
    color-scheme: dark;
    --bg: #121519;
    --bg-grad: radial-gradient(1000px 600px at 100% -10%, #26303b 0%, transparent 60%), linear-gradient(180deg, #16191e, #0f1215);
    --surface: #1d2227; --surface-2: #242a31; --border: #333b44; --text: #e6e9ed; --muted: #9aa5b1;
    --primary: #8fb3d9; --primary-strong: #b9d2ec; --primary-soft: #26364a; --on-primary: #0f1a26;
    --accent: #5d7894;
    --btn: linear-gradient(135deg, #c3d6ea 0%, #8fb3d9 45%, #5d84ad 100%);
    --metal: linear-gradient(135deg, #4a525c 0%, #2b3138 30%, #5a636e 50%, #22272d 75%, #444c56 100%);
    --side: linear-gradient(165deg, #2a3038 0%, #1a1e23 50%, #2e353e 100%);
    --side-text: #e6e9ed; --side-muted: #9aa5b1;
    --side-active: linear-gradient(135deg, #3c4652, #2a323b); --side-active-text: #cfe2f5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --gloss: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 55%);
    --ok-soft: #173a2c; --warn-soft: #3b2f14; --danger-soft: #3d1e1c; --info-soft: #1a2f47;
}

/* Plásticos: colores saturados, superficies brillantes y bordes redondeados */
[data-theme^="plastico"] { --radius: 20px; --radius-sm: 14px; }

[data-theme="plastico-turquesa"] {
    --bg: #e9f8f6;
    --bg-grad: radial-gradient(900px 500px at 0% 0%, #c9f1ec 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #d7f0ff 0%, transparent 60%), #eefaf8;
    --surface-2: #f2fbfa; --border: #cdeae6; --text: #0e2f2c; --muted: #4f7672;
    --primary: #10b3a3; --primary-strong: #0b6f66; --primary-soft: #d6f7f3;
    --accent: #2cc9ff;
    --btn: linear-gradient(180deg, #37d3c3 0%, #10b3a3 55%, #0a9a8c 100%);
    --metal: linear-gradient(135deg, #5fe0d3, #10b3a3);
    --side: linear-gradient(180deg, #14c0af 0%, #0b9d8f 100%);
    --side-text: #ffffff; --side-muted: #d4fbf6;
    --side-active: #ffffff; --side-active-text: #0b6f66;
}

[data-theme="plastico-coral"] {
    --bg: #fff1ee;
    --bg-grad: radial-gradient(900px 500px at 0% 0%, #ffd9d1 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #ffe9c7 0%, transparent 60%), #fff5f2;
    --surface-2: #fff7f5; --border: #f7d6cf; --text: #3a1614; --muted: #8a5a55;
    --primary: #ff6b6b; --primary-strong: #c94040; --primary-soft: #ffe3de;
    --accent: #ffb347;
    --btn: linear-gradient(180deg, #ff8f8f 0%, #ff6b6b 55%, #ec5252 100%);
    --metal: linear-gradient(135deg, #ffa3a3, #ff6b6b);
    --side: linear-gradient(180deg, #ff7676 0%, #f0575a 100%);
    --side-text: #ffffff; --side-muted: #ffe1dd;
    --side-active: #ffffff; --side-active-text: #c94040;
}

[data-theme="plastico-lavanda"] {
    --bg: #f1effe;
    --bg-grad: radial-gradient(900px 500px at 0% 0%, #e0dbff 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #ffd9f3 0%, transparent 60%), #f5f3ff;
    --surface-2: #f7f6ff; --border: #dcd7fb; --text: #1e1747; --muted: #6a6392;
    --primary: #7c6cf0; --primary-strong: #4f3fcf; --primary-soft: #ebe7ff;
    --accent: #f06cc9;
    --btn: linear-gradient(180deg, #9d90ff 0%, #7c6cf0 55%, #6555e0 100%);
    --metal: linear-gradient(135deg, #a79cff, #7c6cf0);
    --side: linear-gradient(180deg, #8475f5 0%, #6555e0 100%);
    --side-text: #ffffff; --side-muted: #e3dfff;
    --side-active: #ffffff; --side-active-text: #4f3fcf;
}

/* ---------------- Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background .4s, color .3s;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
::selection { background: var(--primary); color: var(--on-primary); }

/* ---------------- Botones ---------------- */
.btn {
    --b-bg: var(--surface);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--b-bg); color: var(--text);
    font: 600 13.5px var(--font); cursor: pointer; position: relative; overflow: hidden;
    transition: transform .18s var(--ease), box-shadow .2s, background .2s, border-color .2s, opacity .2s;
    white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--accent); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
    background: var(--btn); color: var(--on-primary); border-color: transparent;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
    text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
}
[data-theme="metal-oro"] .btn-primary { color: #231b08; text-shadow: 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary::after {
    content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: skewX(-20deg); transition: left .6s var(--ease);
}
.btn-primary:hover::after { left: 130%; }
[data-theme^="plastico"] .btn-primary::before {
    content: ''; position: absolute; inset: 1px 1px 50% 1px; border-radius: inherit; background: var(--gloss); pointer-events: none;
}
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-soft { background: var(--primary-soft); color: var(--primary-strong); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon {
    width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
    transition: all .2s var(--ease); font-size: 14px;
}
.btn-icon:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); }
.btn.loading { pointer-events: none; }
.btn.loading > * { opacity: 0; }
.btn.loading::before {
    content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
    inset: auto; background: none;
}

/* ---------------- Formularios ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .2px; }
.field > span .req { color: var(--danger); }
input, select, textarea {
    width: 100%; font: 500 14px var(--font); color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 12px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
input[type=color] { padding: 3px; height: 42px; cursor: pointer; }
input[type=checkbox] { width: auto; accent-color: var(--primary); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 38px; }
.input-icon .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--border); position: relative; padding: 0; border: 0; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .2s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { left: 21px; }
.section-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; margin: 6px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------------- Tarjetas ---------------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; position: relative;
}
[data-theme^="metal"] .card::before, [data-theme="grafito"] .card::before {
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0;
    background: var(--metal); opacity: .9;
}
[data-theme^="plastico"] .card { border-width: 0; box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 12%, transparent), 0 10px 30px color-mix(in srgb, var(--primary) 12%, transparent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card-head h3 .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong); font-size: 15px; }
.card.hover { transition: transform .25s var(--ease), box-shadow .25s; cursor: pointer; }
.card.hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.grid { display: grid; gap: 18px; }
.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-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 18px; }

/* Estadísticas */
.stat { display: flex; align-items: center; gap: 16px; overflow: hidden; }
.stat .ico {
    width: 54px; height: 54px; flex: none; border-radius: 16px; display: grid; place-items: center;
    font-size: 22px; color: var(--on-primary); background: var(--btn);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent);
}
[data-theme="metal-oro"] .stat .ico { color: #2b2414; }
.stat .num { font-size: 28px; font-weight: 800; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.stat .bg-ico { position: absolute; right: -8px; bottom: -14px; font-size: 76px; opacity: .06; }

/* Chips y badges */
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
    background: var(--primary-soft); color: var(--primary-strong); font-size: 12px; font-weight: 600;
}
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.b-agendada { background: var(--info-soft); color: var(--info); }
.b-realizada { background: var(--ok-soft); color: var(--ok); }
.b-ausente { background: var(--warn-soft); color: var(--warn); }
.b-cancelada { background: var(--danger-soft); color: var(--danger); }
.b-alumno { background: var(--info-soft); color: var(--info); }
.b-apoderado { background: var(--warn-soft); color: var(--warn); }
.b-ambos { background: var(--ok-soft); color: var(--ok); }
.b-otro { background: var(--surface-2); color: var(--muted); }
.b-nee { background: #efe7ff; color: #6a3fd1; text-transform: none; }
.b-prio { background: #fff1cc; color: #a36a00; text-transform: none; }
[data-theme="grafito"] .b-nee { background: #2e2447; color: #c3a9ff; }
[data-theme="grafito"] .b-prio { background: #3b2f14; color: #f3c65b; }
.flags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.nee-txt { display: block; color: #6a3fd1 !important; font-size: 11.5px; margin-top: 2px; max-width: 360px; }
[data-theme="grafito"] .nee-txt { color: #c3a9ff !important; }
.table tbody tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* Logo y firma digital */
.logo-box { height: 140px; border: 1px dashed var(--border); border-radius: 14px; display: grid; place-items: center; text-align: center;
    background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 0 / 16px 16px; }
.logo-box img { max-width: 80%; max-height: 120px; object-fit: contain; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 16px; border: 2px dashed var(--border);
    border-radius: 16px; cursor: pointer; transition: all .2s var(--ease); background: var(--surface-2); }
.drop i { font-size: 32px; color: var(--primary); }
.drop small { color: var(--muted); max-width: 360px; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.pad-wrap { position: relative; height: 190px; border: 1px solid var(--border); border-radius: 14px; background: #fff; overflow: hidden; }
.pad-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; z-index: 1; }
.pad-line { position: absolute; left: 10%; right: 10%; bottom: 44px; border-top: 1px dashed #b8c0ca; }
.pad-hint { position: absolute; left: 10%; bottom: 22px; font-size: 11px; color: #9aa4ae; }
.paper-prev { background: #fff; color: #111; font-family: Arial, Helvetica, sans-serif; border-radius: 6px; padding: 34px 18% 26px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08); border: 1px solid #e3e6ea; }
.firma-prev { text-align: center; font-size: 12px; line-height: 1.35; }
.firma-prev .firma-img { height: 72px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: -7px; position: relative; }
.firma-prev .firma-img img { max-height: 72px; max-width: 88%; object-fit: contain; transition: opacity .3s; }
.firma-prev .firma-img.off img { opacity: .15; }
.firma-prev .linea { border-top: 1px solid #111; margin: 0 6% 5px; }
.firma-prev small { display: block; color: #333; }
.apo-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; min-width: 0; }

/* Avatar */
.avatar {
    width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
    font-weight: 800; font-size: 15px; color: #fff; letter-spacing: .5px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--av, var(--primary)) 70%, #fff), var(--av, var(--primary)));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 3px 10px color-mix(in srgb, var(--av, var(--primary)) 35%, transparent);
    border: 2px solid rgba(255,255,255,.7);
}
.avatar.lg { width: 84px; height: 84px; font-size: 28px; border-width: 3px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; border-width: 1px; }

/* ---------------- Layout ---------------- */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
    background: var(--side); color: var(--side-text); padding: 18px 14px;
    border-right: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    box-shadow: inset -1px 0 0 rgba(255,255,255,.35), 4px 0 24px rgba(0,0,0,.06); z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 16px; }
.side-brand strong { font-size: 20px; font-weight: 800; letter-spacing: -.3px; display: block; }
.side-brand strong span, .login-hero h1 span { color: var(--accent); }
[data-theme="metal-plata"] .side-brand strong span, [data-theme="metal-plata"] .login-hero h1 span { color: var(--primary); }
[data-theme^="plastico"] .side-brand strong span { color: #fff; opacity: .8; }
.side-brand small { display: block; color: var(--side-muted); font-size: 11.5px; line-height: 1.3; }
.brand-mark {
    width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 20px;
    background: var(--metal); color: var(--primary-strong);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 -2px 4px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.15);
    border: 1px solid rgba(255,255,255,.5);
}
[data-theme^="plastico"] .brand-mark { background: #fff; color: var(--primary); }
[data-theme="grafito"] .brand-mark { color: var(--primary); }
.brand-mark.big { width: 76px; height: 76px; font-size: 36px; border-radius: 22px; animation: pulseGlow 3s ease-in-out infinite; }

.side-profile {
    display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 14px; border-radius: 14px;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(4px); cursor: pointer;
    transition: background .2s;
}
.side-profile:hover { background: rgba(255,255,255,.3); }
.side-profile .who { min-width: 0; }
.side-profile b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-profile small { color: var(--side-muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-nav .grp { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--side-muted); padding: 12px 12px 4px; font-weight: 700; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    color: var(--side-text); font-weight: 600; font-size: 13.8px; transition: background .2s, transform .2s var(--ease), color .2s;
    position: relative;
}
.side-nav a i { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.side-nav a:hover { background: rgba(255,255,255,.18); transform: translateX(3px); }
.side-nav a.active { background: var(--side-active); color: var(--side-active-text); box-shadow: 0 4px 14px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.6); }
.side-logout { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 12px; border-radius: 12px; color: var(--side-text); font-weight: 600; opacity: .85; border: 1px dashed color-mix(in srgb, var(--side-text) 30%, transparent); }
.side-logout:hover { opacity: 1; background: rgba(0,0,0,.08); }
.side-overlay { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    padding: 16px 28px; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.crumbs { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--primary); }
.top-right { text-align: right; font-size: 12.5px; color: var(--muted); }
.top-date { font-weight: 700; color: var(--text); }
.view { padding: 24px 28px 40px; animation: fadeUp .45s var(--ease); }
.only-mobile { display: none; }

/* ---------------- Tablas y listas ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .15s; animation: fadeUp .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; }
.person small { color: var(--muted); font-size: 12px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar select { width: auto; min-width: 150px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; font: 600 13px var(--font); color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; transition: all .2s; display: inline-flex; gap: 7px; align-items: center; }
.seg button.on { background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 16px; font: 700 13.5px var(--font); color: var(--muted); cursor: pointer; position: relative; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--btn); transform: scaleX(0); transition: transform .25s var(--ease); }
.tabs button.on { color: var(--primary-strong); }
.tabs button.on::after { transform: scaleX(1); }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty i { font-size: 42px; opacity: .35; display: block; margin-bottom: 12px; }
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 15px; }

/* Cursos */
.course-card { overflow: hidden; }
.course-card .band { height: 70px; margin: -20px -20px 14px; background: var(--metal); position: relative; overflow: hidden; }
.course-card .band::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.55) 45%, transparent 60%); transform: translateX(-100%); transition: transform .8s var(--ease); }
.course-card:hover .band::after { transform: translateX(100%); }
.course-card .band i { position: absolute; right: 16px; bottom: -10px; font-size: 64px; color: rgba(0,0,0,.08); }
.course-card .cico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; background: var(--surface); color: var(--primary); margin-top: -46px; position: relative; box-shadow: var(--shadow); border: 1px solid var(--border); }
.course-card h3 { font-size: 18px; margin-top: 10px; }
.course-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--primary), var(--border)); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 18px; animation: fadeUp .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.tl-item .dot { position: absolute; left: -26px; top: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; color: #fff; background: var(--primary); box-shadow: 0 0 0 4px var(--surface); }
.tl-item.acta .dot { background: var(--ok); }
.tl-item .tl-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tl-item .tl-card p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* Listas de sesiones */
.ses-item { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); transition: all .2s var(--ease); animation: fadeUp .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.ses-item + .ses-item { margin-top: 10px; }
.ses-item:hover { border-color: var(--primary); transform: translateX(3px); }
.ses-time { width: 74px; flex: none; text-align: center; padding: 8px 4px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-strong); }
.ses-time b { display: block; font-size: 16px; }
.ses-time small { font-size: 11px; }
.ses-body { flex: 1; min-width: 0; }
.ses-body b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ses-body small { color: var(--muted); }
.ses-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.date-group { font-weight: 800; font-size: 13px; color: var(--muted); margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.date-group.today { color: var(--primary); }

/* Semana */
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.week-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; min-height: 280px; }
.week-col.off { opacity: .6; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, transparent 10px, transparent 20px); }
.week-col.today { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.week-col h4 { font-size: 13px; text-transform: capitalize; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.week-col h4 span { font-size: 22px; font-weight: 800; color: var(--primary); }
.wk-ev { border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface); border-left: 4px solid var(--info); box-shadow: var(--shadow); cursor: pointer; font-size: 12.5px; transition: transform .2s var(--ease); animation: popIn .35s var(--ease) both; }
.wk-ev:hover { transform: scale(1.03); }
.wk-ev.realizada { border-left-color: var(--ok); } .wk-ev.ausente { border-left-color: var(--warn); } .wk-ev.cancelada { border-left-color: var(--danger); opacity: .6; text-decoration: line-through; }
.wk-ev b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-free { font-size: 11.5px; color: var(--muted); text-align: center; padding: 10px 0; }

/* Bloques horarios */
.date-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.date-chip { flex: none; scroll-snap-align: start; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 8px 12px; text-align: center; cursor: pointer; min-width: 74px; transition: all .2s var(--ease); font-family: var(--font); color: var(--text); }
.date-chip small { display: block; font-size: 11px; color: var(--muted); text-transform: capitalize; font-weight: 600; }
.date-chip b { font-size: 20px; display: block; line-height: 1.1; }
.date-chip:hover { border-color: var(--primary); transform: translateY(-2px); }
.date-chip.on { background: var(--btn); color: var(--on-primary); border-color: transparent; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent); }
.date-chip.on small { color: inherit; opacity: .85; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.slot { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 6px; text-align: center; cursor: pointer; font: 700 13.5px var(--font); color: var(--text); transition: all .2s var(--ease); animation: popIn .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.slot small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.slot.on { background: var(--btn); color: var(--on-primary); border-color: transparent; }
.slot.on small { color: inherit; }
.slot:disabled { cursor: not-allowed; background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.slot.busy:disabled { background: var(--danger-soft); color: var(--danger); text-decoration: none; }
.slot-sep { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 6px; }

/* Horarios (admin) */
.sched-day { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); align-items: start; }
.sched-day:last-child { border-bottom: 0; }
.sched-day > b { padding-top: 8px; }
.range { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.range input { width: 120px; }
.day-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.day-pill { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.day-pill.on { background: var(--btn); color: var(--on-primary); border-color: transparent; box-shadow: 0 3px 8px color-mix(in srgb, var(--primary) 30%, transparent); }

/* Temas */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.theme-opt { border: 2px solid var(--border); border-radius: 16px; padding: 10px; cursor: pointer; background: var(--surface); transition: all .25s var(--ease); text-align: left; font-family: var(--font); color: var(--text); }
.theme-opt:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.theme-opt.on { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.theme-prev { height: 70px; border-radius: 10px; margin-bottom: 8px; display: grid; grid-template-columns: 30% 1fr; overflow: hidden; border: 1px solid rgba(0,0,0,.08); }
.theme-prev .s { background: var(--c3); }
.theme-prev .m { background: var(--c1); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.theme-prev .m i { display: block; height: 8px; border-radius: 4px; background: var(--c2); }
.theme-prev .m i:nth-child(2) { width: 60%; opacity: .5; }
.theme-prev.metal .s { background: linear-gradient(160deg, var(--c3), var(--c2) 50%, var(--c3)); }
.theme-prev.metal .m i:first-child { background: linear-gradient(90deg, var(--c2), #fff, var(--c2)); }
.theme-opt b { font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.theme-opt small { color: var(--muted); font-size: 11.5px; }

/* Perfil profesional */
.profile-hero { padding: 0; overflow: hidden; }
.profile-hero .cover { height: 130px; background: var(--metal); position: relative; overflow: hidden; }
.profile-hero .cover::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 120%, rgba(255,255,255,.5), transparent 40%), radial-gradient(circle at 90% -20%, rgba(0,0,0,.12), transparent 50%); }
.profile-hero .cover i { position: absolute; right: 24px; top: 14px; font-size: 100px; opacity: .1; }
.profile-hero .body { padding: 0 24px 22px; display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.profile-hero .avatar.lg { margin-top: -42px; }
.profile-hero h2 { font-size: 22px; }
.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.info-list li:last-child { border: 0; }
.info-list li i { width: 18px; color: var(--primary); margin-top: 3px; text-align: center; }
.info-list li span { color: var(--muted); min-width: 120px; }

/* ---------------- Modal ---------------- */
.modal-back {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
    background: rgba(12, 18, 28, .45); backdrop-filter: blur(6px); animation: fadeIn .25s ease;
}
.modal {
    width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
    background: var(--surface); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border); animation: modalIn .38s var(--ease); overflow: hidden;
}
.modal.lg { width: min(880px, 100%); }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); position: relative; }
.modal-head::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--metal); }
.modal-head .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--btn); color: var(--on-primary); font-size: 17px; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
[data-theme="metal-oro"] .modal-head .ico { color: #2b2414; }
.modal-head h3 { flex: 1; font-size: 17px; }
.modal-head h3 small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); flex-wrap: wrap; }
.modal-back.closing { animation: fadeOut .22s ease forwards; }
.modal-back.closing .modal { animation: modalOut .22s ease forwards; }
.confirm-ico { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 30px; background: var(--danger-soft); color: var(--danger); animation: popIn .4s var(--ease); }
.confirm-ico.info { background: var(--info-soft); color: var(--info); }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; gap: 12px; align-items: center; min-width: 260px; max-width: 380px; padding: 13px 16px; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); border-left: 5px solid var(--ok); animation: toastIn .4s var(--ease); font-weight: 600; font-size: 13.5px; }
.toast i { font-size: 18px; color: var(--ok); }
.toast.error { border-color: var(--danger); } .toast.error i { color: var(--danger); }
.toast.info { border-color: var(--info); } .toast.info i { color: var(--info); }
.toast.out { animation: toastOut .3s ease forwards; }

/* Carga */
.loader { display: grid; place-items: center; padding: 60px; color: var(--primary); }
.loader .ring { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }

/* Animación escalonada de tarjetas */
.anim { animation: fadeUp .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }

/* ---------------- Login ---------------- */
.login-body { min-height: 100vh; overflow-x: hidden; background: var(--side); background-attachment: fixed; }
.login-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.o1 { width: 420px; height: 420px; background: var(--accent); top: -120px; left: -80px; }
.o2 { width: 520px; height: 520px; background: var(--primary); bottom: -200px; right: -120px; animation-delay: -6s; }
.o3 { width: 280px; height: 280px; background: #fff; top: 40%; left: 45%; opacity: .25; animation-delay: -12s; }
.float { position: absolute; color: var(--side-text); opacity: .12; animation: floaty 9s ease-in-out infinite; }
.f1 { font-size: 90px; top: 12%; left: 8%; } .f2 { font-size: 60px; top: 70%; left: 14%; animation-delay: -2s; }
.f3 { font-size: 70px; top: 18%; right: 10%; animation-delay: -4s; } .f4 { font-size: 54px; bottom: 10%; right: 38%; animation-delay: -6s; }
.f5 { font-size: 46px; top: 48%; left: 42%; animation-delay: -3s; }
.login-wrap { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 440px); gap: 60px; align-items: center; max-width: 1140px; margin: 0 auto; padding: 40px 28px; }
.login-hero { color: var(--side-text); animation: fadeUp .7s var(--ease); }
.login-hero h1 { font-size: 54px; font-weight: 800; letter-spacing: -1.5px; margin: 20px 0 4px; }
.login-hero .lead { font-size: 19px; color: var(--side-muted); margin: 0 0 22px; font-weight: 500; }
.hero-logo { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 12px; padding: 5px; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.hero-inst > div { display: flex; flex-direction: column; gap: 6px; }
.top-logo { height: 44px; width: auto; max-width: 110px; object-fit: contain; background: #fff; border-radius: 10px; padding: 4px; border: 1px solid var(--border); }
.hero-inst { display: inline-flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px); font-weight: 600; font-size: 14px; }
.hero-inst i { width: 18px; opacity: .8; }
.hero-features { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.hero-features li { display: flex; gap: 14px; align-items: center; animation: fadeUp .6s var(--ease) both; }
.hero-features li:nth-child(1) { animation-delay: .15s; } .hero-features li:nth-child(2) { animation-delay: .25s; }
.hero-features li:nth-child(3) { animation-delay: .35s; } .hero-features li:nth-child(4) { animation-delay: .45s; }
.hero-features i { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); flex: none; }
.hero-features span { color: var(--side-muted); } .hero-features b { color: var(--side-text); }
.login-card { padding: 30px; animation: modalIn .7s var(--ease); }
.glass { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); }
.login-card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.login-card-head h2 { font-size: 22px; }
.login-card-head p { margin: 2px 0 0; font-size: 13px; }
.login-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px; animation: fadeUp .3s; }
.login-foot { font-size: 11.5px; color: var(--muted); text-align: center; margin: 18px 0 0; }
.login-card.shake { animation: shake .45s; }
.login-card.success { animation: zoomOut .45s var(--ease) forwards; }

/* ---------------- Animaciones ---------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes zoomOut { to { opacity: 0; transform: scale(.92); } }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.1); } }
@keyframes floaty { 50% { transform: translateY(-18px) rotate(6deg); } }
@keyframes pulseGlow { 50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 0 0 10px rgba(255,255,255,.08), 0 10px 30px rgba(0,0,0,.2); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------------- Responsivo ---------------- */
@media (max-width: 1100px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-side { grid-template-columns: 1fr; }
    .week { grid-template-columns: repeat(5, minmax(150px, 1fr)); overflow-x: auto; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .3s var(--ease); }
    .sidebar.open { transform: none; }
    .side-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; animation: fadeIn .2s; }
    .only-mobile { display: inline-grid; }
    .top-right { display: none; }
    .topbar, .view { padding-left: 16px; padding-right: 16px; }
    .login-wrap { grid-template-columns: 1fr; gap: 30px; }
    .login-hero h1 { font-size: 40px; }
    .hero-features { display: none; }
}
@media (max-width: 640px) {
    .g2, .g3, .g4, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .sched-day { grid-template-columns: 1fr; }
    .ses-item { flex-wrap: wrap; }
    .modal-back { padding: 10px; }
}

/* =========================================================
   AJUSTE A PANTALLA · ESCRITORIO (sin scroll vertical de página)
   La página ocupa exactamente la ventana; solo las listas/tablas
   se desplazan dentro de su propia tarjeta.
   ========================================================= */
.page { display: flex; flex-direction: column; gap: 18px; }
.g-ficha { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.bottom-nav { display: none; }

@media (min-width: 901px) and (min-height: 520px) {
    html, body { height: 100%; overflow: hidden; }
    .app { height: 100vh; height: 100dvh; }
    .sidebar { height: 100%; position: relative; }
    .main { height: 100%; min-height: 0; overflow: hidden; }
    .view { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding-bottom: 20px; }
    .page { flex: 1 1 auto; min-height: 0; }
    .page > * { flex: 0 0 auto; }
    .page > .grow, .fill > .grow, .grow > .fill { flex: 1 1 0; min-height: 0; }
    .grow:not(.grid) { display: flex; flex-direction: column; }
    .grow.scroll-y > * { flex-shrink: 0; }
    .grid.grow { grid-template-rows: minmax(0, 1fr); align-items: stretch; }
    .grid.grow > * { min-height: 0; }
    .fill { display: flex; flex-direction: column; min-height: 0; }
    .fill > .card-head, .fill > .toolbar, .fill > .tabs, .fill > p { flex: none; }
    .fill .table-wrap { flex: 1 1 0; min-height: 0; overflow: auto; }
    .fill .table thead th { position: sticky; top: 0; z-index: 2; }
    .scroll-y { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
    .page > .scroll-y, .fill > .scroll-y { flex: 1 1 0; }
    .grid.scroll-y { align-content: start; padding: 6px; margin: -6px; }
    .stack.scroll-y { padding-right: 4px; }
    .week.grow { min-height: 0; }
    .week.grow .week-col { min-height: 0; overflow-y: auto; }
    .toolbar { margin-bottom: 12px; }

    /* Pantalla de ingreso en una sola vista */
    .login-body { height: 100dvh; overflow: hidden; }
    .login-wrap { height: 100vh; height: 100dvh; min-height: 0; padding-top: 24px; padding-bottom: 24px; }
}

/* Pantallas bajas (notebooks 1366×768, 1280×720…): diseño compacto */
@media (min-width: 901px) and (max-height: 820px) {
    .topbar { padding-top: 10px; padding-bottom: 10px; }
    .top-title h1 { font-size: 18px; }
    .top-logo { height: 36px; }
    .view { padding-top: 14px; }
    .page { gap: 12px; }
    .card { padding: 14px 16px; }
    .card-head { margin-bottom: 10px; }
    .card-head h3 .ico { width: 30px; height: 30px; font-size: 13px; }
    .hero-home .cover { height: 58px; }
    .hero-home .body { padding-bottom: 14px; }
    .hero-home .avatar.lg { width: 60px; height: 60px; font-size: 21px; margin-top: -28px; }
    .hero-home h2 { font-size: 18px; }
    .stat .ico { width: 42px; height: 42px; font-size: 17px; border-radius: 12px; }
    .stat .num { font-size: 22px; }
    .table td { padding-top: 8px; padding-bottom: 8px; }
    .ses-item { padding: 9px; }
    .side-brand { padding-bottom: 8px; }
    .side-profile { padding: 8px 10px; margin-bottom: 6px; }
    .side-profile .avatar { width: 36px; height: 36px; font-size: 13px; }
    .side-nav .grp { padding-top: 8px; }
    .side-nav a { padding: 8px 12px; }
    .side-logout { margin-top: 6px; padding: 8px 12px; }
    .login-hero .brand-mark.big { width: 56px; height: 56px; font-size: 26px; }
    .login-hero h1 { font-size: 40px; margin-top: 10px; }
    .login-hero .lead { margin-bottom: 14px; }
    .hero-features { gap: 8px; margin-top: 16px; }
    .hero-features i { width: 32px; height: 32px; }
    .login-card { padding: 22px; }
}
@media (min-width: 901px) and (max-height: 640px) {
    .hero-features, .hero-home .cover { display: none; }
    .hero-home .avatar.lg { margin-top: 12px; }
}

/* =========================================================
   TABLET (horizontal 901–1200 px)
   ========================================================= */
@media (min-width: 901px) and (max-width: 1200px) {
    .app { grid-template-columns: 224px minmax(0, 1fr); }
    .side-nav a { font-size: 13px; gap: 10px; }
    .topbar, .view { padding-left: 18px; padding-right: 18px; }
    .top-right { display: none; }
    .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stat { gap: 10px; }
    .stat .lbl { font-size: 11.5px; }
    .g-side { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    .g-ficha { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
    .week { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; overflow: visible; }
    .week-col { padding: 8px; }
}

/* =========================================================
   TABLET VERTICAL Y CELULAR (≤ 900 px)
   ========================================================= */
@media (max-width: 900px) {
    .g-ficha { grid-template-columns: 1fr; }
    .bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; justify-content: space-around;
        background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
        border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
    }
    .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700;
        color: var(--muted); padding: 6px 2px; border-radius: 12px; transition: background .2s, color .2s; }
    .bottom-nav a i { font-size: 18px; }
    .bottom-nav a.active { color: var(--primary-strong); background: var(--primary-soft); }
    .view { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
    .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
    .toast { max-width: none; min-width: 0; }
    input, select, textarea { font-size: 16px; }
    .btn-icon { width: 40px; height: 40px; }
    .topbar { gap: 10px; }
    .top-logo { height: 34px; }
    .top-title h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .profile-hero .cover { height: 90px; }
    .week { grid-template-columns: repeat(5, minmax(160px, 1fr)); overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
    .week-col { scroll-snap-align: start; }
    .login-wrap { padding: 24px 16px; gap: 22px; align-content: start; }
    .login-hero .brand-mark.big { width: 60px; height: 60px; font-size: 28px; }
}

/* =========================================================
   CELULAR (≤ 640 px)
   ========================================================= */
@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .view { padding-left: 12px; padding-right: 12px; padding-top: 14px; }
    .crumbs { display: none; }
    .card { padding: 14px; }
    .page { gap: 14px; }
    .hide-sm { display: none !important; }
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { gap: 10px; }
    .stat .ico { width: 40px; height: 40px; font-size: 16px; border-radius: 12px; }
    .stat .num { font-size: 21px; }
    .stat .lbl { font-size: 11px; }
    .profile-hero .body { padding: 0 16px 16px; gap: 12px; }
    .profile-hero .body > .btn { width: 100%; }
    .hero-home .avatar.lg { width: 64px; height: 64px; font-size: 22px; margin-top: -30px; }
    .toolbar { gap: 8px; }
    .toolbar .search, .toolbar select { flex: 1 1 100%; min-width: 0; width: 100%; }
    .toolbar > .btn { flex: 1 1 auto; }
    .seg { max-width: 100%; overflow-x: auto; }
    .seg button { white-space: nowrap; padding: 7px 11px; }
    .ses-item { flex-wrap: wrap; gap: 10px; }
    .ses-body { flex: 1 1 calc(100% - 90px); }
    .ses-actions { flex: 1 1 100%; justify-content: flex-start; }
    .week { grid-template-columns: 1fr; overflow: visible; }
    .week-col { min-height: 0; }
    .week-col.off { display: none; }
    .course-card .band { height: 56px; }
    .login-hero h1 { font-size: 34px; }
    .login-hero .lead { font-size: 16px; }
    .hero-inst { font-size: 13px; }
    .login-card { padding: 20px; }

    /* Tablas → tarjetas */
    .table-wrap { overflow: visible; }
    .table thead { display: none; }
    .table, .table tbody { display: block; }
    .table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 12px; margin-bottom: 10px;
        border: 1px solid var(--border); border-radius: 14px; background: var(--surface); position: relative; }
    .table td { display: block; border: 0; padding: 0; min-width: 0; }
    .table td.td-main, .table td.td-actions, .table td:only-child { grid-column: 1 / -1; }
    .table td.td-num { position: absolute; top: 10px; right: 12px; font-size: 12px; }
    .table td.td-main { padding-right: 34px; }
    .table td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
        color: var(--muted); font-weight: 700; margin-bottom: 2px; }
    .table td.td-actions .actions { justify-content: flex-start; }
    .table tbody tr:hover { background: var(--surface); }
    .table tbody tr.flagged { border-left: 4px solid var(--accent); }
    .table tbody tr.flagged td:first-child { box-shadow: none; }

    /* Ventanas modales como hoja inferior a pantalla completa */
    .modal-back { place-items: end center; padding: 0; }
    .modal, .modal.lg, .modal.sm { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; animation: sheetIn .35s var(--ease); }
    .modal-head { padding: 14px 16px; }
    .modal-body { padding: 16px; }
    .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .modal-foot .btn { flex: 1 1 auto; }
    .slots { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }

/* La tarjeta de perfil/bienvenida no lleva relleno (portada a sangre) en ningun tamano */
.card.profile-hero { padding: 0; }


/* =========================================================
   FOTOS DE ALUMNOS
   ========================================================= */
.avatar.md { width: 46px; height: 46px; font-size: 15px; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; border-width: 3px; }
.avatar.photo { position: relative; overflow: hidden; cursor: zoom-in; background: var(--surface-2); padding: 0; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; display: block; border-radius: 50%; }
.avatar.photo b { display: none; }
.avatar.photo.err { cursor: default; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 70%, #fff), var(--primary)); }
.avatar.photo.err img { display: none; }
.avatar.photo.err b { display: block; font-weight: 800; }
.avatar.photo:not(.err):hover { box-shadow: 0 0 0 3px var(--primary-soft), 0 4px 14px rgba(0,0,0,.2); transform: scale(1.06); transition: transform .2s var(--ease); }
.ses-item .avatar.md { flex: none; }
.foto-full { display: grid; place-items: center; min-height: 240px; }
.foto-full img { max-width: 100%; max-height: 68vh; border-radius: 14px; box-shadow: var(--shadow); object-fit: contain; animation: popIn .3s var(--ease); }
.foto-tree { font-family: Consolas, 'Courier New', monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 14px; line-height: 1.9; overflow-x: auto; white-space: nowrap; }
.foto-tree i { width: 18px; color: var(--primary); }
.foto-tree .l1 { padding-left: 20px; }
.foto-tree .l2 { padding-left: 40px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 5px; }
.meter span { display: block; height: 100%; background: var(--btn); border-radius: inherit; }
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.foto-grid figure { margin: 0; text-align: center; }
.foto-grid figure .avatar { margin: 0 auto 6px; }
.foto-grid figcaption { font-size: 11px; color: var(--muted); line-height: 1.25; }
@media (max-width: 640px) {
    .ses-item .avatar.md { width: 40px; height: 40px; }
}

/* =========================================================
   CURSOS Y ALUMNOS · correcciones de diseño
   ========================================================= */
/* Grillas que se desplazan por dentro (tarjetas de cursos): filas de altura natural */
@media (min-width: 901px) and (min-height: 520px) {
    .grid.grow.scroll-y { grid-template-rows: none; }
    .grid.scroll-y > * { min-height: auto; }
    #cfg > .grow { flex: 1 1 0; min-height: 0; }
}

/* Tabla de alumnos compacta y de ancho fijo */
.tabla-alumnos { table-layout: fixed; width: 100%; }
.tabla-alumnos th, .tabla-alumnos td { padding: 8px 10px; }
.tabla-alumnos .c-num { width: 44px; text-align: center; font-weight: 700; color: var(--muted); }
.tabla-alumnos .c-edad { width: 78px; white-space: nowrap; }
.tabla-alumnos .c-curso { width: 140px; }
.tabla-alumnos .c-apo { width: 24%; }
.tabla-alumnos .c-seg { width: 128px; }
.tabla-alumnos .c-acc { width: 128px; text-align: right; }
.tabla-alumnos.prof .c-acc { width: 214px; }
.tabla-alumnos td { vertical-align: middle; }
.tabla-alumnos .actions { flex-wrap: nowrap; gap: 4px; justify-content: flex-end; }
.tabla-alumnos .actions .btn-sm { padding: 6px 10px; }
.tabla-alumnos .person { gap: 10px; min-width: 0; }
.tabla-alumnos .who { min-width: 0; flex: 1; }
.tabla-alumnos .who .name { font-weight: 700; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tabla-alumnos .who .name:hover { color: var(--primary); text-decoration: underline; }
.tabla-alumnos .who small { display: block; color: var(--muted); font-size: 12px; }
.tabla-alumnos .flags { margin-top: 4px; flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.tabla-alumnos .extra { display: none; }
.nee-short { display: inline-block; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.b-prio { flex: none; }
.ellipsis { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-sub { text-transform: none; letter-spacing: 0; font-weight: 500; }
.chip-sm { padding: 2px 8px; font-size: 11px; }
.btn-icon.sm { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; flex: none; }

/* Pantallas medianas: edad y seguimiento pasan bajo el nombre */
@media (min-width: 641px) and (max-width: 1280px) {
    .tabla-alumnos .c-edad, .tabla-alumnos .c-seg { display: none; }
    .tabla-alumnos .extra { display: inline; }
    .tabla-alumnos .c-apo { width: 30%; }
}
@media (min-width: 641px) and (max-width: 1100px) {
    .th-sub { display: none; }
    .tabla-alumnos.prof .c-acc { width: 178px; }
    .tabla-alumnos.prof .actions .btn-sm span { display: none; }
}

/* Celular: la tabla ya se muestra como tarjetas */
@media (max-width: 640px) {
    .tabla-alumnos .actions { flex-wrap: wrap; justify-content: flex-start; }
    .tabla-alumnos .c-acc, .tabla-alumnos .c-apo, .tabla-alumnos .c-seg, .tabla-alumnos .c-edad { width: auto; text-align: left; }
    .tabla-alumnos .c-num { text-align: right; }
    .tabla-alumnos .flags { flex-wrap: wrap; }
}

/* Configuración › Cursos y alumnos */
.cfg-cursos { grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); }
.curso-list { display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.curso-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.curso-row:hover { background: var(--surface-2); }
.curso-row.on { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.cr-acr { flex: none; min-width: 44px; height: 34px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 11.5px;
    background: var(--surface-2); color: var(--primary-strong); border: 1px solid var(--border); }
.curso-row.on .cr-acr { background: var(--btn); color: var(--on-primary); border-color: transparent; }
.cr-main { flex: 1; min-width: 0; }
.cr-main b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-main small { color: var(--muted); font-size: 11.5px; }
.cr-act { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.curso-row:hover .cr-act, .curso-row.on .cr-act { opacity: 1; }
@media (hover: none) { .cr-act { opacity: 1; } }
@media (max-width: 900px) {
    .cfg-cursos { grid-template-columns: 1fr; }
    .curso-list { max-height: 40vh; overflow-y: auto; }
}

/* Pestañas de configuración: pasan a una segunda línea en vez de esconderse */
@media (min-width: 901px) {
    .tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
    .tabs button { padding: 10px 12px; }
}

/* RUT, edad y etiquetas en una sola línea bajo el nombre */
.tabla-alumnos .meta-line { display: flex; align-items: center; gap: 6px; margin-top: 3px; min-width: 0; overflow: hidden; white-space: nowrap; }
.tabla-alumnos .meta-line > small { flex: none; }
.tabla-alumnos .meta-line .badge { padding: 2px 7px; font-size: 10.5px; }
.tabla-alumnos .meta-line .nee-short { flex: 0 1 auto; }
@media (max-width: 640px) { .tabla-alumnos .meta-line { flex-wrap: wrap; white-space: normal; } }

/* Filas de altura real en grillas que se desplazan por dentro (tarjetas de cursos) */
.grid.scroll-y { grid-auto-rows: max-content; }

/* Tarjetas de curso más compactas para ver más cursos por pantalla */
.course-card .band { height: 50px; }
.course-card .band i { font-size: 48px; }
.course-card .cico { width: 46px; height: 46px; font-size: 19px; margin-top: -38px; border-radius: 14px; }
.course-card h3 { font-size: 16px; margin-top: 8px; }
.course-card .flags { margin-top: 8px !important; }
.course-card .meta { margin-top: 8px; }

/* Lista de cursos: acciones solo al pasar el mouse o en el curso elegido; detalle en una línea */
.cr-act { display: none; opacity: 1; }
.curso-row:hover .cr-act, .curso-row.on .cr-act { display: flex; }
@media (hover: none) { .cr-act { display: flex; } }
.cr-main small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Configuración › Cursos y alumnos en pantallas medianas */
.tabla-alumnos.cfg .c-acc { width: 152px; }
@media (min-width: 901px) and (max-width: 1200px) {
    .cfg-cursos { grid-template-columns: minmax(210px, 240px) minmax(0, 1fr); }
}
@media (min-width: 641px) and (max-width: 1280px) {
    .tabla-alumnos.cfg .c-apo { display: none; }
}

/* Celular: las acciones usan todo el ancho de la tarjeta */
@media (max-width: 640px) {
    .tabla-alumnos.prof .c-acc, .tabla-alumnos.cfg .c-acc, .tabla-alumnos.adm .c-acc { width: auto; }
    .tabla-alumnos .actions { gap: 6px; }
}

/* Celular: edad · apoderado · seguimiento en una sola fila para tarjetas más bajas */
@media (max-width: 640px) {
    .tabla-alumnos tr { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 14px; }
    .tabla-alumnos td.c-seg small { margin-top: 1px !important; }
}
