/* Hallway — mobile-first styles */

:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --text: #0f172a;
  --muted: #586174;
  --border: #e0e6f0;
  --primary: #1e4fd8;
  --primary-600: #1a43b8;
  --primary-text: #1e4fd8;
  --primary-soft: #e7eeff;
  --primary-press: #1638a6;
  --soft-press: #c9d7fb;
  --on-primary: #ffffff;
  --ok: #157a3a;
  --ok-soft: #e1f4e8;
  --warn: #975a06;
  --warn-soft: #fcf0d8;
  --danger: #c02626;
  --danger-soft: #fde9e9;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 6px 20px rgb(15 23 42 / 0.05);
  --tabbar-h: 68px;
  --sidebar-w: 248px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --auth-glow: #d9e4ff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #131b2e;
    --surface-2: #1b2540;
    --text: #e7ecf6;
    --muted: #9ba7be;
    --border: #25314d;
    --primary: #3563e9;
    --primary-600: #4a74ee;
    --primary-text: #8fb0ff;
    --primary-soft: #1a2750;
    --primary-press: #1f3fa8;
    --soft-press: #101a38;
    --on-primary: #ffffff;
    --ok: #5ad48a;
    --ok-soft: #11301f;
    --warn: #f5c04f;
    --warn-soft: #33270c;
    --danger: #f58080;
    --danger-soft: #3b1818;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --auth-glow: #1a2750;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body.bare {
  background: var(--bg) radial-gradient(1100px 560px at 50% -180px, var(--auth-glow), var(--bg)) no-repeat;
}

a {
  color: var(--primary-text);
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon {
  flex-shrink: 0;
}

/* ---- Layout -------------------------------------------------------------- */

.main-col {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.8) blur(14px);
  -webkit-backdrop-filter: saturate(1.8) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar [data-back] {
  display: none;
  margin-left: -8px;
}

.topbar.has-back [data-back] {
  display: inline-flex;
}

.topbar.has-back .topbar-logo {
  display: none;
}

.topbar-logo {
  border-radius: 9px;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title h1 {
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.side-brand {
  display: none;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 12px;
}

.tab-icon {
  position: relative;
  display: inline-flex;
  padding: 3px 16px;
  border-radius: 999px;
  transition: background 0.15s;
}

.tab.active {
  color: var(--primary-text);
}

.tab.active .tab-icon {
  background: var(--primary-soft);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.dot {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 18px;
  text-align: center;
}

.tab-icon .dot {
  top: -4px;
  right: 4px;
}

/* Six tabs (En vivo for the dirección) on a narrow phone: a little tighter so they all fit. */
@media (max-width: 385px) {
  .tabbar:has(a.tab:nth-of-type(6)) .tab {
    font-size: 10.5px;
  }

  .tabbar:has(a.tab:nth-of-type(6)) .tab-icon {
    padding: 3px 10px;
  }
}

@media (min-width: 900px) {
  .tabbar {
    top: 0;
    right: auto;
    width: var(--sidebar-w);
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 20px 12px;
    border-top: 0;
    border-right: 1px solid var(--border);
  }

  .side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 22px;
    font-size: 14px;
  }

  .side-brand img {
    border-radius: 10px;
  }

  .side-brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
  }

  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 12px;
    padding: 10px 12px;
    font-size: 15px;
  }

  .tab-icon {
    padding: 0;
  }

  .tab:hover {
    background: var(--surface-2);
  }

  .tab.active,
  .tab.active:hover {
    background: var(--primary-soft);
  }

  .tab.active .tab-icon {
    background: none;
  }

  .tab-icon .dot {
    top: -8px;
    right: -10px;
  }

  .main-col {
    margin-left: var(--sidebar-w);
    padding-bottom: 32px;
  }

  .topbar-logo {
    display: none;
  }

  .action-bar {
    left: var(--sidebar-w) !important;
    bottom: 0 !important;
  }
}

/* ---- Utilities ----------------------------------------------------------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.center {
  text-align: center;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.03em;
}

.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.capitalize::first-letter {
  text-transform: uppercase;
}

.hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.pad {
  padding: 8px 4px;
}

.section {
  margin-top: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.view .button-row {
  margin-top: 20px;
}

.card .button-row,
.dialog .button-row {
  margin-top: 0;
}

/* ---- Cards --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.card-title .icon {
  color: var(--primary-text);
}

.optional {
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
}

.count {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.count.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.link-card > .icon:first-child {
  color: var(--primary-text);
}

.link-card span {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.link-card small {
  color: var(--muted);
}

/* ---- Buttons ------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.06s,
    background 0.15s,
    opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-600);
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-text);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost-danger {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.btn-light {
  background: #fff;
  color: #1e3a8a;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 52px;
  font-size: 17px;
  border-radius: 14px;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

.is-busy {
  color: transparent !important;
  pointer-events: none;
}

.is-busy > * {
  visibility: hidden;
}

.is-busy::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2.5px solid var(--primary-text);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary.is-busy::after,
.btn-danger.is-busy::after {
  border-color: #fff;
  border-right-color: transparent;
}

/* ---- Forms --------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px avoids iOS zoom on focus */
  font-weight: 400;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 0;
  border-color: var(--primary);
}

input[type='date'],
input[type='time'] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
}

input::-webkit-date-and-time-value {
  text-align: left;
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23808a9e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 460px) {
  .grid3 {
    grid-template-columns: 1fr 1fr;
  }

  .grid3 > :first-child {
    grid-column: 1 / -1;
  }
}

.pw {
  position: relative;
  display: block;
}

