/* Role-based views (roles.js). Cosmetic only: nothing is removed from the HTML the server sends. */
html[data-view="parent"] [data-for]:not([data-for~="parent"]):not([data-for~="student"]),
html[data-view="student"] [data-for]:not([data-for~="student"]),
html[data-view="teacher"] [data-for]:not([data-for~="teacher"]),
html[data-view="school"] [data-for]:not([data-for~="school"]) { display: none !important; }
.page.xv-gated > *:not(.xv-gate) { display: none !important; }
.xv-gate { max-width: 520px; margin: 2rem auto; padding: 1.25rem 1.4rem; text-align: center; border: 1.5px solid var(--border, var(--xag-c-line)); border-radius: var(--xag-radius); background: var(--white, var(--xag-c-surface)); color: var(--navy, var(--xag-c-text)); }
.xv-gate p { margin: 0 0 .8rem; font-weight: 600; }
.xv-gate-b { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.xv-card { position: relative; z-index: 2; max-width: 1120px; margin: .5rem auto 0; padding: 0 1.15rem; }
.xv-card-in { position: relative; padding-right: 3.4rem !important; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; padding: .6rem .9rem; border: 1.5px solid var(--border, var(--xag-c-line)); border-radius: var(--xag-radius); background: var(--xl-tint, var(--xag-c-surface-2)); color: var(--navy, var(--xag-c-text)); }
/* No layout shift: a first-time visitor (no xag_view / xag_view_seen / session) gets html.xv-first from xag-theme-early.js, which holds the space the card will fill; roles.js drops the class in the same frame that it adds the card. The card never gets shorter than the held space. */
html.xv-first #main { margin-top: 210px; }
.xv-card-in { box-sizing: border-box; min-height: 87px; }
@media (max-width: 900px) { html.xv-first #main { margin-top: 114px; } .xv-card-in { min-height: 106px; } }
@media (max-width: 700px) { html.xv-first #main { margin-top: 144px; } .xv-card-in { min-height: 136px; } }
@media (max-width: 480px) { html.xv-first #main { margin-top: 210px; } .xv-card-in { min-height: 202px; } }
@media (min-width: 901px) { html.xv-first #main { margin-top: 95px; } }
.xv-t { margin: 0; font-weight: 700; font-size: .95rem; }
.xv-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.xv-b { min-height: 40px; }
/* the Skip link is the shared round close button (.xag-close) in the card's top corner */
.xv-h { margin: 0; flex-basis: 100%; font-size: .78rem; opacity: .8; }
.xv-as { display: inline-flex; align-items: center; gap: .3rem; order: 0; font-size: .75rem; }
.xv-as[hidden] { display: none; }
.xv-as select { min-height: 36px; max-width: 120px; font-size: .78rem; border-radius: 8px; border: 1.5px solid var(--border, var(--xag-c-line)); padding: 0 .3rem; background: var(--white, var(--xag-c-surface)); color: var(--navy, var(--xag-c-text)); }
@media (max-width: 700px) { .xv-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
@media (max-width: 700px) { .xv-as select { max-width: 84px; font-size: .7rem; padding: 0 .15rem; } }
/* Admin viewing as a role: one standing chip (standard pill, icon + text), no timer, no dialog */
.xv-chip { position: fixed; z-index: var(--xag-z-sticky, 200); bottom: 16px; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 6px 0 14px; border-radius: var(--xag-btn-radius, 999px); border: 1.5px solid var(--border, var(--xag-c-line)); background: var(--white, var(--xag-c-surface)); color: var(--navy, var(--xag-c-text)); font-size: .85rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 700px) { .xv-chip { left: 10px; right: auto; margin: 0; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 20px - 52px); } .xv-chip-o { font-size: .8rem; } .xv-chip-b { padding: 0 10px; font-size: .8rem; } .xv-panel { left: 0; transform: none; width: min(20rem, calc(100vw - 20px)); } }
/* Phone: one bottom dock (owner 2026-11-08). The chip sits left, the Quick tools button (admin only, quick-tools.js) right and icon only, on an opaque strip, and the page gets matching bottom padding so neither covers content. Kept here, not in quick-tools.js, whose own CSS has no phone layout (test). */
@media (max-width: 700px) {
  body:has(#xagQtBtn, .xv-chip) { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
  body:has(#xagQtBtn, .xv-chip)::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: calc(64px + env(safe-area-inset-bottom, 0px)); background: var(--xag-c-surface, rgb(16, 48, 107)); border-top: 1px solid var(--xag-c-line, rgba(125, 211, 252, .35)); z-index: 199; pointer-events: none; }
  #xagQtBtn.xag-qt-btn { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding: 0; width: 44px; justify-content: center; }
  #xagQtBtn.xag-qt-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .xag-qt-panel { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); right: 10px; }
  .xag-qt-note { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
.xv-chip svg { flex: none; }
.xv-chip-o { display: inline-flex; align-items: center; gap: .5rem; min-height: 34px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.xv-panel { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: min(20rem, calc(100vw - 24px)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 8px; padding: 10px; border-radius: 16px; border: 1px solid rgba(125, 211, 252, .28); background: rgba(16, 48, 107, .86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 36px rgba(3, 10, 30, .5); }
.xv-panel[hidden] { display: none; }
.xv-pick { min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(125, 211, 252, .35); background: rgba(26, 61, 129, .9); color: rgb(216, 228, 251); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.xv-pick:hover { border-color: rgb(255, 176, 0); color: rgb(255, 255, 255); }
.xv-pick[aria-pressed="true"] { background: rgb(255, 176, 0); border-color: rgb(255, 176, 0); color: rgb(26, 17, 0); }
.xv-pick:focus-visible, .xv-chip-o:focus-visible { outline: 3px solid rgb(255, 180, 92); outline-offset: 2px; }
.xv-chip-b { min-height: 34px; padding: 0 14px; border-radius: var(--xag-btn-radius, 999px); border: 1.5px solid var(--border, var(--xag-c-line)); background: transparent; color: inherit; font: inherit; cursor: pointer; }

/* viewing as someone else: the admin page and its buttons are hidden, as they are for the real person */
html[data-view] #page-admin, html[data-view] [data-xad="admin"], html[data-view] .ft-admin, html[data-view] [data-xag-styleguide], html[data-view] #xagQtBtn, html[data-view] #xagQtPanel { display: none !important; }   /* the admin link, the style guide link and Quick tools are the admin's own: not drawn while viewing as someone else */
