:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1e40af;
  --primary-2: #2563eb;
  --primary-soft: #e0e9ff;
  --accent: #f59e0b;
  --blue: #2563eb;   --blue-soft: #dbeafe;
  --green: #059669;  --green-soft: #d1fae5;
  --amber: #b45309;  --amber-soft: #fef3c7;
  --red: #dc2626;    --red-soft: #fee2e2;
  --gray: #64748b;   --gray-soft: #eef2f7;
  --side-bg: #0f1d4a;
  --side-text: #c7d2fe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 14px;
  --side-w: 248px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, .08), 0 18px 48px rgba(15, 23, 42, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --surface: #131a2e; --surface-2: #182038; --border: #26304a;
    --text: #e6eaf5; --muted: #95a1bd; --primary: #3d5ce0; --primary-2: #7c9bff; --primary-soft: #1d2a55;
    --blue: #7aa7ff; --blue-soft: #1a2a52; --green: #34d399; --green-soft: #0f3a2e;
    --amber: #fbbf24; --amber-soft: #3b2e0e; --red: #f87171; --red-soft: #3d1717;
    --gray: #95a1bd; --gray-soft: #1d2539; --side-bg: #0a0f1f; --side-text: #b4c0e6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-2); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-wrap { display: inline-flex; }

/* ---------- botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px;
  min-height: 40px; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .14s var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn.lg { min-height: 52px; font-size: 17px; padding: 12px 22px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: inherit;
  transition: background-color .15s ease, color .15s ease, transform .14s var(--ease-out);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.sm { width: 32px; height: 32px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=time], input[type=date], input[type=datetime-local],
input[type=number], input[type=search], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 9px 11px; min-height: 40px; outline: none;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.days-check { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.days-check label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.form-error { background: var(--red-soft); color: var(--red); padding: 9px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; margin-bottom: 14px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--border); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: transform .22s var(--ease-out), width .16s var(--ease-out); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch:active .track::after { width: 25px; }
.switch input:checked + .track { transition: background .2s ease; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch:active input:checked + .track::after { transform: translateX(13px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary-2); outline-offset: 2px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden;
  background: radial-gradient(90% 70% at 15% 10%, #2546a8 0%, transparent 60%), radial-gradient(70% 60% at 100% 100%, rgba(245, 158, 11, .22) 0%, transparent 60%),
    linear-gradient(160deg, #13235c 0%, #0b1638 60%, #070d26 100%); }
.login-shell { width: 100%; max-width: 920px; display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 26px; overflow: hidden;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
  animation: loginIn .5s var(--ease-out) both; }
@keyframes loginIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.login-hero { padding: 44px 40px; color: #e8edf8; display: flex; flex-direction: column; align-items: flex-start; position: relative; overflow: hidden; }
.login-hero::after { content: ''; position: absolute; right: -60px; bottom: -60px; width: 260px; height: 260px; border-radius: 50%;
  border: 40px solid rgba(251, 191, 36, .07); pointer-events: none; }
.login-mark { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; background: rgba(255, 255, 255, .95);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .5), 0 0 0 6px rgba(255, 255, 255, .06); }
.login-mark img { width: 64px; height: 64px; object-fit: contain; }
.login-hero h1 { font-size: 30px; line-height: 1.1; margin: 22px 0 4px; color: #fff; letter-spacing: -.02em; }
.login-school { margin: 0; color: #fbbf24; font-weight: 700; }
.login-clock { font-size: 54px; font-weight: 800; color: #fff; margin-top: 28px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1; }
.login-date { color: #93a4c8; margin-top: 6px; }
.login-feats { list-style: none; padding: 30px 0 0; margin: auto 0 0; display: grid; gap: 10px; }
.login-feats li { display: flex; align-items: center; gap: 10px; color: #c9d3ea; font-size: 14px; }
.login-feats li span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #fbbf24; flex: none; }
.login-feats li .ic { width: 16px; height: 16px; }
.login-card { background: var(--surface); padding: 44px 38px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
.login-card > p.muted { margin: 4px 0 24px; }
.login-card-mark { display: none; }
.input-ic { position: relative; display: flex; align-items: center; }
.input-ic > span:first-child { position: absolute; left: 13px; color: var(--muted); display: grid; pointer-events: none; }
.input-ic > span:first-child .ic { width: 18px; height: 18px; }
.input-ic input { width: 100%; padding-left: 42px; min-height: 48px; font-size: 15.5px; border-radius: 12px; }
.input-ic input:focus { box-shadow: 0 0 0 4px rgba(37, 99, 235, .18); }
.input-ic .eye { position: absolute; right: 6px; width: 38px; height: 38px; border: 0; background: none; color: var(--muted); border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.input-ic .eye:hover { background: var(--surface-2); color: var(--text); }
.input-ic .eye .ic { width: 18px; height: 18px; }
.input-ic .eye ~ input, .input-ic input:has(~ .eye) { padding-right: 46px; }
.login-card .btn.lg { margin-top: 6px; border-radius: 12px; }
.login-foot { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  .login { padding: 0; place-items: stretch; }
  .login-shell { grid-template-columns: 1fr; border-radius: 0; border: 0; max-width: none; min-height: 100dvh; box-shadow: none; background: none; }
  .login-hero { padding: 36px 24px 26px; align-items: center; text-align: center; }
  .login-hero::after, .login-feats { display: none; }
  .login-mark { width: 74px; height: 74px; border-radius: 20px; }
  .login-mark img { width: 56px; height: 56px; }
  .login-hero h1 { font-size: 26px; margin-top: 16px; }
  .login-clock { font-size: 40px; margin-top: 16px; }
  .login-card { border-radius: 26px 26px 0 0; padding: 30px 22px 36px; flex: 1; justify-content: flex-start; }
}
@media (max-height: 560px) and (max-width: 760px) { .login-clock, .login-date { display: none; } }

/* ---------- marca (logo y nombre configurables) ---------- */
.brand-logo { object-fit: contain; border-radius: 10px; }
body.has-logo .brand-logo { background: #fff; padding: 3px; }
.top-logo { display: none; width: 30px; height: 30px; object-fit: contain; border-radius: 8px; flex: none; }
body.has-logo .top-logo { background: #fff; padding: 2px; box-shadow: 0 0 0 1px var(--border); }
.brand-card .brand-edit { display: flex; gap: 22px; align-items: flex-start; }
.brand-prev { flex: none; width: 130px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.brand-prev img { width: 110px; height: 110px; object-fit: contain; padding: 12px; border-radius: 22px; background: var(--surface-2); border: 1px dashed var(--border); }
.brand-prev span { font-size: 12px; color: var(--muted); }
.brand-form { flex: 1; min-width: 0; }
.brand-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.brand-btns label.btn { cursor: pointer; }
@media (max-width: 640px) {
  .brand-card .brand-edit { flex-direction: column; align-items: center; }
  .brand-form { width: 100%; }
  .brand-btns > * { flex: 1 1 auto; }
}

/* ---------- confirmación del timbre: repeticiones ---------- */
.ring-pop-wrap { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(2, 6, 23, .5);
  animation: rpFadeIn .18s var(--ease-out); }
.ring-pop-wrap.anchored { display: block; background: rgba(2, 6, 23, .12); }
.ring-pop { width: min(340px, 100%); background: var(--surface); border-radius: 18px; padding: 18px; box-shadow: 0 24px 60px -12px rgba(2, 6, 23, .45), 0 0 0 1px var(--border);
  animation: rpPopIn .22s var(--ease-out); }
.ring-pop-wrap.anchored .ring-pop { position: fixed; width: 320px; transform-origin: top right; }
.ring-pop-wrap.anchored .ring-pop::before { content: ''; position: absolute; top: -7px; right: 34px; width: 14px; height: 14px; background: var(--surface);
  transform: rotate(45deg); box-shadow: -1px -1px 0 var(--border); border-radius: 3px 0 0 0; }
.ring-pop-wrap.leaving { animation: rpFadeOut .16s ease-in forwards; }
.ring-pop-wrap.leaving .ring-pop { animation: rpPopOut .16s ease-in forwards; }
@keyframes rpPopIn { from { opacity: 0; transform: scale(.94) translateY(-4px); } }
@keyframes rpPopOut { to { opacity: 0; transform: scale(.96); } }
@keyframes rpFadeIn { from { opacity: 0; } }
@keyframes rpFadeOut { to { opacity: 0; } }
.rp-head { display: flex; gap: 12px; align-items: center; }
.rp-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: #fef3c7; color: #b45309; flex: none; }
.rp-ic .ic { width: 22px; height: 22px; }
.rp-head b { display: block; font-size: 17px; }
.rp-head small { color: var(--muted); font-size: 13px; }
.rp-lbl { display: block; margin: 16px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rp-btns { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.rp-btns button { min-height: 52px; border-radius: 12px; font: inherit; font-weight: 800; cursor: pointer; border: 1px solid var(--border);
  transition: transform .14s var(--ease-out), background .14s var(--ease-out), filter .14s var(--ease-out); }
.rp-btns button:active { transform: scale(.96); }
.rp-btns .rp-n { font-size: 22px; background: #f59e0b; color: #1f1300; border-color: transparent; }
.rp-btns .rp-n:hover { filter: brightness(1.06); }
.rp-btns button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.rp-btns .rp-cancel { background: var(--surface-2); color: var(--text); font-size: 15px; }
.rp-btns .rp-cancel:hover { background: var(--border); }
@media (max-width: 640px) {
  .ring-pop { width: min(360px, 100%); padding: 20px; }
  .rp-btns button { min-height: 58px; }
}
@media (prefers-reduced-motion: reduce) { .login-shell, .ring-pop, .ring-pop-wrap { animation: none !important; } }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: var(--side-w); background: var(--side-bg); color: var(--side-text); flex: none;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px 14px; }
.brand-logo { width: 38px; height: 38px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { color: #fff; font-size: 16px; }
.brand-text small { color: var(--side-text); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-text);
  text-decoration: none; border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; font-size: 14.5px; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; }
.nav-item .count { margin-left: auto; background: var(--accent); color: #111; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 7px; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 6px 10px; color: #fff; }
.me small { display: block; color: var(--side-text); }
.scrim { display: none; }
.nav-item { transition: background-color .15s ease, color .15s ease; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); min-height: 62px;
}
.menu-btn { display: none; }
.view-title { font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; }
.top-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; }
.conn.on { background: var(--green); }
.sound-pill { border: 0; cursor: pointer; background: var(--green-soft); color: var(--green); font-weight: 700; font-size: 12px; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.sound-pill.off { background: var(--red-soft); color: var(--red); }
.sound-banner { display: block; width: 100%; border: 0; cursor: pointer; background: var(--accent); color: #1a1205; font-weight: 700; padding: 11px 16px; font-size: 14.5px; text-align: center; }
.sound-banner:hover { background: #fbbf24; }
.sound-banner a { color: #1a1205; margin-left: 8px; font-weight: 800; white-space: nowrap; }
.update-bar { display: block; width: 100%; border: 0; cursor: pointer; background: var(--primary-soft); color: var(--primary-2); font-weight: 700; padding: 7px 16px; font-size: 13px; text-align: center; }
.ring-btn { background: var(--accent); border-color: var(--accent); color: #1a1205; }
.ring-btn:hover { background: #fbbf24; }
.badge { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.view { padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1 1 200px; }
.tabs { display: inline-flex; background: var(--gray-soft); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .ic { width: 34px; height: 34px; opacity: .5; display: block; margin: 0 auto 8px; }

/* ---------- chips de estado ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gray { background: var(--gray-soft); color: var(--gray); }

/* ---------- panel en vivo ---------- */
/* Encabezado con la hora: compacto (reloj + próximo timbre arriba, «Ahora» debajo en pantallas angostas) */
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 20px; align-items: center; padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary) 0%, #3557d6 60%, #4f46e5 100%); color: #fff; border: 0; }
.hero .muted, .hero-sub { color: #c7d2fe; }
.hero-sub { margin-top: 4px; }
.hero-clock { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1; white-space: nowrap; }
.hero-date { margin-top: 3px; color: #c7d2fe; font-weight: 500; font-size: 13px; }
.hero .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #c7d2fe; font-weight: 700; }
.hero-now .name { font-size: 20px; font-weight: 800; margin: 1px 0 6px; line-height: 1.2; }
.progress { height: 8px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 1s linear; border-radius: 99px; }
.card .progress { background: var(--gray-soft); }
.hero-next { text-align: right; }
.hero-next .count { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero .progress { height: 6px; }

/* «Mi día»: fichas compactas */
.midia .card { padding: 12px 14px; }
.midia .card-head { margin-bottom: 8px; }
.midia .card-head h3 { font-size: 15px; }
.midia .grid2 { gap: 12px; }
.midia .grid2.row-gap { margin-top: 12px; }
.midia .hero { margin-bottom: 12px; }
.midia .btn.lg { min-height: 40px; font-size: 14.5px; padding: 8px 14px; }
.midia .empty { padding: 10px 6px; font-size: 13.5px; }
.midia .empty .ic { width: 24px; height: 24px; margin-bottom: 4px; }
.midia .trow { padding: 8px; }
.midia .rem { padding: 8px 10px; margin-bottom: 6px; }
.midia .tsd { gap: 4px; }
.midia .tsd-row { min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.show-sm { display: none; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .att-btns { flex-wrap: nowrap; gap: 8px; }
  .att-btns .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
}
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { font-size: 28px; display: block; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat.blue b { color: var(--blue); } .stat.green b { color: var(--green); } .stat.red b { color: var(--red); } .stat.amber b { color: var(--amber); }

.tlist { display: flex; flex-direction: column; gap: 8px; }
.trow { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; text-align: left; width: 100%; }
.trow:hover { border-color: var(--primary-2); }
.trow .info { flex: 1; min-width: 0; }
.trow .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .info small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.room-badge { background: var(--primary); color: #fff; font-weight: 800; border-radius: 9px; padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; flex: none; position: relative; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); background: #94a3b8; }
.avatar .dot.on { background: #22c55e; }

.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.room-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); text-align: left; width: 100%; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
button.room-card { cursor: pointer; font: inherit; color: inherit; }
.room-card.busy { border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: var(--blue-soft); }
.room-card .room-name { display: block; font-size: 15px; }
.room-card .room-free { color: var(--muted); }
.room-teacher { display: flex; align-items: center; gap: 9px; min-width: 0; }
.room-teacher > span:last-child { min-width: 0; }
.room-teacher b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-teacher small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline { display: flex; flex-direction: column; gap: 6px; }
.tl { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.tl .time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: 14px; }
.tl.past { opacity: .55; }
.tl.current { border-color: var(--accent); background: var(--amber-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.tl.break { background: var(--gray-soft); }
.tl .what b { display: block; }
.tl .what small { color: var(--muted); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.actions { text-align: right; white-space: nowrap; }
.tbl .id-col { width: 70px; }
.room-id { display: inline-block; min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 12.5px; color: var(--muted); background: var(--gray-soft); border-radius: 7px; padding: 2px 8px; }
.tbl input, .tbl select { min-height: 36px; padding: 6px 8px; }

/* ---------- grilla de horario ---------- */
.sched { width: 100%; border-collapse: separate; border-spacing: 6px; min-width: 720px; }
.sched th { font-size: 13px; color: var(--muted); font-weight: 700; padding: 6px; }
.sched th.ptime { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.sched th.ptime small { display: block; font-weight: 500; }
.sched td { height: 64px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border); padding: 7px 8px; vertical-align: top; font-size: 13px; }
.sched td.filled { background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary-2) 35%, transparent); }
.sched td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.sched td.editable { cursor: pointer; }
.sched td.editable:hover { border-color: var(--primary-2); }
.sched td.add { color: var(--muted); text-align: center; vertical-align: middle; font-size: 20px; }
.sched td b { display: block; font-size: 13px; }
.sched td small { color: var(--muted); display: block; line-height: 1.3; }
.sched tr.break td { height: auto; background: var(--gray-soft); border: 0; text-align: center; color: var(--muted); font-weight: 700; padding: 6px; }
.sched-scroll { overflow-x: auto; }
.sched-list { display: none; }
.day-block { margin-bottom: 16px; }
.day-block h4 { margin: 0 0 8px; font-size: 15px; }
.day-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 6px; }
.day-item .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; color: var(--muted); width: 150px; flex: none; }
.day-item .w { flex: 1; min-width: 0; }
.day-item.filled { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary-2) 35%, transparent); }
.day-item.break { justify-content: center; color: var(--muted); font-weight: 600; background: var(--gray-soft); }

/* ---------- horario del docente (hora · materia · salón) ---------- */
/* Cada materia trae su tono en --h; los colores se derivan de él (claro y oscuro). */
:root { --tint-l: 94%; --tint-s: 88%; --ink-l: 26%; --ink-s: 65%; --tag-l: 44%; }
@media (prefers-color-scheme: dark) { :root { --tint-l: 19%; --tint-s: 42%; --ink-l: 86%; --ink-s: 80%; --tag-l: 36%; } }

/* Vista por día */
.tsd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; font-size: 16px; }
.tsd { display: flex; flex-direction: column; gap: 6px; }
.tsd-row {
  --h: 220;
  display: grid; grid-template-columns: 158px 1fr auto; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 12px; min-height: 52px;
  background: hsl(var(--h) var(--tint-s) var(--tint-l));
  border: 1px solid hsl(var(--h) 60% 50% / .35);
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.tsd-time b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; color: hsl(var(--h) var(--ink-s) var(--ink-l)); white-space: nowrap; }
.tsd-time small { display: block; font-size: 12px; color: hsl(var(--h) 20% 50%); }
.tsd-time .now-tag { margin-top: 4px; }
.tsd-subj { font-weight: 800; font-size: 15.5px; line-height: 1.2; color: hsl(var(--h) var(--ink-s) var(--ink-l)); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tsd-room { display: inline-flex; align-items: center; gap: 5px; background: hsl(var(--h) 70% var(--tag-l)); color: #fff; font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; box-shadow: 0 1px 3px rgba(15, 23, 42, .18); }
.tsd-room .ic { width: 15px; height: 15px; }
.tsd-free, .tsd-break { background: var(--surface-2); border-color: var(--border); min-height: 44px; }
.tsd-free .tsd-time b, .tsd-break .tsd-time b { color: var(--text); }
.tsd-free .tsd-time small, .tsd-break .tsd-time small { color: var(--muted); }
.tsd-free .tsd-subj, .tsd-break .tsd-subj { grid-column: 2 / -1; color: var(--muted); font-weight: 600; font-size: 14px; }
.tsd-break { background: var(--gray-soft); }
.tsd-row.is-past { opacity: .42; }
.tsd-row.is-now { outline: 3px solid var(--accent); outline-offset: 0; box-shadow: 0 8px 20px rgba(15, 23, 42, .16); transform: scale(1.012); }

/* Vista semanal */
.ts-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table.ts { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 680px; }
.ts th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 11px 8px; text-align: center; border-bottom: 1px solid var(--border); }
.ts th.ts-h { text-align: left; padding-left: 12px; }
.ts th.is-today { background: var(--primary-soft); color: var(--primary-2); }
.ts th small { display: block; text-transform: none; letter-spacing: 0; font-size: 11px; margin-top: 2px; }
.ts td { padding: 5px; text-align: center; vertical-align: middle; border-bottom: 1px solid var(--border); }
.ts tbody tr:last-child td { border-bottom: 0; }
.ts td.ts-time { text-align: left; white-space: nowrap; padding: 8px 12px; position: sticky; left: 0; z-index: 1; background: var(--surface); border-right: 1px solid var(--border); }
.ts td.ts-time b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.ts td.ts-time small { display: block; color: var(--muted); font-size: 12px; }
.ts td.is-today { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.ts-cell { --h: 220; text-align: left; border-radius: 9px; padding: 6px 8px; background: hsl(var(--h) var(--tint-s) var(--tint-l)); border: 1px solid hsl(var(--h) 60% 50% / .35); }
.ts-subj { font-weight: 800; font-size: 13.5px; line-height: 1.2; color: hsl(var(--h) var(--ink-s) var(--ink-l)); }
.ts-room { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; background: hsl(var(--h, 220) 70% var(--tag-l)); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.ts-room .ic { width: 13px; height: 13px; }
.ts-free { color: var(--muted); font-size: 12.5px; opacity: .7; }
.ts tr.ts-break td { background: var(--gray-soft); color: var(--muted); font-weight: 600; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.ts tr.is-now td { background: var(--amber-soft); }
.ts tr.is-now td.ts-time { background: var(--amber-soft); box-shadow: inset 5px 0 0 var(--accent); }
.ts td.is-current .ts-cell { outline: 3px solid var(--accent); outline-offset: 0; box-shadow: 0 6px 16px rgba(15, 23, 42, .16); }
.now-tag { display: inline-block; margin-top: 5px; background: var(--accent); color: #1a1205; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.day-chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.day-chips button { flex: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.day-chips button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
/* «Mi día» comparte fila con los recordatorios en computador: columna de hora más angosta */
.grid2 .tsd-row { grid-template-columns: 128px 1fr auto; }
.nw { white-space: nowrap; }
.ts-foot { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
/* Se adapta al ancho de su recuadro (celular o media columna): materia arriba y salón debajo */
.tsd { container-type: inline-size; }
@container (max-width: 520px) {
  .tsd-row, .grid2 .tsd-row { grid-template-columns: 86px 1fr; column-gap: 10px; row-gap: 4px; padding: 8px 10px; }
  .tsd-row:not(.tsd-free):not(.tsd-break) .tsd-time { grid-row: span 2; }
  .tsd-time b { white-space: normal; font-size: 12.5px; }
  .tsd-subj { font-size: 14.5px; white-space: normal; overflow: visible; }
  .tsd-room { grid-column: 2; justify-self: start; font-size: 12px; padding: 4px 10px; }
}
@media print { .tsd-row, .ts-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- recordatorios: calendario del mes + pendientes de la semana ---------- */
.rem-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.rem-layout > .card { margin-bottom: 0; }

/* Calendario */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title { flex: 1; min-width: 0; }
.cal-title h3 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.cal-title h3 span { color: var(--muted); font-weight: 600; }
.cal-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cal-stat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); }
.cal-stat i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cal-stat.late { background: var(--red-soft); color: var(--red); }
.cal-stat.done { background: var(--gray-soft); color: var(--gray); }
.cal-nav { display: inline-flex; align-items: center; gap: 2px; background: var(--gray-soft); border-radius: 12px; padding: 3px; }
.cal-nav button { border: 0; background: transparent; color: var(--text); height: 34px; min-width: 34px; padding: 0 10px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 700; font-size: 13px; }
.cal-nav button:hover { background: var(--surface); box-shadow: var(--shadow); }
.cal-nav .ic { width: 18px; height: 18px; }
.flip { display: inline-flex; transform: scaleX(-1); }

.cal-wrap { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.cal-dow { background: var(--surface-2); text-align: center; font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 9px 0; }
.cal-dow.we { color: var(--primary-2); }
.cal-day { position: relative; min-height: 86px; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 5px 6px 6px; text-align: left;
  font: inherit; color: inherit; cursor: pointer; border: 0; border-radius: 0; background: var(--surface); transition: background .15s; }
.cal-day.we { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.cal-day:hover { background: var(--surface-2); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }
.cal-num { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 13px; flex: none; }
.cal-day.today .cal-num { background: var(--accent); color: #1a1205; }
.cal-day.out .cal-num { color: var(--muted); opacity: .45; }
.cal-day.out .cal-chip { opacity: .55; }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; line-height: 1.3; padding: 2px 6px; border-radius: 6px;
  background: var(--blue-soft); color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.cal-chip.late { background: var(--red-soft); color: var(--red); }
.cal-chip.done { background: var(--gray-soft); color: var(--gray); text-decoration: line-through; }
.cal-more { font-size: 11px; font-weight: 700; color: var(--muted); padding-left: 2px; }
.cal-dots { display: none; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.cal-dots i.late { background: var(--red); }
.cal-dots i.done { background: var(--gray); }

/* Barra de la semana (compacta) */
.rem-week { position: sticky; top: 78px; max-height: calc(100dvh - 96px); overflow-y: auto; padding: 14px; }
.wk-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wk-head h3 { font-size: 16px; }
.wk-head small { color: var(--muted); font-size: 12px; }
.wk-total { background: var(--primary); color: #fff; font-weight: 800; font-size: 12px; border-radius: 999px; padding: 2px 9px; }
.wk-late { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 12.5px;
  background: var(--red-soft); color: var(--red); border-radius: 9px; padding: 7px 10px; margin-bottom: 10px; }
.wk-day { position: relative; border-left: 2px solid var(--border); padding: 0 0 8px 12px; margin-left: 4px; }
.wk-day::before { content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-2); }
.wk-day.today { border-left-color: var(--accent); }
.wk-day.today::before { background: var(--accent); }
.wk-day:last-child { padding-bottom: 0; }
.wk-day h4 { margin: 0 0 5px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.wk-day.today h4 { color: var(--amber); }
.wk-item { display: flex; align-items: center; gap: 7px; padding: 5px 4px 5px 8px; margin-bottom: 4px; cursor: pointer;
  border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.wk-item:hover { border-color: var(--primary-2); }
.wk-item .t { font-weight: 800; font-size: 11.5px; color: var(--primary-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-item b { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-check { flex: none; width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.wk-check:hover { background: var(--green-soft); color: var(--green); }
.wk-check .ic { width: 16px; height: 16px; }
.wk-none { font-size: 13px; color: var(--muted); padding: 6px 2px; }
.wk-sep { margin: 4px 0 10px; padding: 6px 10px; border-radius: 8px; background: var(--gray-soft); color: var(--muted); font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

@media (max-width: 1050px) {
  .rem-layout { grid-template-columns: 1fr; }
  .rem-week { order: -1; position: static; max-height: none; }
}
@media (max-width: 640px) {
  .cal-title h3 { font-size: 19px; }
  .cal-day { min-height: 50px; padding: 4px 2px; align-items: center; }
  .cal-num { width: 24px; height: 24px; font-size: 12.5px; }
  .cal-chip, .cal-more { display: none; }
  .cal-dots { display: flex; gap: 3px; justify-content: center; }
}

/* ---------- reconectando ---------- */
.offline { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--bg); }
.offline h2 { font-size: 22px; margin: 14px 0 6px; }
.offline p { color: var(--muted); max-width: 360px; margin: 0 auto; }
.offline img { animation: pulse 1.6s ease-in-out infinite; }

/* ---------- horas y audios ---------- */
/* Horas de la jornada: una línea compacta por hora */
.period-help { margin: -8px 0 10px; }
.period-list { display: flex; flex-direction: column; gap: 4px; }
.period { display: grid; grid-template-columns: 170px 92px 82px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 42px;
  padding: 4px 6px 4px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); line-height: 1.25; }
.period.is-break { background: var(--amber-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.period .t { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13.5px; }
.period .pn { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period .chip { justify-self: start; padding: 2px 8px; font-size: 11.5px; }
.period .pa { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period .btns { display: flex; gap: 2px; }
.period .btns .ic { width: 17px; height: 17px; }
.audio-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--surface-2); }
.audio-item .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop { display: block; border: 2px dashed var(--border); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 14px; }
.drop.over { border-color: var(--primary-2); background: var(--primary-soft); }

/* ---------- recordatorios ---------- */
.rem { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--surface-2); align-items: flex-start; }
.rem.done { opacity: .6; }
.rem.done .rt { text-decoration: line-through; }
.rem .when { text-align: center; background: var(--primary-soft); color: var(--primary-2); border-radius: 10px; padding: 6px 8px; min-width: 64px; flex: none; }
.rem .when b { display: block; font-size: 20px; line-height: 1; }
.rem .when small { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.rem .body { flex: 1; min-width: 0; }
.rem .rt { font-weight: 700; }
.rem p { margin: 3px 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.rem .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.rem.overdue .when { background: var(--red-soft); color: var(--red); }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 320px 1fr; gap: 18px; height: calc(100dvh - 62px - 40px); min-height: 420px; }
.chat .card { margin: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.conv-search { padding: 12px; border-bottom: 1px solid var(--border); }
.convs { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; align-items: center; padding: 11px 14px; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; border-bottom: 1px solid var(--border); }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--primary-soft); }
.conv .info { flex: 1; min-width: 0; }
.conv .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.conv .info small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .unread { background: var(--primary); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 7px; }
.group-av { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.conv-head .back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.msg { max-width: min(78%, 560px); padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: var(--primary); color: #fff; border-color: var(--primary); }
.msg .who { font-size: 12px; font-weight: 700; color: var(--primary-2); margin-bottom: 1px; }
.msg .tm { font-size: 11px; opacity: .65; text-align: right; margin-top: 2px; }
.msg-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--gray-soft); border-radius: 999px; padding: 2px 10px; margin: 8px 0; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.composer textarea { min-height: 42px; max-height: 140px; resize: none; }

/* ---------- estación de timbre ---------- */
.station { text-align: center; }
.station .big-clock { font-size: clamp(56px, 13vw, 150px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -2px; line-height: 1; }
.station .now-name { font-size: clamp(22px, 4vw, 40px); font-weight: 800; margin: 14px 0 6px; }
.station .next { font-size: clamp(16px, 2.6vw, 24px); color: var(--muted); }
.station .next b { color: var(--text); font-variant-numeric: tabular-nums; }
.station .progress { max-width: 640px; margin: 16px auto; height: 12px; }
.station-off { background: var(--amber-soft); border: 2px solid var(--accent); }
.station-on { border: 2px solid var(--green); }
.vol { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.vol input { width: 220px; accent-color: var(--primary); }
.log-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; }
.log-item:last-child { border-bottom: 0; }
.log-item .t { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; width: 128px; }

.bell-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; text-align: center; padding: 20px; cursor: pointer; color: #fff;
  background: radial-gradient(60vmax 60vmax at 50% 42%, rgba(30, 52, 150, .93), rgba(7, 12, 34, .97));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: fadein .22s ease; transition: opacity .2s ease; }
.bell-overlay.leaving { opacity: 0; }
.bell-stage { animation: stageIn .5s var(--ease-out); }
.bell-art { position: relative; width: 168px; height: 168px; margin: 0 auto 6px; display: grid; place-items: center; }
.bell-art .wave { position: absolute; inset: 22px; border-radius: 50%; border: 3px solid rgba(251, 191, 36, .75); opacity: 0;
  animation: wave 1.8s var(--ease-out) infinite; }
.bell-art .wave:nth-child(2) { animation-delay: .6s; }
.bell-art .wave:nth-child(3) { animation-delay: 1.2s; }
.bell-svg { position: relative; width: 112px; height: 112px; fill: #fbbf24; stroke: #fbbf24; stroke-width: 1.5; stroke-linejoin: round;
  transform-origin: 50% 14%; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); animation: bellSwing 1.6s var(--ease-out) infinite; }
.bell-overlay h2 { font-size: clamp(28px, 6vw, 60px); margin: 10px 0 6px; letter-spacing: -.02em; text-wrap: balance; }
.bell-overlay p { color: #c7d2fe; font-size: 18px; margin: 0; }
@keyframes wave { 0% { transform: scale(.75); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
/* Vaivén que se va apagando, como una campana real después del golpe */
@keyframes bellSwing { 0% { transform: rotate(0); } 10% { transform: rotate(-20deg); } 22% { transform: rotate(16deg); } 34% { transform: rotate(-11deg); }
  46% { transform: rotate(7deg); } 58% { transform: rotate(-4deg); } 70% { transform: rotate(2deg); } 82%, 100% { transform: rotate(0); } }
@keyframes stageIn { from { transform: scale(.92); opacity: 0; filter: blur(6px); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- modal, toasts, notificaciones ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(2, 6, 23, .55); display: grid; place-items: center; padding: 16px;
  animation: fadein .2s ease; transition: opacity .18s ease; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.35);
  animation: modalIn .26s var(--ease-out); transition: transform .18s ease, opacity .18s ease; }
.modal-wrap.leaving { opacity: 0; }
.modal-wrap.leaving .modal { transform: scale(.97); opacity: 0; }
@keyframes modalIn { from { transform: translateY(8px) scale(.96); opacity: 0; } }
@keyframes sheetIn { from { transform: translateY(100%); } }
.modal.wide { max-width: 760px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal header h3 { font-size: 18px; }
.modal-body { padding: 10px 18px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; flex-wrap: wrap; }
.modal footer .left { margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.chips button:hover { border-color: var(--primary-2); }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; margin-bottom: 12px; }
.notice.warn { background: var(--amber-soft); color: var(--amber); }
.notice.ok { background: var(--green-soft); color: var(--green); }
.notice.info { background: var(--primary-soft); color: var(--primary-2); }

.toasts { position: fixed; top: 74px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { --tc: var(--primary-2); pointer-events: auto; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px 11px 32px; box-shadow: var(--shadow-lg); cursor: pointer;
  animation: toastIn .32s var(--ease-out); transition: opacity .16s ease, transform .16s ease; }
.toast::before { content: ""; position: absolute; left: 13px; top: 17px; width: 9px; height: 9px; border-radius: 50%; background: var(--tc); }
.toast.leaving { opacity: 0; transform: translateX(16px) scale(.98); }
.toast b { display: block; }
.toast p { margin: 2px 0 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.toast.t-bell { --tc: var(--accent); }
.toast.t-error { --tc: var(--red); }
.toast.t-ok { --tc: var(--green); }
.toast.t-chat { --tc: #8b5cf6; }
.toast.t-reminder { --tc: #ec4899; }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } }
@keyframes toastUp { from { transform: translateY(100%); opacity: 0; } }

.notif-panel { position: fixed; top: 66px; right: 16px; z-index: 60; width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - 90px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 14px; }
.notif-item { padding: 9px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.notif-item small { color: var(--muted); }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 > .card:last-child { grid-column: 1 / -1; }
  .hero { grid-template-columns: 1fr 1fr; }
  .hero-now { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .32s var(--ease-drawer); box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .app.menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-drawer); }
  .app.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .top-logo { display: block; }
  .topbar { padding: 8px 12px; }
  .view { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 62px - 32px); }
  .chat .conv-pane { display: none; }
  .chat.has-conv .conv-list { display: none; }
  .chat.has-conv .conv-pane { display: flex; }
  .conv-head .back { display: inline-flex; }
}

/* ---------- celular ---------- */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .view { padding: 12px; }
  .card { padding: 14px; border-radius: 12px; margin-bottom: 12px; }
  .grid3 { grid-template-columns: 1fr; gap: 12px; }
  .grid2 { gap: 12px; }
  .hero { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 14px; }
  .hero-now { grid-column: 1 / -1; order: 3; }
  .hero-next { text-align: right; order: 2; }
  .hero-clock { font-size: 30px; }
  .hero-date { font-size: 12px; }
  .hero-next .count { font-size: 21px; }
  .hero-now .name { font-size: 18px; }
  .stats { gap: 10px; margin-bottom: 12px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 22px; }
  .top-clock, .ring-text { display: none; }
  .ring-btn { padding: 8px 10px; }
  .view-title { font-size: 17px; }
  .tl { grid-template-columns: 1fr auto; }
  .tl .time { grid-column: 1 / -1; font-size: 12px; }
  .period { grid-template-columns: auto auto 1fr auto; gap: 2px 8px; padding: 6px 4px 6px 10px; }
  .period .t { grid-column: 1 / 4; }
  .period .pa { grid-column: 1 / 4; }
  .period .btns { grid-column: 4; grid-row: 1 / 4; }
  .sched-scroll.responsive { display: none; }
  .sched-list { display: block; }
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92dvh; max-width: none; animation: sheetIn .36s var(--ease-drawer); }
  .modal-wrap.leaving .modal { transform: translateY(40%); opacity: 0; }
  .toasts { top: auto; bottom: 16px; right: 16px; left: 16px; width: auto; }
  .toast { animation-name: toastUp; }
  .toast.leaving { transform: translateY(12px) scale(.98); }
  .chat { height: calc(100dvh - 62px - 24px); }
  .msg { max-width: 88%; }

  /* tablas como tarjetas */
  .tbl.stack-sm thead { display: none; }
  .tbl.stack-sm, .tbl.stack-sm tbody, .tbl.stack-sm tr, .tbl.stack-sm td { display: block; width: 100%; }
  .tbl.stack-sm tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .tbl.stack-sm td { border: 0; padding: 5px 12px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
  .tbl.stack-sm td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; flex: none; }
  .tbl.stack-sm td.actions { justify-content: flex-end; }
  .tbl.stack-sm td.actions::before { content: none; }
  .tbl.stack-sm td > input, .tbl.stack-sm td > select { max-width: 60%; }
  .table-wrap:has(.stack-sm) { border: 0; }
}

@media print {
  .sidebar, .topbar, .toolbar, .btn, .icon-btn { display: none !important; }
  .view { padding: 0; }
  .card { box-shadow: none; }
}

/* ======================================================================
   Movimiento y pulido
   Herramienta de uso diario: movimiento corto y con propósito (respuesta,
   cambio de estado, continuidad). El momento principal es la alerta del timbre.
   ====================================================================== */

/* Superficies del navegador con la paleta de la aplicación */
::selection { background: color-mix(in srgb, var(--primary-2) 28%, transparent); }
input, textarea { caret-color: var(--primary-2); }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.sidebar :focus-visible { outline-color: #fff; outline-offset: -2px; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
.sidebar { scrollbar-color: rgba(255, 255, 255, .18) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* Estados al pasar el mouse: solo con mouse (en pantallas táctiles quedaban «pegados») */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--surface-2); }
  .btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #fff); border-color: color-mix(in srgb, var(--primary) 88%, #fff); }
  .btn.danger.solid:hover { background: color-mix(in srgb, var(--red) 88%, #000); }
  .icon-btn:hover { background: var(--surface-2); }
  .day-chips button:not(.active):hover, .tabs button:not(.active):hover { color: var(--text); }
}
.btn.primary { box-shadow: 0 1px 2px rgba(15, 23, 42, .14), 0 4px 10px rgba(15, 23, 42, .12); }
.btn.primary:disabled { box-shadow: none; }

/* Todo lo que se toca responde al presionar */
.trow, button.room-card, .conv, .wk-item, .day-chips button, .tabs button, .chips button, .days-check label, .cal-day {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .14s var(--ease-out);
}
.trow:active, button.room-card:active, .wk-item:active, .day-chips button:active, .tabs button:active, .chips button:active { transform: scale(.98); }
.cal-day:active { background: var(--gray-soft); }

/* Entrada de cada sección (solo al navegar; las actualizaciones automáticas no se animan) */
.view.enter > * { animation: viewIn .34s var(--ease-out) both; }
.view.enter > :nth-child(2) { animation-delay: .04s; }
.view.enter > :nth-child(3) { animation-delay: .08s; }
.view.enter > :nth-child(4) { animation-delay: .12s; }
.view.enter > :nth-child(n+5) { animation-delay: .16s; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
/* Las listas aparecen en una cascada breve (máximo ~0,25 s en total) */
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > * { animation: itemIn .3s var(--ease-out) both; animation-delay: .24s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(1) { animation-delay: .03s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(2) { animation-delay: .06s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(3) { animation-delay: .09s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(4) { animation-delay: .12s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(5) { animation-delay: .15s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(6) { animation-delay: .18s; }
.view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > :nth-child(7) { animation-delay: .21s; }
@keyframes itemIn { from { opacity: 0; transform: translateY(6px); } }

/* Paneles y barras que aparecen */
.notif-panel:not([hidden]) { animation: popIn .18s var(--ease-out); transform-origin: top right; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.96); } }
.sound-banner:not([hidden]), .update-bar { animation: barIn .3s var(--ease-out); }
@keyframes barIn { from { opacity: 0; clip-path: inset(0 0 100% 0); } }

/* Chat: el mensaje nuevo entra desde su lado */
.msg-new { animation: msgIn .28s var(--ease-out); transform-origin: bottom left; }
.msg-new.mine { transform-origin: bottom right; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* Botón «Tocar timbre»: la campana se balancea y una onda sale del botón cuando suena */
.ring-btn { position: relative; }
.ring-btn.ringing .ic { animation: bellSwing 1.4s var(--ease-out); transform-origin: 50% 15%; }
.ring-btn.ringing::after { content: ""; position: absolute; inset: -2px; border-radius: 12px; border: 2px solid var(--accent); pointer-events: none;
  animation: ringOut .9s var(--ease-out) 2; }
@keyframes ringOut { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.18, 1.5); } }

/* Botón de sonido con ícono dibujado */
.sound-pill { display: inline-flex; align-items: center; gap: 5px; transition: background-color .2s ease, color .2s ease, transform .14s var(--ease-out); }
.sound-pill .ic { width: 15px; height: 15px; }
.sound-pill:active { transform: scale(.95); }
.sound-banner .ic { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }

/* Indicador de conexión: el cambio de estado se nota */
.conn { transition: background-color .3s ease, box-shadow .3s ease; }

/* Menos movimiento si el sistema lo pide: solo fundidos y cambios de color */
@media (prefers-reduced-motion: reduce) {
  .view.enter > *, .view.enter :is(.tlist, .tsd, .rooms-grid, .period-list, .timeline) > *,
  .modal, .toast, .notif-panel:not([hidden]), .msg-new, .bell-stage, .sound-banner:not([hidden]), .update-bar {
    animation: fadein .2s ease both !important;
  }
  .bell-art .wave, .bell-svg, .now-tag, .offline img, .ring-btn.ringing .ic, .ring-btn.ringing::after { animation: none !important; }
  .sidebar, .toast, .modal, .tsd-row { transition-property: opacity, background-color, color !important; }
  .modal-wrap.leaving .modal, .toast.leaving { transform: none !important; }
}
.tl .time { white-space: nowrap; }
.midia .solo > .card { margin-bottom: 0; }

/* ---------- anuncios ---------- */
.ann-grid { margin-bottom: 18px; }
.ann-card { display: flex; flex-direction: column; }
.ann-card textarea { min-height: 120px; }
.ann-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: auto; padding-top: 12px; }
.ann-rep { width: auto; margin-right: auto; }
/* Grabadora: botón redondo; el anillo crece con el volumen de la voz mientras graba */
.rec { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 14px; text-align: center; }
.rec-btn { position: relative; width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--red); color: #fff; box-shadow: 0 2px 4px rgba(15, 23, 42, .18), 0 10px 24px rgba(15, 23, 42, .16);
  transition: transform .14s var(--ease-out), background-color .2s ease; }
.rec-btn:active { transform: scale(.95); }
.rec-btn .ic { width: 38px; height: 38px; }
.rec-level { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--red) 55%, transparent); opacity: 0;
  transition: transform .08s linear, opacity .2s ease; pointer-events: none; }
.rec-ico { display: grid; place-items: center; transition: opacity .15s ease, transform .2s var(--ease-out); grid-area: 1 / 1; }
.rec-ico-stop { opacity: 0; transform: scale(.7); }
.rec[data-state="rec"] .rec-level { opacity: 1; }
.rec[data-state="rec"] .rec-ico-mic { opacity: 0; transform: scale(.7); }
.rec[data-state="rec"] .rec-ico-stop { opacity: 1; transform: none; }
.rec[data-state="done"] .rec-btn { background: var(--gray); }
.rec-time { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.rec[data-state="rec"] .rec-time { color: var(--red); }
.rec audio { width: 100%; max-width: 360px; margin-top: 6px; }
/* Historial */
.ann-list { display: flex; flex-direction: column; gap: 6px; }
.ann-item { display: flex; align-items: center; gap: 12px; padding: 9px 8px 9px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.ann-kind { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); }
.ann-kind.voice { background: var(--red-soft); color: var(--red); }
.ann-kind .ic { width: 18px; height: 18px; }
.ann-body { flex: 1; min-width: 0; }
.ann-body b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ann-body small { display: block; color: var(--muted); font-size: 12.5px; }
.ann-btns { display: flex; gap: 2px; flex: none; }
/* Alerta del anuncio en la Pantalla del timbre */
.ann-svg { position: relative; width: 100px; height: 100px; fill: none; stroke: #fbbf24; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.ann-text { max-width: 760px; margin: 0 auto 10px !important; font-size: clamp(18px, 2.6vw, 28px) !important; color: #fff !important; line-height: 1.35; text-wrap: balance; }
@media (max-width: 640px) {
  .ann-item { flex-wrap: wrap; }
  .ann-btns { margin-left: auto; }
  .rec-btn { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) { .rec-level { transition: opacity .2s ease; } }
/* Aviso de anuncio pendiente (el navegador pidió un toque para reproducirlo) */
.ann-tap { position: fixed; left: 50%; bottom: 20px; z-index: 95; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px); padding: 12px 20px 12px 16px; border: 0; border-radius: 999px; cursor: pointer; text-align: left;
  background: var(--accent); color: #1a1205; font: inherit; box-shadow: 0 4px 10px rgba(15, 23, 42, .2), 0 16px 40px rgba(15, 23, 42, .22);
  animation: tapIn .4s var(--ease-out); }
.ann-tap .ic { width: 26px; height: 26px; flex: none; }
.ann-tap b { display: block; font-size: 15px; }
.ann-tap small { display: block; font-size: 13px; opacity: .8; }
.ann-tap:active { transform: translateX(-50%) scale(.97); }
@keyframes tapIn { from { opacity: 0; transform: translate(-50%, 24px); } }
@media (prefers-reduced-motion: reduce) { .ann-tap { animation: fadein .2s ease; } }
/* Selector de voz (femenina / masculina) */
.voice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.seg { display: inline-flex; background: var(--gray-soft); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--muted);
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.howto { margin: 2px 0 6px; font-size: 13.5px; color: var(--muted); }
.howto summary { cursor: pointer; font-weight: 700; color: var(--primary-2); }
.howto ol { margin: 8px 0 0; padding-left: 20px; }
.howto li { margin-bottom: 4px; }

/* Sedes */
.sede-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sede-row input { flex: 1; min-width: 0; }
.sede-row .chip { white-space: nowrap; }

/* Asistencia: barra compacta con combo de vista */
.att-bar { gap: 6px 8px; align-items: center; }
.att-bar select, .att-bar input[type=date] { width: auto; min-height: 32px; height: 32px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
.att-bar .att-mode { font-weight: 700; color: var(--primary, #1e40af); }
.att-bar #attSede, .att-bar #repSede { max-width: 180px; }
.att-f { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.att-f.check input { width: 16px; height: 16px; }
@media (max-width: 640px) { .att-bar > * { flex: 1 1 auto; } .att-bar select, .att-bar input[type=date] { width: 100%; } }

/* Pantalla del timbre: escenario oscuro con reloj grande */
.stage {
  position: relative; overflow: hidden; border-radius: 22px; padding: clamp(18px, 3vw, 30px);
  color: #e8edf8; text-align: center; margin-bottom: 16px; isolation: isolate;
  background: radial-gradient(120% 90% at 50% -10%, #1f3a8a 0%, #0f1b3d 55%, #0a1128 100%);
  box-shadow: 0 18px 40px -18px rgba(10, 17, 40, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.stage::before { content: ''; position: absolute; inset: auto -20% -60% -20%; height: 80%; z-index: -1;
  background: radial-gradient(closest-side, rgba(245, 158, 11, .16), transparent); }
.stage-warn::before { background: radial-gradient(closest-side, rgba(245, 158, 11, .3), transparent); }
.stage-off::before { background: radial-gradient(closest-side, rgba(239, 68, 68, .22), transparent); }
.stage-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stage-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: #c9d3ea; }
.stage-pill .ic { width: 15px; height: 15px; }
.stage-pill i { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.stage-pill.on { color: #86efac; } .stage-pill.on i { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); animation: pulseDot 2s infinite; }
.stage-pill.warn { color: #fcd34d; } .stage-pill.warn i { background: #f59e0b; }
.stage-pill.off { color: #fca5a5; } .stage-pill.off i { background: #ef4444; }
.stage-pill .dot-on { background: #60a5fa; }
@keyframes pulseDot { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } }
.stage-clock { display: flex; justify-content: center; align-items: flex-start; gap: clamp(6px, 1.2vw, 14px); margin: clamp(10px, 2.5vw, 26px) 0 4px;
  font-variant-numeric: tabular-nums; line-height: .9; }
.stage-clock .hm { font-size: clamp(72px, 15vw, 190px); font-weight: 800; letter-spacing: -.04em; color: #fff;
  text-shadow: 0 6px 30px rgba(96, 165, 250, .25); }
.stage-clock .side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: clamp(8px, 1.6vw, 20px); }
.stage-clock .ss { font-size: clamp(26px, 4.6vw, 58px); font-weight: 700; color: #fbbf24; line-height: 1; }
.stage-clock .ap { font-size: clamp(14px, 2vw, 24px); font-weight: 700; color: #93a4c8; letter-spacing: .04em; text-transform: uppercase; }
.stage-date { color: #93a4c8; font-size: clamp(14px, 1.8vw, 18px); font-weight: 500; }
.stage-cta { margin: 16px auto 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stage-cta small { color: #c9d3ea; } .stage-cta a { color: #fcd34d; }
.stage-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 860px; margin: clamp(16px, 3vw, 28px) auto 0; text-align: left; }
.stage-box { padding: 14px 18px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09);
  display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stage-box .lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #93a4c8; }
.stage-box .lbl .ic { width: 14px; height: 14px; }
.stage-box .big { font-size: clamp(22px, 3vw, 32px); font-weight: 800; color: #fff; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-box .big.mono { font-variant-numeric: tabular-nums; color: #fbbf24; }
.stage-box .sub { font-size: 14px; color: #c9d3ea; } .stage-box .sub b { color: #fff; font-variant-numeric: tabular-nums; }
.stage-box.is-class { border-color: rgba(96, 165, 250, .35); }
.stage-box.is-break { border-color: rgba(245, 158, 11, .4); }
.stage-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 6px; }
.stage-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #60a5fa, #fbbf24); transition: width 1s linear; }
.stage-controls { display: flex; align-items: center; justify-content: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 18px; }
.stage-vol { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09); color: #c9d3ea; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stage-vol .ic { width: 16px; height: 16px; }
.stage-vol input { width: 160px; accent-color: #fbbf24; }
.stage-vol span { min-width: 36px; text-align: right; }
.stage-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sbtn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600;
  color: #e8edf8; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); cursor: pointer;
  transition: background .16s var(--ease-out), transform .16s var(--ease-out); }
.sbtn .ic { width: 16px; height: 16px; }
.sbtn:hover { background: rgba(255, 255, 255, .15); }
.sbtn:active { transform: scale(.97); }
.sbtn:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.stage-foot { margin: 14px 0 0; font-size: 12.5px; color: #7f8fb3; }
:fullscreen .stage { min-height: calc(100vh - 120px); display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 640px) {
  .stage-info { grid-template-columns: 1fr; }
  .stage-top { justify-content: center; }
  .sbtn span { display: none; } .sbtn { padding: 10px; }
}

/* ---------- panel en vivo: encabezado dinámico ---------- */
.hero { grid-template-columns: auto minmax(0, 1fr) auto; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; margin-right: 6px; vertical-align: 1px;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: liveDot 2s infinite; }
@keyframes liveDot { 70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.hero-left { font-size: 14px; font-weight: 600; color: #c7d2fe; }
.hero-left b { color: #fff; font-variant-numeric: tabular-nums; }
.daystrip { position: relative; display: flex; gap: 3px; height: 22px; margin-top: 8px; }
.daystrip .seg { position: relative; min-width: 6px; border-radius: 6px; background: rgba(255, 255, 255, .14); overflow: hidden; display: grid; place-items: center;
  transition: background .3s var(--ease-out), transform .2s var(--ease-out); cursor: default; }
.daystrip .seg::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--fill, 0%); background: rgba(255, 255, 255, .22); }
.daystrip .seg.brk { background: rgba(251, 191, 36, .28); }
.daystrip .seg.past { background: rgba(255, 255, 255, .3); }
.daystrip .seg.past::before { width: 0; }
.daystrip .seg.cur { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 2px #fbbf24; }
.daystrip .seg.cur::before { background: linear-gradient(90deg, rgba(251, 191, 36, .35), rgba(251, 191, 36, .6)); }
.daystrip .seg i { position: relative; font-style: normal; font-size: 10.5px; font-weight: 800; color: rgba(255, 255, 255, .85); }
.daystrip .seg:hover { transform: translateY(-2px); }
.daystrip .needle { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: #fff;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, .25), 0 0 12px rgba(255, 255, 255, .8); transition: left 1s linear; pointer-events: none; }
.daystrip-lbl { display: flex; justify-content: space-between; font-size: 11px; color: #c7d2fe; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-next { display: flex; align-items: center; gap: 12px; text-align: right; }
.hero-next > div { display: flex; flex-direction: column; align-items: flex-end; }
.ring { width: 52px; height: 52px; transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 5; }
.ring .fg { stroke: #fbbf24; stroke-linecap: round; stroke-dasharray: 125.66; stroke-dashoffset: 125.66; transition: stroke-dashoffset 1s linear; }

/* fichas de salones */
.live-rooms .room-card { position: relative; overflow: hidden; cursor: pointer; font: inherit; color: inherit; gap: 7px;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out); }
.live-rooms .room-card::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border); }
.live-rooms .room-card.busy::after { background: var(--blue, #2563eb); }
.live-rooms .room-card:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
  .live-rooms .room-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px -12px rgba(15, 23, 42, .35); border-color: var(--primary); }
}
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.room-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--blue, #2563eb); }
.room-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: liveDot 2s infinite; box-shadow: 0 0 0 0 rgba(37, 99, 235, .5); }
.room-state.free { color: var(--green, #16a34a); }
.room-bar { height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--blue, #2563eb) 15%, transparent); overflow: hidden; }
.room-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--blue, #2563eb); transition: width 1s linear; }
.room-next { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-next .ic { width: 13px; height: 13px; flex: none; }
.room-day { display: flex; flex-direction: column; gap: 6px; }
.rd { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); }
.rd.now { border-color: var(--primary); background: var(--blue-soft); }
.rd.past { opacity: .55; }
.rd-t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
.rd-b { min-width: 0; } .rd-b b { display: block; } .rd-b small { color: var(--muted); }
@media (max-width: 640px) {
  .ring { width: 42px; height: 42px; }
  .hero-next { gap: 8px; }
  .rd { grid-template-columns: 1fr auto; } .rd-t { grid-column: 1 / -1; }
}

/* ---------- menú lateral que se esconde solo (computador) ---------- */
.pin-btn { display: none; margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--side-text); cursor: pointer; place-items: center; flex: none; }
.pin-btn .ic { width: 16px; height: 16px; }
.pin-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.pin-btn.on { color: #fbbf24; }
@media (min-width: 901px) {
  .pin-btn { display: grid; }
  .app.rail .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 72px; overflow-x: hidden; z-index: 60;
    transition: width .26s var(--ease-out), box-shadow .26s var(--ease-out); }
  .app.rail .main { margin-left: 72px; }
  .app.rail .sidebar:hover, .app.rail .sidebar:has(:focus-visible) { width: var(--side-w); box-shadow: 12px 0 40px rgba(2, 6, 23, .35); }
  .app.rail .sidebar :is(.nav-item, .brand, .me) { white-space: nowrap; }
  .app.rail .sidebar :is(.nav-item > span:not(.ic-wrap), .brand-text, .pin-btn, .me > div) { transition: opacity .18s var(--ease-out); }
  .app.rail .sidebar:not(:hover):not(:has(:focus-visible)) :is(.nav-item > span:not(.ic-wrap), .brand-text, .pin-btn, .me > div) { opacity: 0; pointer-events: none; }
  .app.rail .sidebar:not(:hover):not(:has(:focus-visible)) .nav-item .count:not([hidden]) { opacity: 1; position: absolute; left: 40px; top: 4px; padding: 0 5px; font-size: 10px; }
  .app.rail .nav-item { position: relative; }
  .app.rail .brand { padding-left: 17px; }
}
@media (prefers-reduced-motion: reduce) { .live-dot, .room-state i { animation: none; } .daystrip .needle, .ring .fg, .room-bar i { transition: none; } }
@media (max-width: 640px) {
  .hero-next .ring { display: none; }
  .hero-next .hero-sub { white-space: nowrap; font-size: 11.5px; }
  .live-rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .live-rooms .room-card { padding: 10px 10px 10px 12px; }
  .live-rooms .room-teacher .avatar { display: none; }
  .room-state { font-size: 10px; }
  .room-next { font-size: 11px; }
}

/* Pantalla del timbre: nombre del colegio, salones, docentes libres y controles en una barra vertical al costado */
.stage-school { font-size: clamp(15px, 1.8vw, 20px); font-weight: 800; color: #fff; letter-spacing: -.01em; text-align: left; }
.station-page { padding-right: 70px; }
.station-lower { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.free-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; }
.free-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0; transition: transform .16s var(--ease-out), border-color .16s var(--ease-out); }
.free-chip > span:last-child { min-width: 0; }
.free-chip b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.free-chip small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.free-chip:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .free-chip:hover { border-color: var(--green); } }
.stage-dock { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 7px; border-radius: 16px 0 0 16px; background: #0f1b3d; border: 1px solid rgba(255, 255, 255, .1); border-right: 0;
  box-shadow: -10px 0 30px -12px rgba(2, 6, 23, .5); }
.view.enter > .stage-dock { animation: dockIn .35s var(--ease-out) both; }
@keyframes dockIn { from { opacity: 0; transform: translate(100%, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
.dbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .07); color: #e8edf8;
  display: grid; place-items: center; cursor: pointer; transition: background .16s var(--ease-out), transform .16s var(--ease-out); }
.dbtn .ic { width: 19px; height: 19px; }
.dbtn:hover { background: rgba(255, 255, 255, .16); }
.dbtn:active { transform: scale(.94); }
.dbtn:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
.dbtn.off { color: #fca5a5; border-color: rgba(239, 68, 68, .4); }
.dock-vol { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
.dock-vol input { writing-mode: vertical-lr; direction: rtl; width: 24px; height: 120px; accent-color: #fbbf24; cursor: pointer; }
.dock-vol span { font-size: 11px; font-weight: 700; color: #c9d3ea; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .station-lower { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .station-page { padding-right: 52px; }
  .stage-dock { padding: 8px 5px; gap: 4px; }
  .dbtn { width: 38px; height: 38px; }
  .dock-vol input { height: 90px; }
  .stage-top { justify-content: space-between; }
}

/* ---------- Pantalla del timbre: todo en una sola pantalla (monitor fijo) ---------- */
.room-card.alert { border-color: #ef4444; animation: roomAlert 1.6s ease-in-out infinite; }
.live-rooms .room-card.alert::after { background: #ef4444; }
@keyframes roomAlert {
  0%, 100% { background: #fee2e2; box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
  50% { background: #fecaca; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.room-state.warn { color: #dc2626; }
.room-state.warn i { animation: liveDot 1.2s infinite; }
.room-alert { color: #b91c1c; font-weight: 600; }
.pulse-chip { animation: chipPulse 1.6s ease-in-out infinite; }
@keyframes chipPulse { 50% { transform: scale(1.06); } }
.st-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-strip { width: 100%; max-width: 860px; margin: 14px auto 0; text-align: left; }
.stage-strip:empty { display: none; }
.st-free { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.st-free-lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; white-space: nowrap; flex: none; }
.st-free-lbl .ic { width: 18px; height: 18px; color: var(--green); }
.st-free-lbl b { background: var(--green-soft); color: var(--green); border-radius: 999px; padding: 1px 8px; font-size: 13px; }
.ticker { overflow: hidden; flex: 1; min-width: 0; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker .track { display: flex; gap: 8px; width: max-content; }
.ticker .track-dup { display: flex; gap: 8px; }
.ticker.run .track { animation: ticker var(--dur, 40s) linear infinite; }
.ticker.run:hover .track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
.ticker .free-chip { flex: none; width: 210px; }
@media (min-width: 1000px) and (min-height: 600px) {
  .view:has(> .station-page) { max-width: none; padding: 14px 16px; }
  .station-page { display: grid; grid-template-columns: minmax(330px, .85fr) 2fr; grid-template-rows: minmax(0, 1fr) auto; gap: 14px;
    height: calc(100dvh - 62px - 28px); padding-right: 64px; }
  .station-page .stage { margin: 0; display: flex; flex-direction: column; justify-content: center; padding: 20px; min-height: 0; }
  .station-page .stage-clock .hm { font-size: clamp(64px, 7.5vw, 150px); }
  .station-page .stage-clock .ss { font-size: clamp(24px, 2.6vw, 50px); }
  .station-page .stage-info { grid-template-columns: 1fr; gap: 10px; margin-top: 18px; width: 100%; }
  .station-page .st-rooms { margin: 0; display: flex; flex-direction: column; min-height: 0; }
  .station-page .st-rooms .live-rooms { flex: 1; min-height: 0; grid-auto-rows: 1fr; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .station-page .st-rooms .room-card { justify-content: center; padding: 14px 16px; }
  .station-page .st-rooms .room-name { font-size: clamp(16px, 1.4vw, 22px); }
  .station-page .st-rooms .room-teacher b { font-size: clamp(14px, 1.15vw, 18px); }
  .station-page .st-free { grid-column: 1 / -1; }
  body.kiosk .sidebar, body.kiosk .topbar, body.kiosk .sound-banner { display: none !important; }
  body.kiosk .app.rail .main { margin-left: 0; }
  body.kiosk .station-page { height: calc(100dvh - 28px); }
}
@media (max-width: 999px), (max-height: 599px) {
  .st-rooms { margin-top: 0; }
  .station-page > * + * { margin-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .room-card.alert { animation: none; background: #fee2e2; }
  .ticker.run .track, .pulse-chip { animation: none; }
}

/* Reemplazo temporal */
.sub-box { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px;
  background: #fff7ed; border: 1px dashed #fb923c; color: #7c2d12; }
.sub-box > .ic { width: 22px; height: 22px; flex: none; margin-top: 2px; color: #ea580c; }
.sub-box b { display: block; } .sub-box small { display: block; color: #9a3412; margin-top: 2px; }
.sub-box.on { background: #ecfdf5; border-color: #34d399; color: #064e3b; } .sub-box.on small { color: #065f46; } .sub-box.on > .ic { color: #059669; }
.sub-box.on { align-items: center; }
.sub-row { display: flex; gap: 8px; margin-top: 10px; } .sub-row select { flex: 1; min-width: 0; }
.live-rooms .room-card.sub { border-color: #34d399; background: #ecfdf5; }
.live-rooms .room-card.sub::after { background: #10b981; }
.live-rooms .room-card.sub .room-state { color: #059669; }
.live-rooms .room-card.sub .room-bar i { background: #10b981; }

/* Solo secundaria y activo/pausado */
.level-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 700; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); transition: background .16s var(--ease-out), color .16s var(--ease-out); }
.level-toggle i { width: 26px; height: 15px; border-radius: 99px; background: var(--border); position: relative; transition: background .16s var(--ease-out); }
.level-toggle i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .16s var(--ease-out); }
.level-toggle.on { color: var(--primary); border-color: var(--primary); background: var(--blue-soft); }
.level-toggle.on i { background: var(--primary); }
.level-toggle.on i::after { transform: translateX(11px); }
.level-tag { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.sub-box.leave { align-items: center; background: var(--blue-soft); border: 1px solid var(--blue); color: var(--text); }
.sub-box.leave small { color: var(--muted); }
.sub-box.leave > .ic { color: var(--blue); }

/* Timbres personalizados y simulacros programados */
.cb-list { display: flex; flex-direction: column; gap: 6px; }
.cb { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.cb.off { opacity: .6; }
.cb-t { font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; min-width: 82px; }
.cb-b { flex: 1; min-width: 0; }
.cb-b b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-b small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb .btns { display: flex; gap: 2px; }
@media (max-width: 640px) { .cb { flex-wrap: wrap; } .cb-b { flex-basis: calc(100% - 100px); } }

/* Botón SOS */
.sos-btn { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 800; letter-spacing: .06em; padding: 8px 14px; }
.sos-btn:hover { background: #b91c1c !important; border-color: #b91c1c !important; }
.sos-now { background: #dc2626; border-color: #dc2626; color: #fff; }

/* Pantalla del simulacro */
.sos-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; color: #fff; text-align: center; animation: sosBg 1.2s ease-in-out infinite; }
.sos-overlay[hidden] { display: none; }
@keyframes sosBg { 0%, 100% { background: #7f1d1d; } 50% { background: #dc2626; } }
.sos-stage { max-width: 760px; display: flex; flex-direction: column; align-items: center; }
.sos-rings { position: relative; width: clamp(130px, 24vmin, 220px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #b91c1c; }
.sos-rings b { font-size: clamp(38px, 8vmin, 70px); font-weight: 900; letter-spacing: .04em; }
.sos-rings i { position: absolute; inset: 0; border-radius: 50%; border: 4px solid #fff; animation: sosRing 2.4s ease-out infinite; }
.sos-rings i:nth-child(2) { animation-delay: .8s; }
.sos-rings i:nth-child(3) { animation-delay: 1.6s; }
@keyframes sosRing { from { transform: scale(1); opacity: .8; } to { transform: scale(1.5); opacity: 0; } }
.sos-stage h1 { font-size: clamp(30px, 6.4vmin, 62px); line-height: 1.08; margin: clamp(26px, 6vmin, 52px) 0 6px; color: #fff; }
.sos-label { margin: 0; font-size: clamp(16px, 3vmin, 26px); font-weight: 700; color: #fee2e2; }
.sos-msg { margin: 12px 0 0; font-size: clamp(18px, 3.4vmin, 30px); }
.sos-left { margin-top: 16px; font-size: clamp(15px, 2.4vmin, 20px); color: #fee2e2; }
.sos-left b { font-variant-numeric: tabular-nums; color: #fff; }
.sos-stop { margin-top: 22px; background: #fff; color: #991b1b; border-color: #fff; font-weight: 800; }
.sos-stop:hover { background: #fee2e2 !important; }
@media (prefers-reduced-motion: reduce) { .sos-overlay { animation: none; background: #b91c1c; } .sos-rings i { animation: none; opacity: 0; } }

/* Instalar como aplicación */
.install-bar { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--blue-soft); border-bottom: 1px solid var(--border); font-size: 14px; }
.install-bar[hidden] { display: none; }
.install-bar .ic { width: 18px; height: 18px; color: var(--primary); }
.install-bar .grow { flex: 1; min-width: 0; }
.install-login { margin-top: 10px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.install-login[hidden] { display: none; }
.install-login .ic { width: 18px; height: 18px; }
.install-how { margin: 0; padding-left: 20px; line-height: 1.7; }
@media (max-width: 640px) {
  .install-bar { padding: 8px 12px; flex-wrap: wrap; }
  .install-bar .grow { flex-basis: calc(100% - 30px); }
  .view-title, .sound-pill span { display: none; }
  .top-right { margin-left: auto; }
  .sos-btn { padding: 8px 10px; }
}

/* Barra lateral de la Pantalla del timbre: docentes libres solo secundaria */
.dbtn.sec { font: inherit; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; }
.dbtn.sec.on { background: #fbbf24; border-color: #fbbf24; color: #1f1300; }
.dbtn.sec.on:hover { background: #fcd34d; }

/* La Pantalla del timbre debe caber completa: sin aviso de instalación */
.main:has(.station-page) .install-bar { display: none; }

.log-item.sos-log { align-items: center; }
.log-item.sos-log .icon-btn { margin-left: auto; flex: none; }

/* Asistencia: barra, encabezado, nombre y botones fijos; lo demás se desplaza */
.main:has(.att-page) { height: 100vh; height: 100dvh; }
.view:has(.att-page) { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.att-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.att-page .toolbar { flex: none; margin-bottom: 8px; }
.att-page .stats { flex: none; gap: 8px; margin-bottom: 10px; }
.att-page .stat { display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: 12px; min-width: 0; }
.att-page .stat b { font-size: 20px; display: inline; }
.att-page .stat span { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-card { flex: 1; min-height: 0; display: flex; margin: 0; padding: 0; overflow: hidden; }
.att-wrap { flex: 1; min-width: 0; overflow: auto; border: 0; border-radius: 0; overscroll-behavior: contain; }
table.att-tbl { --name: 200px; border-collapse: separate; border-spacing: 0; min-width: 100%; width: max-content; }
.att-tbl th { position: sticky; top: 0; z-index: 2; }
.att-tbl .c-n, .att-tbl .c-b { position: sticky; z-index: 1; background: var(--surface); }
.att-tbl .c-n { left: 0; width: var(--name); min-width: var(--name); max-width: var(--name); }
.att-tbl .c-b { left: var(--name); box-shadow: 6px 0 8px -6px rgba(15, 23, 42, .22); }
.att-tbl th.c-n, .att-tbl th.c-b { z-index: 3; background: var(--surface-2); }
.att-tbl .c-n b { display: block; line-height: 1.2; overflow-wrap: anywhere; }
.att-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-left { margin-top: 3px; font-size: 11px; padding: 1px 6px; white-space: nowrap; }
.att-tbl input[type=time] { width: 125px; }
.att-tbl input[name=note] { width: 190px; }
.att-pick { display: flex; gap: 5px; }
.att-b { --c: var(--muted); min-width: 62px; height: 34px; padding: 0 6px; border-radius: 9px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--c); background: transparent; border: 1.5px solid color-mix(in srgb, var(--c) 38%, transparent);
  transition: background .14s var(--ease-out), color .14s var(--ease-out), transform .12s var(--ease-out); }
.att-b .s { display: none; }
.att-b.green { --c: var(--green); } .att-b.amber { --c: #b45309; } .att-b.red { --c: var(--red); } .att-b.gray { --c: #64748b; } .att-b.blue { --c: var(--blue); }
.att-b.on { background: var(--c); border-color: var(--c); color: #fff; }
.att-b:active { transform: scale(.94); }
.att-b:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .att-b:not(.on):hover { background: color-mix(in srgb, var(--c) 12%, transparent); } }
@media (max-width: 640px) {
  table.att-tbl { --name: 92px; }
  .att-tbl th, .att-tbl td { padding: 7px 6px; }
  .att-tbl .c-n { padding-left: 10px; font-size: 13px; }
  .att-sub { display: none; }
  .att-page .toolbar { gap: 6px; }
  .att-page .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 8px; }
  .att-page .stat { flex-direction: column; align-items: center; gap: 0; padding: 4px 2px; }
  .att-page .stat b { font-size: 17px; }
  .att-page .stat span { font-size: 10.5px; }
  .att-pick { gap: 4px; }
  .att-b { min-width: 38px; width: 38px; height: 44px; padding: 0; font-size: 15px; font-weight: 800; }
  .att-b .s { display: inline; } .att-b .l { display: none; }
}

.main:has(.att-page) .install-bar { display: none; }
@media (max-width: 640px) {
  .att-page .att-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .att-page .att-bar > * { min-width: 0; width: 100%; }
  .att-page .att-bar #attPend { padding: 2px 6px; font-size: 12px; line-height: 1.1; }
  .att-page .att-bar #attPend .ic { display: none; }
  .att-page .att-bar #attPend:nth-child(3) { grid-column: 1 / -1; }
}

/* Computador: tabla normal; en pantallas medianas los botones usan la letra para que quepa todo */
@media (min-width: 641px) and (max-width: 1199px) {
  .att-b { min-width: 34px; width: 34px; padding: 0; font-size: 13px; font-weight: 800; }
  .att-b .s { display: inline; } .att-b .l { display: none; }
  .att-pick { gap: 4px; }
}

/* Asistencia en computador: que todo quepa sin desplazamiento lateral */
@media (min-width: 641px) {
  #attTable:not(.att-tbl) td, #attTable:not(.att-tbl) th { padding-left: 6px; padding-right: 6px; }
  #attTable:not(.att-tbl) .c-n b { white-space: nowrap; }
  #attTable:not(.att-tbl) input[type=time] { width: 106px; padding: 5px 4px; font-size: 13px; }
  #attTable:not(.att-tbl) input[name=note] { width: 100%; min-width: 76px; }
  #attTable:not(.att-tbl) .chip { padding: 2px 7px; font-size: 11.5px; white-space: nowrap; }
}