.pw input {
  padding-right: 84px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}

.seg {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

.seg:has(input:focus-visible) {
  outline: 2px solid var(--primary);
}

.chips,
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span,
.chip-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chip input:checked + span {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--primary);
}

/* "Otro grupo": the rest of the school's groups, once it's chosen. */
.group-other {
  display: none;
  margin-top: 4px;
}

.field:has([data-other-group]:checked) .group-other {
  display: block;
}

/* Cobertura: one block per person who covers. */
.cover-row {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.cover-row-head {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.cover-list .item-sub {
  white-space: normal;
}

/* «Nadie cubrirá»: why and who said it; «Quitar» at the end. */
.no-cover .link-btn {
  margin-left: auto;
}

/* Resumen del día: the day between «anterior» and «siguiente». */
.summary-nav {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.summary-nav h2 {
  font-size: 20px;
}

.summary .item-sub {
  white-space: normal;
}

/* An icon and its words (Sonido, Pantalla grande). */
.chip-btn {
  gap: 6px;
}

.chip-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}

.toggle-ui {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s;
}

.toggle-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-ui {
  background: var(--primary);
}

.toggle input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-ui {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.toggle input:disabled + .toggle-ui {
  opacity: 0.5;
}

.switch-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.switch-inline input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 16px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.dropzone .icon {
  color: var(--primary-text);
}

.dropzone strong {
  color: var(--text);
}

.dropzone small {
  font-size: 12.5px;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list:empty {
  display: none;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
}

.file-list li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list small {
  color: var(--muted);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
}

.search input {
  padding-left: 0;
  border: 0;
  background: transparent;
  outline: none;
}

.search input:focus {
  outline: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 14px;
  font-weight: 600;
}

.filter-chip .icon-btn {
  width: 30px;
  height: 30px;
  color: inherit;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input {
  flex: 1;
}

/* ---- Lists --------------------------------------------------------------- */

.list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  margin: 14px 4px 8px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.item:last-child {
  border-bottom: 0;
}

/* A row that is a button (e.g. switching accounts in Más). */
button.item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.item:last-child {
  border-bottom: 0;
}

.item:hover,
.item:active {
  background: var(--surface-2);
}

.item > .icon:last-child {
  color: var(--muted);
}

.item.is-muted {
  opacity: 0.6;
}

.item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-main strong,
.item-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-main strong {
  font-size: 15.5px;
}

.item-main strong::first-letter,
.item-sub::first-letter {
  text-transform: uppercase;
}

.item-sub {
  font-size: 13.5px;
  color: var(--muted);
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.item-tags:empty {
  display: none;
}

.item-time {
  font-size: 12px;
  color: var(--muted);
}

.item-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-text);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-muted {
  background: var(--surface-2);
  color: var(--muted);
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

.avatar.xl {
  width: 76px;
  height: 76px;
  font-size: 26px;
}

.avatar.c0 { background: #2563eb; }
.avatar.c1 { background: #7c3aed; }
.avatar.c2 { background: #db2777; }
.avatar.c3 { background: #c2410c; }
.avatar.c4 { background: #0f766e; }
.avatar.c5 { background: #15803d; }
.avatar.c6 { background: #0e7490; }
.avatar.c7 { background: #a16207; }

.date-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 50px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-text);
  line-height: 1;
}

.date-chip b {
  font-size: 19px;
}

.date-chip small {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.notif-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

.notif .item-sub {
  white-space: normal;
}

.notif.unread {
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
}

.notif.unread .notif-icon {
  background: var(--primary);
  color: #fff;
}

/* ---- Home & dashboard ---------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 20px 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, #2f66ef, #1e3a8a);
  color: #fff;
  box-shadow: 0 10px 30px rgb(30 64 175 / 0.25);
}

.hero h2 {
  margin: 4px 0 6px;
  font-size: 26px;
}

.hero p {
  opacity: 0.92;
}

.hero-kicker {
  font-weight: 600;
}

.hello {
  margin: 4px 4px 16px;
}

.hello h2 {
  font-size: 26px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 560px) {
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.stat strong {
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.stat-warn {
  background: var(--warn-soft);
  border-color: transparent;
}

.stat-warn strong {
  color: var(--warn);
}

.stat-danger {
  background: var(--danger-soft);
  border-color: transparent;
}

.stat-danger strong {
  color: var(--danger);
}

.install {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.view .install {
  margin-top: 16px;
}

.install-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-text);
}

.install-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.install-body p {
  color: var(--muted);
}

.install-body p .icon {
  vertical-align: -3px;
}

.install-body .btn {
  align-self: flex-start;
}

/* ---- Empty & loading ----------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
}

.empty > .icon {
  opacity: 0.45;
}

.empty h3 {
  color: var(--text);
  font-size: 17px;
}

.loading {
  display: grid;
  place-items: center;
  padding: 56px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Absence detail ------------------------------------------------------ */

.absence-head h2 {
  font-size: 19px;
}

.when {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.when .icon {
  margin-top: 2px;
  color: var(--primary-text);
}

.when strong,
.when span {
  display: block;
}

.when strong::first-letter {
  text-transform: uppercase;
}

.when span {
  font-size: 14px;
  color: var(--muted);
}

.status-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
}

.card .stack > .status-note,
.stack > .status-note {
  margin-top: 0;
}

.status-note.ok {
  color: var(--ok);
}

.status-note.warn {
  color: var(--warn);
}

.status-note.danger {
  color: var(--danger);
}

.status-note.muted {
  color: var(--muted);
}

.details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.details dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.details dd {
  margin: 2px 0 0;
}

.attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.att {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.att-link {
  display: flex;
  flex-direction: column;
  color: var(--text);
}

.att img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--border);
}

.att-icon {
  display: grid;
  place-items: center;
  height: 110px;
  color: var(--primary-text);
}

.att-name {
  padding: 6px 8px 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att small {
  padding: 0 8px 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.att-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
}

.att-del:hover {
  background: rgb(0 0 0 / 0.75);
}

.file-btn {
  cursor: pointer;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  align-self: flex-start;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface-2);
}

.bubble.mine {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: var(--primary-soft);
}

.bubble-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
  font-size: 13px;
}

.bubble-head span {
  font-size: 12px;
  color: var(--muted);
}

.comment-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.comment-form textarea {
  flex: 1;
  min-height: 48px;
}

.comment-form .btn {
  width: 48px;
  min-height: 48px;
  padding: 0;
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 25;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.action-bar .btn {
  display: flex;
  max-width: 688px;
  margin: 0 auto;
}

.view-inner:has(.action-bar) {
  padding-bottom: 84px;
}

/* ---- Charts -------------------------------------------------------------- */

.bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
}

.bar-row > span:first-child {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.bar-row b {
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---- Auth ---------------------------------------------------------------- */

.auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  max-width: 420px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(28px + var(--safe-t)) 16px calc(28px + var(--safe-b));
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.auth-logo {
  border-radius: 18px;
  box-shadow: 0 10px 30px rgb(37 99 235 / 0.3);
}

.auth-brand h1 {
  margin-top: 6px;
  font-size: 24px;
}

.auth-brand p {
  color: var(--muted);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-foot {
  font-size: 13px;
  text-align: center;
}

.school-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 8px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.school-chip > .icon {
  color: var(--primary-text);
}

.school-chip small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.school-chip strong {
  display: block;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Settings, profile, platform ----------------------------------------- */

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 18px;
}

.help summary {
  color: var(--primary-text);
  font-weight: 600;
  cursor: pointer;
}

.help ol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  padding-left: 20px;
  font-size: 14.5px;
}

.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.profile-head h2 {
  margin-top: 6px;
  font-size: 20px;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.profile-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.platform {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-t)) 16px 40px;
}

.platform-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.platform-head img {
  border-radius: 10px;
}

.platform-head h1 {
  font-size: 20px;
}

.school .button-row {
  margin-top: 12px;
}

.school.is-muted {
  opacity: 0.7;
}

/* ---- Dialogs & toasts ---------------------------------------------------- */

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.3);
}

.dialog::backdrop {
  background: rgb(15 23 42 / 0.5);
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.dialog-inner h2 {
  font-size: 19px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.credentials {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.credentials div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}

.credentials span {
  font-size: 14px;
  color: var(--muted);
}

.credentials strong {
  font-size: 16px;
  user-select: all;
  -webkit-user-select: all;
}

#toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

body.bare #toasts {
  bottom: calc(24px + var(--safe-b));
}

.toast {
  padding: 12px 16px;
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  animation: toast-in 0.2s ease-out;
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.toast-ok {
  background: #15803d;
}

.toast-error {
  background: #b91c1c;
}

.toast.out {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (min-width: 900px) {
  body:not(.bare) #toasts {
    bottom: 24px;
    left: calc(50% + var(--sidebar-w) / 2);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Icon tool (platform panel) ------------------------------------------ */

.icon-previews {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.icon-previews figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.icon-previews img {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px;
  box-shadow: var(--shadow);
}

.icon-previews img.squircle {
  border-radius: 22%;
}

.icon-previews img.circle {
  border-radius: 50%;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  font-size: 14.5px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--surface-2);
}

input[type='color'] {
  height: 46px;
  padding: 4px;
  cursor: pointer;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.button-row.split > * {
  flex: 1 1 160px;
}

/* ---- Cancel reasons ------------------------------------------------------ */

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice input {
  flex: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 1px 0 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  accent-color: var(--primary);
}

.choice span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 500;
}

.choice small {
  font-weight: 400;
  color: var(--muted);
}

.dialog [hidden] {
  display: none !important;
}

/* ---- History ------------------------------------------------------------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--border);
}

.timeline > li {
  position: relative;
  padding: 0 0 14px 4px;
  overflow-wrap: anywhere;
}

.timeline > li:last-child {
  padding-bottom: 0;
}

.timeline > li::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--muted);
}

.timeline > li.t-received::before {
  border-color: var(--ok);
  background: var(--ok);
}

.timeline > li.t-edited::before {
  border-color: var(--primary);
}

.timeline > li.t-cancelled::before {
  border-color: var(--danger);
  background: var(--danger);
}

.timeline small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.timeline .changes {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 14px;
}

.timeline del {
  color: var(--muted);
}

.timeline ins {
  text-decoration: none;
  font-weight: 600;
}

.timeline p {
  margin: 6px 0 0;
  font-size: 14px;
}

/* ---- Archive ------------------------------------------------------------- */

.archive-runs h3 {
  margin: 4px 0 6px;
  font-size: 14px;
}

.archive-runs ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.archive-runs li span {
  display: block;
  color: var(--muted);
}

/* ---- Mensajes y correo --------------------------------------------------- */

.choice span small {
  margin-top: 1px;
}

.people-list {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.person:last-child {
  border-bottom: 0;
}

.person[hidden] {
  display: none;
}

.person input {
  flex: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.person strong,
.person small {
  display: block;
}

.person small {
  color: var(--muted);
  font-size: 13px;
}

.person:has(input:checked) {
  background: var(--primary-soft);
}

.placeholders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.placeholders .chip-btn {
  min-height: 32px;
  padding: 4px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.preview-box {
  max-height: 55vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
}

.message-body {
  font-size: 16px;
  line-height: 1.55;
}

.list.compact .item {
  padding-top: 8px;
  padding-bottom: 8px;
}

.email-preview {
  display: block;
  width: 100%;
  height: min(62vh, 640px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f3f5fa;
}

.hint-list {
  margin: 4px 0 8px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
}

.hint-list li + li {
  margin-top: 4px;
}

.school-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.school-row img {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.person .school-icon {
  flex: none;
  border-radius: 8px;
}

/* ---- Roles y permisos ---------------------------------------------------- */

.perm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice.is-fixed {
  cursor: default;
  opacity: 0.75;
}

.role-item .role-actions {
  display: flex;
  flex: none;
  gap: 2px;
}

.role-item .item-sub {
  white-space: normal;
}

.role-summary {
  margin: -4px 0 0;
}

/* ---- Calendario escolar, salón y grupos ------------------------------------- */

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list.flat {
  margin: 0 -6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.list.flat .item {
  padding-left: 6px;
  padding-right: 6px;
}

.item-actions {
  display: flex;
  flex: none;
  gap: 2px;
}

.closure-item .item-main strong,
.closure-item .item-sub {
  white-space: normal;
}

.item-icon.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.weekday-chips {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-chips .chip span {
  width: 100%;
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
}

.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-chip {
  gap: 6px;
  color: var(--text);
}

.group-chip small {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.add-row {
  display: flex;
  gap: 8px;
}

.add-row input {
  flex: 1;
  min-width: 0;
}

.group-picker .chip span {
  min-width: 52px;
  justify-content: center;
}

/* ---- Alertas ------------------------------------------------------------------ */

.count.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.alert-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 104px;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.alert-action .icon {
  color: var(--primary-text);
}

.alert-action strong {
  font-size: 15px;
}

.alert-action small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.alert-action.is-danger {
  background: var(--danger-soft);
  border-color: transparent;
}

.alert-action.is-danger .icon,
.alert-action.is-danger strong {
  color: var(--danger);
}

.alert-item.is-urgent {
  box-shadow: inset 4px 0 0 var(--danger);
}

.alert-item .item-main strong,
.alert-item .item-sub {
  white-space: normal;
}

.item-link {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
}

.item-icon.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.item-icon.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.alert-head.is-urgent {
  border-color: var(--danger);
  box-shadow: inset 0 4px 0 var(--danger), var(--shadow);
}

.alert-head.is-ok {
  border-color: var(--ok);
}

.alert-head h2 {
  margin: 0;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.alert-kind {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-head.is-urgent .alert-kind {
  color: var(--danger);
}

.facts {
  display: grid;
  gap: 8px;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.fact span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.fact strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.timeline.steps > li {
  color: var(--muted);
}

.timeline.steps > li.is-done {
  color: var(--text);
}

.timeline.steps > li.is-done::before {
  border-color: var(--ok);
  background: var(--ok);
}

/* En vivo › a turn: not getting there in time, and a cancelled turn. */
.timeline.steps > li.is-late {
  color: var(--danger);
}

.timeline.steps > li.is-late::before {
  border-color: var(--danger);
  background: var(--danger);
}

.timeline.steps > li.is-cancelled::before {
  border-color: var(--muted);
  background: var(--muted);
}

/* Links for whoever covers: as typed (docs.google.com, not Docs.google.com). */
[data-links] .item-main strong::first-letter,
[data-links] .item-sub::first-letter {
  text-transform: none;
}

/* In-app alarm (urgent notice while the app is open). */
.alarm {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(127 29 29 / 0.88);
  animation: alarm-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes alarm-pulse {
  from {
    background: rgb(127 29 29 / 0.92);
  }
  to {
    background: rgb(190 18 60 / 0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .alarm {
    animation: none;
  }
}

.alarm-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  padding: 24px 20px 16px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}

.alarm-card h2 {
  margin: 0;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.alarm-card p {
  margin: 0 0 6px;
  color: var(--muted);
}

.alarm-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}

.nowrap {
  white-space: nowrap;
}

/* Turnos */
.tag-info {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.tag.is-late,
.turn-timer.is-late {
  background: var(--danger-soft);
  color: var(--danger);
}

.item-icon.queue-num {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 16px;
  font-weight: 800;
}

.turn-timer {
  align-self: flex-start;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sev-chips .sev-3 input:checked + span {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn);
}

.sev-chips .sev-4 input:checked + span {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.alert-action small.is-off {
  color: var(--warn);
  font-weight: 600;
}

/* Mantenimiento */
.field-label {
  font-size: 14px;
  font-weight: 600;
}

.kind-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kind {
  position: relative;
}

.kind input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.kind span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.kind .icon {
  color: var(--primary-text);
}

.kind input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.kind input:focus-visible + span {
  outline: 2px solid var(--primary);
}

.photo-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
}

.photo-full {
  display: block;
  width: 100%;
  max-height: 360px;
  border-radius: 12px;
  object-fit: cover;
}

/* ---- Salón de conferencias ------------------------------------------------ */

.link-card.room-link {
  margin: 12px 0;
}

.link-card.is-warn {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.link-card.is-warn > .icon:first-child,
.link-card.is-warn strong {
  color: var(--warn);
}

.booking-actions {
  display: flex;
  flex: none;
  gap: 6px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
}

.day-strip,
.month-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  gap: 6px;
}

.day-pill,
.month-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 62px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.day-pill small,
.month-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.day-pill b,
.month-cell b {
  font-size: 17px;
}

.day-pill i {
  min-height: 16px;
  color: var(--primary-text);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.day-pill.active,
.month-cell.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.day-pill.is-today b,
.month-cell.is-today b {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.day-pill.is-off,
.month-cell.is-off {
  background: var(--surface-2);
  color: var(--muted);
}

.month-cell {
  min-height: 52px;
}

.month-cell small {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 700;
}

.month-cell.is-out {
  opacity: 0.45;
}

.agenda {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-title {
  margin: 4px 0 0;
  font-size: 16px;
}

.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agenda-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.agenda-row.is-pending {
  border-style: dashed;
  border-left-style: solid;
  border-left-color: var(--warn);
}

.agenda-row.is-free {
  border-left-color: var(--ok);
  background: var(--surface-2);
}

.agenda-time {
  flex: none;
  width: 104px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.agenda-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.agenda-main small {
  color: var(--muted);
}

.more-groups > .section:first-child {
  margin-top: 0;
}

/* The first-time guide: its list sits inside the card and says everything (no "…"). */
.view .guide {
  margin-top: 16px;
}

.view .stack > .guide {
  margin-top: 0;
}

.guide .list {
  box-shadow: none;
}

.guide .item-sub,
.guide-tasks .item-main strong {
  white-space: normal;
}

.guide-tasks.section {
  margin-top: 0;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-text);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Paneles -------------------------------------------------------------- */

.live-service .item-sub,
.day-turn .item-main strong,
.day-turn .item-sub,
.out-group .item-sub {
  white-space: normal;
}

/* En vivo › Fuera del salón ahora: one list per group. */
.out-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.out-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 6px;
  font-size: 15px;
  color: var(--text);
}

.out-group-title span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* En vivo › pantalla grande: for a TV, without the app's bars; the letters grow with the screen. */
body.tv-mode {
  background: var(--bg);
}

.tv {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
  font-size: clamp(15px, 1.25vw, 28px);
}

.tv-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-head img {
  width: 2.6em;
  height: 2.6em;
  border-radius: 22%;
}

.tv-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.tv-title strong {
  font-size: 1.5em;
  line-height: 1.15;
}

.tv-title small {
  overflow: hidden;
  font-size: 0.85em;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-clock {
  font-size: 1.9em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tv .stat strong {
  font-size: 2.2em;
}

.tv .stat span,
.tv .chip-btn,
.tv .hint,
.tv .tag,
.tv .count {
  font-size: 0.8em;
}

.tv .card-title {
  font-size: 1.3em;
}

.tv .section-title {
  font-size: 0.75em;
}

.tv .item-main strong,
.tv .out-group-title {
  font-size: 1.1em;
}

.tv .item-sub {
  font-size: 0.85em;
  white-space: normal;
}

.tv .item-icon {
  width: 2.4em;
  height: 2.4em;
}

.tv-page {
  flex: 1;
}

.tv-page .section:first-child {
  margin-top: 0;
}

.tv-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 900px) {
  .tv {
    padding: 24px 32px;
  }

  .tv .out-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22em, 1fr));
    align-items: start;
  }

  /* A service's turns in two columns, so more fit on the screen. */
  .tv .live-service .list.flat {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(26em, 1fr));
    column-gap: 24px;
  }

  .tv-foot {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
}

/* Accesos para repartir: one card per person, two per row when printed. */
.access-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.access-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.access-card header strong {
  display: block;
  font-size: 16px;
}

.access-card header small,
.access-card dt,
.access-steps {
  color: var(--muted);
  font-size: 12.5px;
}

.access-body {
  display: flex;
  align-items: center;
  gap: 14px;
}

.access-qr {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: 8px;
  background: #fff;
}

.access-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.access-body dl {
  margin: 0;
  min-width: 0;
}

.access-body dd {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.access-steps {
  margin: 0;
  padding-left: 18px;
}

.access-link {
  overflow-wrap: anywhere;
}

@media print {
  @page {
    margin: 10mm;
  }

  body,
  .main-col,
  .view {
    background: #fff !important;
  }

  .tabbar,
  .topbar,
  .no-print,
  #toasts {
    display: none !important;
  }

  .main-col,
  .view {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .access-sheet {
    grid-template-columns: repeat(2, 1fr);
    gap: 6mm;
    margin: 0;
  }

  .access-card {
    break-inside: avoid;
    border-color: #888;
    background: #fff;
  }

  .access-card,
  .access-card * {
    color: #000 !important;
  }
}

/* ---- Motion & touch ------------------------------------------------------ */
/* Short and only when something happens (under half a second); none of it with «reducir movimiento». */

/* Buttons you can feel: the main ones stand on a darker edge and sink into it when pressed. */
.btn-primary {
  box-shadow: 0 3px 0 var(--primary-press);
}

.btn-secondary {
  box-shadow: 0 3px 0 var(--soft-press);
}

.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 0 0 transparent;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  box-shadow: none;
}

/* While it loads: grey blocks where the cards will be. */
.loading.skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.skeleton i {
  display: block;
  height: 76px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.skeleton i:first-child {
  height: 132px;
}

/* «Se actualiza solo»: a green dot that breathes, like something live. */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 3px 1px 2px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: middle;
}

/* Done: the check in the green notice. */
.toast-ok {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-check {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast-check circle {
  stroke-opacity: 0.45;
}

/* A turn for the service: the brand's blue, not the red of an emergency, and rings around the icon. */
.alarm-turn {
  background: rgb(23 37 84 / 0.9);
  animation-name: alarm-turn-pulse;
}

@keyframes alarm-turn-pulse {
  from {
    background: rgb(23 37 84 / 0.92);
  }
  to {
    background: rgb(30 79 216 / 0.9);
  }
}

.alarm-turn .alarm-icon {
  position: relative;
  background: var(--primary-soft);
  color: var(--primary-text);
}

.alarm-kicker {
  margin: 4px 0 -4px;
  color: var(--primary-text) !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Phones: dialogs come up from the bottom, with a handle, the way the phone's own sheets do. */
@media (max-width: 559px) {
  .dialog {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: var(--safe-b);
  }

  .dialog::before {
    content: '';
    display: block;
    width: 38px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 3px;
    background: var(--border);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* A new screen comes in: deeper from the right, back from the left, another tab from below. */
  .view-inner.enter {
    animation: 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .view-inner.enter-in {
    animation-name: enter-in;
  }

  .view-inner.enter-back {
    animation-name: enter-back;
  }

  .view-inner.enter-up {
    animation-name: enter-up;
  }

  /* A screen with a bar fixed at the bottom only fades in: moving the screen would carry the bar with it. */
  .view-inner.enter:has(.action-bar) {
    animation-name: enter-fade;
  }

  @keyframes enter-fade {
    from {
      opacity: 0;
    }
  }

  @keyframes enter-in {
    from {
      opacity: 0;
      transform: translateX(18px);
    }
  }

  @keyframes enter-back {
    from {
      opacity: 0;
      transform: translateX(-18px);
    }
  }

  @keyframes enter-up {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }

  /* The rows of a list arrive one after another, a few hundredths of a second apart. */
  .view-inner.enter .list > * {
    animation: enter-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .view-inner.enter .list > :nth-child(2) { animation-delay: 0.03s; }
  .view-inner.enter .list > :nth-child(3) { animation-delay: 0.06s; }
  .view-inner.enter .list > :nth-child(4) { animation-delay: 0.09s; }
  .view-inner.enter .list > :nth-child(5) { animation-delay: 0.12s; }
  .view-inner.enter .list > :nth-child(n + 6) { animation-delay: 0.15s; }

  /* The tab you open bounces a little. */
  .tab.active .tab-icon {
    animation: tab-pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1);
  }

  @keyframes tab-pop {
    from {
      transform: scale(0.8);
    }
  }

  .btn {
    transition:
      transform 0.08s,
      box-shadow 0.08s,
      background 0.15s,
      opacity 0.15s;
  }

  .skeleton i {
    animation: skeleton 1.1s ease-in-out infinite alternate;
  }

  @keyframes skeleton {
    to {
      opacity: 0.45;
    }
  }

  .live-dot {
    animation: live-dot 1.6s ease-out infinite;
  }

  @keyframes live-dot {
    from {
      box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent);
    }
    to {
      box-shadow: 0 0 0 7px transparent;
    }
  }

  .toast-check path {
    stroke-dasharray: 16;
    stroke-dashoffset: 16;
    animation: draw-check 0.35s 0.12s ease-out forwards;
  }

  @keyframes draw-check {
    to {
      stroke-dashoffset: 0;
    }
  }

  .alarm-card {
    animation: alarm-in 0.32s cubic-bezier(0.2, 1.3, 0.4, 1);
  }

  @keyframes alarm-in {
    from {
      opacity: 0;
      transform: translateY(24px) scale(0.96);
    }
  }

  .alarm-turn .alarm-icon::before,
  .alarm-turn .alarm-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: ring-out 1.8s ease-out infinite;
  }

  .alarm-turn .alarm-icon::after {
    animation-delay: 0.9s;
  }

  @keyframes ring-out {
    from {
      opacity: 0.7;
      transform: scale(1);
    }
    to {
      opacity: 0;
      transform: scale(1.9);
    }
  }

  .dialog[open] {
    animation: dialog-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  @keyframes dialog-in {
    from {
      opacity: 0;
      transform: translateY(12px) scale(0.98);
    }
  }

  @media (max-width: 559px) {
    .dialog[open] {
      animation: sheet-up 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
    }

    @keyframes sheet-up {
      from {
        transform: translateY(100%);
      }
    }
  }
}

/* ---- Turnos: room to read ------------------------------------------------ */

/* «Pedir turno»: one wide row per service (name, then how it is now), not narrow tiles of wrapped words. */
.alert-actions.service-rows {
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .alert-actions.service-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.service-rows .alert-action {
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  text-align: left;
}

.service-rows .alert-action > .icon {
  color: var(--muted);
}

.service-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
}

.service-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.service-rows .alert-action strong {
  font-size: 16px;
}

.service-rows .alert-action small {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13.5px;
}

.service-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.42em;
  border-radius: 50%;
  background: var(--ok);
}

.is-off .service-dot {
  background: var(--warn);
}

/* The turns: more air between the name, the details and the tags. */
.item[data-turn] {
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
}

.item[data-turn] .item-icon {
  margin-top: 2px;
}

.item[data-turn] .item-main {
  gap: 4px;
}

.item[data-turn] .item-sub {
  line-height: 1.4;
}

.item[data-turn] .item-tags {
  gap: 8px;
  margin-top: 8px;
}

.item[data-turn] > .btn {
  align-self: center;
}

/* ---- Startup -------------------------------------------------------------- */
/* While the app starts, walking down a school hallway: the floor seams, the ceiling lights and the classroom doors
   come toward you from the light at the end. Flat shapes and scaling only (no 3D), so every phone draws it the same;
   it stands still with «reducir movimiento». */

.boot {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-height: 100dvh;
  padding: 24px;
  background: var(--bg);
}

/* Over the app while it appears (nothing behind it can be tapped yet), then it fades out. */
.boot.is-leaving {
  position: fixed;
  inset: 0;
  z-index: 300;
  transition: opacity 0.35s ease;
}

.boot.is-leaving.is-gone {
  opacity: 0;
  pointer-events: none;
}

.hall {
  --door: var(--primary);
  --wall: color-mix(in srgb, var(--primary-soft) 70%, var(--surface));
  --floor: color-mix(in srgb, var(--primary) 12%, var(--surface));
  --seam: color-mix(in srgb, var(--primary) 26%, var(--surface));
  --ceiling: var(--surface-2);
  --lamp: color-mix(in srgb, #fff 75%, var(--primary));
  position: relative;
  width: 200px;
  height: 200px;
  overflow: hidden;
  border-radius: 28px;
  background: var(--wall);
  box-shadow: 0 0 0 1px var(--border);
}

.hall i,
.hall span,
.hall b {
  position: absolute;
  display: block;
}

/* The hall itself, in perspective toward a point a little above the middle (50% 46%). */
.hall-ceiling,
.hall-floor,
.hall-end {
  inset: 0;
}

.hall-ceiling {
  background: var(--ceiling);
  clip-path: polygon(0 0, 100% 0, 60% 36.8%, 40% 36.8%);
}

.hall-floor {
  background: var(--floor);
  clip-path: polygon(0 100%, 100% 100%, 60% 56.8%, 40% 56.8%);
}

/* The light at the end. */
.hall-end {
  background: radial-gradient(circle at 50% 46%, #fff 0 7%, color-mix(in srgb, #fff 55%, transparent) 14%, transparent 30%);
}

/* A slice of the hall (a floor seam, a ceiling light and, every other one, a door on each side), drawn at the front
   and scaled from the end toward you. */
.hall-step {
  inset: 0;
  transform-origin: 50% 46%;
  transform: scale(0.2);
  opacity: 0;
}

.hall-step .seam {
  left: 0;
  right: 0;
  bottom: 0;
  height: 3%;
  background: var(--seam);
}

.hall-step .lamp {
  left: 38%;
  right: 38%;
  top: 0;
  height: 3%;
  border-radius: 2px;
  background: var(--lamp);
}

.hall-step .door {
  bottom: 0;
  width: 8%;
  height: 62%;
  border-radius: 2px 2px 0 0;
  background: var(--door);
}

.hall-step .door.l {
  left: 0;
}

.hall-step .door.r {
  right: 0;
}

.hall-step:nth-of-type(even) .door {
  display: none;
}

.boot-name {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .hall-step {
    animation: hall-step 2.4s cubic-bezier(0.6, 0, 1, 0.6) infinite;
  }

  .hall-step:nth-of-type(2) { animation-delay: -0.4s; }
  .hall-step:nth-of-type(3) { animation-delay: -0.8s; }
  .hall-step:nth-of-type(4) { animation-delay: -1.2s; }
  .hall-step:nth-of-type(5) { animation-delay: -1.6s; }
  .hall-step:nth-of-type(6) { animation-delay: -2s; }

  @keyframes hall-step {
    from {
      transform: scale(0.2);
      opacity: 0;
    }
    15% {
      opacity: 1;
    }
    to {
      transform: scale(2.6);
      opacity: 1;
    }
  }

  .hall-end {
    animation: hall-glow 1.8s ease-in-out infinite alternate;
  }

  @keyframes hall-glow {
    to {
      opacity: 0.7;
    }
  }
}

/* With less motion: the slices stand still along the hall. */
@media (prefers-reduced-motion: reduce) {
  .hall-step {
    opacity: 1;
  }

  .hall-step:nth-of-type(1) { transform: scale(0.28); }
  .hall-step:nth-of-type(2) { transform: scale(0.38); }
  .hall-step:nth-of-type(3) { transform: scale(0.52); }
  .hall-step:nth-of-type(4) { transform: scale(0.72); }
  .hall-step:nth-of-type(5) { transform: scale(1); }
  .hall-step:nth-of-type(6) { transform: scale(1.4); }
}

/* ---- Code of the day (authenticator app) ---- */
.mfa-qr {
  display: block;
  width: 220px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
}

.mfa-secret {
  word-break: break-all;
}

.steps-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

/* Glass boxes for the code: a blurred card over moving light, six boxes that pop in, glow, shake or turn green. */
.otp-screen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 32px 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #0b1533 0%, #1a3fae 52%, #5b2fc9 100%);
  color: #fff;
}

.otp-blob {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: otp-float 14s ease-in-out infinite alternate;
}

.otp-blob-1 { top: -80px; left: -60px; background: #38bdf8; }
.otp-blob-2 { right: -90px; bottom: 10%; background: #a855f7; animation-delay: -5s; }
.otp-blob-3 { bottom: -120px; left: 20%; background: #22d3ee; opacity: 0.35; animation-delay: -9s; }

@keyframes otp-float {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, -30px) scale(1.15); }
}

.otp-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 24px 60px rgba(4, 10, 40, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: otp-rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes otp-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

.otp-head { display: grid; justify-items: center; gap: 6px; text-align: center; }
.otp-head h1 { margin: 0; font-size: 24px; }
.otp-head p, .otp-lead { margin: 0; color: rgba(255, 255, 255, 0.82); text-align: center; }
.otp-card .steps-list, .otp-card details { color: rgba(255, 255, 255, 0.9); }
.otp-card summary { cursor: pointer; }

.otp-lock {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
}

.otp {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  cursor: text;
}

.otp-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px; /* no zoom on iPhone */
  opacity: 0;
}

.otp-box {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px rgba(4, 10, 40, 0.18);
  font: 700 26px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s;
}

.otp-box.is-filled { background: rgba(255, 255, 255, 0.22); animation: otp-pop 0.28s cubic-bezier(0.3, 1.6, 0.5, 1); }

.otp-box.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22), 0 0 26px rgba(125, 211, 252, 0.7);
  transform: translateY(-2px);
}

/* The blinking caret in the box that comes next. */
.otp-box.is-active:empty::after {
  content: '';
  width: 2px;
  height: 40%;
  border-radius: 2px;
  background: #fff;
  animation: otp-caret 1s steps(1) infinite;
}

@keyframes otp-pop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes otp-caret { 50% { opacity: 0; } }

.otp.is-error { animation: otp-shake 0.42s; }
.otp.is-error .otp-box { border-color: #fca5a5; background: rgba(239, 68, 68, 0.28); }

@keyframes otp-shake {
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

.otp.is-success .otp-box {
  border-color: #86efac;
  background: rgba(34, 197, 94, 0.38);
  box-shadow: 0 0 22px rgba(74, 222, 128, 0.55);
  animation: otp-wave 0.45s calc(var(--i) * 60ms) cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

@keyframes otp-wave {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

.otp-status { min-height: 20px; margin: 10px 0 0; color: rgba(255, 255, 255, 0.85); text-align: center; font-size: 14px; }

.otp-card .btn-secondary { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.14); color: #fff; }
.otp-card .btn-ghost-danger { color: #fecaca; }

@media (prefers-reduced-motion: reduce) {
  .otp-blob, .otp-card, .otp-box, .otp.is-error, .otp.is-success .otp-box, .otp-box.is-active:empty::after { animation: none; }
}

/* ---- Your account at the top (like Google's account menu) ---- */
.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.me-btn {
  position: relative;
  display: grid;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.me-btn:focus-visible, .side-brand:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }

/* The app's icon, small, on the corner of your picture. */
.me-btn-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg);
  border-radius: 5px;
}

button.side-brand {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.side-brand:hover { background: var(--surface-2); }
.side-brand-text { flex: 1; min-width: 0; }
.side-brand-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acct-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: calc(56px + var(--safe-t)) 10px 10px;
  background: rgba(8, 15, 35, 0.32);
  animation: acct-fade 0.18s ease both;
}

@media (min-width: 900px) {
  .acct-layer { padding: 84px 0 0 14px; }
}

.acct-sheet {
  display: grid;
  gap: 4px;
  width: min(380px, 100%);
  max-height: calc(100dvh - 80px);
  overflow: auto;
  padding: 10px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(8, 15, 35, 0.28);
  transform-origin: top left;
  animation: acct-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.acct-layer.is-closing { animation: acct-fade 0.16s ease reverse both; }
.acct-layer.is-closing .acct-sheet { animation: acct-in 0.16s ease reverse both; }

@keyframes acct-fade { from { opacity: 0; } }
@keyframes acct-in { from { opacity: 0; transform: scale(0.92) translateY(-8px); } }

.acct-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 10px; }
.acct-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.acct-brand img { border-radius: 7px; }

.acct-me {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 2px 0 6px;
  padding: 18px 12px 16px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--primary-soft), var(--surface-2));
  text-align: center;
}

.acct-me .avatar { margin-bottom: 6px; box-shadow: 0 0 0 4px var(--surface), 0 8px 24px rgba(30, 79, 216, 0.3); }
.acct-me strong { font-size: 18px; }
.acct-me small { color: var(--muted); }
.acct-profile { margin-top: 8px; border-radius: 999px; }

.acct-list { display: grid; gap: 2px; }

.acct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 16px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.acct-row:hover { background: var(--surface-2); }
.acct-row-text { flex: 1; min-width: 0; }
.acct-row-text strong { display: block; }
.acct-row-text small { display: block; color: var(--muted); font-size: 13px; }

.acct-add {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--primary);
}

.acct-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .acct-layer, .acct-sheet, .acct-layer.is-closing, .acct-layer.is-closing .acct-sheet { animation: none; }
}

/* ---- Código del día in Personal ---- */
.mfa-pick { cursor: pointer; }
.mfa-pick input[type='checkbox'] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--primary); }
.mfa-bar { display: flex; align-items: center; gap: 8px; }
.mfa-count { flex: 1; font-weight: 600; }
.mfa-reset { align-items: flex-start; line-height: 1.4; }

.mfa-qr svg { display: block; width: 100%; height: auto; }
.button-row.wrap { flex-wrap: wrap; }

/* Friendly pictures in the lists (Escuela amigable): the same tile, an emoji instead of a line icon. */
.item-icon.emoji-icon { font-size: 22px; line-height: 1; background: #fff4e6; }
.item-icon.emoji-icon.is-danger { background: #ffe3e3; }
.item-icon.emoji-icon.is-ok { background: #e6fcf5; }
@media (prefers-color-scheme: dark) {
  .item-icon.emoji-icon { background: #3a2f22; }
  .item-icon.emoji-icon.is-danger { background: #4a2328; }
  .item-icon.emoji-icon.is-ok { background: #1f3b33; }
}

/* ---- Platform: usage per school ---- */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 6px;
}
.usage-grid span { display: grid; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.usage-grid strong { font-size: 18px; }
.usage-grid small { color: var(--muted); font-size: 12px; }
.muted.small { font-size: 13px; margin: 0 0 8px; }
