/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--canvas); }

/* ---------- Sign in (split layout) ---------- */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr); background: var(--surface); }
.login-art {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100dvh; padding: 40px clamp(32px, 5vw, 80px);
  overflow: hidden; color: #fff; isolation: isolate;
  background:
    radial-gradient(ellipse 70% 55% at 12% 12%, rgba(214, 178, 94, .30), transparent 70%),
    radial-gradient(ellipse 60% 50% at 96% 104%, rgba(8, 8, 10, .6), transparent 70%),
    linear-gradient(155deg, #3b3e46 0%, #23262c 48%, #0f1013 100%);
}
.login-art::after {
  content: ""; position: absolute; z-index: -1; right: 2%; bottom: 8%; width: min(70%, 78vh); aspect-ratio: 348 / 313;
  background: url("/assets/sta-mascot.png") center / contain no-repeat; opacity: .12; mask-image: linear-gradient(to right, transparent, #000 70%);
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand strong { display: block; font-size: 21px; letter-spacing: .02em; }
.login-brand span { color: #ddd2ae; font-size: 12px; }
.login-hero { max-width: 640px; }
.art-eyebrow { margin: 0 0 14px; color: var(--gold-bright); font-size: 12px; font-weight: 750; letter-spacing: .24em; text-transform: uppercase; }
.login-hero h1 { color: #fff; font-size: clamp(48px, 5.6vw, 88px); line-height: 1; letter-spacing: -.04em; }
.art-rule { display: block; width: 72px; height: 3px; margin: 28px 0 32px; border-radius: 3px; background: linear-gradient(90deg, var(--gold-bright), rgba(var(--gold-rgb), .1)); }
.art-today { display: inline-flex; align-items: center; gap: 18px; padding: 14px 24px 14px 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.07); backdrop-filter: blur(8px); }
.art-today-icon { display: grid; place-items: center; width: 44px; height: 44px; color: var(--gold-bright); border-radius: 12px; background: rgba(var(--gold-rgb), .14); }
.art-time { font-size: clamp(28px, 2.4vw, 40px); font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.art-divider { align-self: stretch; width: 1px; background: rgba(255,255,255,.18); }
.art-date strong, .art-date span { display: block; white-space: nowrap; }
.art-date strong { font-size: 15px; }
.art-date span { margin-top: 4px; color: #ddd2ae; font-size: 11.5px; letter-spacing: .04em; }
.login-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.6); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.login-main { position: relative; display: grid; place-items: center; padding: 56px 40px; background: radial-gradient(ellipse 80% 60% at 78% 8%, var(--gold-soft), transparent 70%), var(--surface-2); }
.theme-toggle { position: absolute; top: 20px; right: 20px; }
.login-card { width: min(100%, 430px); padding: 36px 36px 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 1px 2px rgba(22,24,28,.05), 0 30px 70px -34px rgba(22,24,28,.35); }
.login-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.login-card h2 { font-size: 28px; letter-spacing: -.04em; }
.login-card-head p { margin-top: 3px; color: var(--slate); font-size: 13.5px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 64px; }
.show-pass { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; background: none; color: var(--gold-ink); font-size: 12.5px; font-weight: 700; padding: 6px; }
.btn.block { width: 100%; }
.login-note { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.login-note .ui-icon { width: 14px; height: 14px; }

/* ---------- Onboarding / locked ---------- */
.onboard { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--gold-soft), transparent 70%), var(--canvas); }
.onboard-card { width: min(100%, 480px); padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-3); }
.onboard-card > img { display: block; margin-bottom: 18px; }
.onboard-card h1 { font-size: 26px; }
.onboard-card > p { margin: 6px 0 22px; color: var(--slate); }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps i { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--gold); }
.pin-input { font-size: 28px !important; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; color: var(--chrome-ink); background: linear-gradient(180deg, var(--chrome-2), var(--chrome)); border-right: 1px solid rgba(var(--gold-rgb), .12); }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-brand small { display: block; color: var(--gold-bright); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.side-brand strong { display: block; font-size: 16px; line-height: 1.15; }
.side-brand span { color: var(--chrome-muted); font-size: 11.5px; }
nav#nav { flex: 1; overflow-y: auto; padding: 12px 12px; }
.nav-group { margin: 14px 10px 6px; color: var(--chrome-muted); font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
.nav-group:first-child { margin-top: 4px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: #d8d3c6; text-decoration: none; font-weight: 560; font-size: 14px; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link[aria-current="page"] { background: rgba(var(--gold-rgb), .13); color: #fff; box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), .22); }
.nav-link[aria-current="page"] .ui-icon { color: var(--gold-bright); }
.nav-link .badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 750; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: 4px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.side-user:hover { background: rgba(255,255,255,.06); }
.side-user .avatar { background: rgba(var(--gold-rgb), .16); color: var(--gold-bright); }
.side-user strong { display: block; font-size: 13px; }
.side-user small { display: block; color: var(--chrome-muted); font-size: 11.5px; }
.side-link { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: #cfc9bb; font-size: 13.5px; text-align: left; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); }
.menu-btn { display: none !important; }
.top-clock { display: flex; align-items: center; gap: 14px; min-width: 0; }
.top-clock > strong { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.top-clock div { display: grid; padding-left: 14px; border-left: 1px solid var(--line); min-width: 0; }
.top-clock span { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-clock small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hall-pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.hall-pill.busy { background: var(--amber-soft); color: var(--amber); }
.hall-pill.full { background: var(--red-soft); color: var(--red); }
.hall-pill .dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }

.page { width: 100%; max-width: 1400px; padding: 28px 32px 56px; outline: 0; }
.page:focus-visible { box-shadow: none; } /* focused on navigation for screen readers, not a control */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p.sub { margin-top: 6px; color: var(--slate); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; min-width: 0; }
.toolbar select, .toolbar input { width: auto; min-height: 38px; }
.search-box { position: relative; }
.search-box .ui-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { width: 100%; padding-left: 36px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: minmax(250px, 1.3fr) repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 124px; padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1); text-decoration: none; color: inherit; }
a.tile:hover { border-color: var(--gold-line); }
.tile-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--slate); font-size: 12.5px; font-weight: 650; }
.tile-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--gold-soft); color: var(--gold-ink); }
.tile-icon.red { background: var(--red-soft); color: var(--red); }
.tile-icon.green { background: var(--green-soft); color: var(--green); }
.tile-icon.blue { background: var(--blue-soft); color: var(--blue); }
.tile-icon.purple { background: var(--purple-soft); color: var(--purple); }
.tile-icon .ui-icon { width: 17px; height: 17px; }
.tile-value { margin-top: auto; font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.tile-sub { color: var(--muted); font-size: 12px; }
.tile.hero { color: #fff; border-color: transparent; background: radial-gradient(ellipse 80% 90% at 100% 100%, rgba(var(--gold-rgb), .2), transparent 60%), linear-gradient(150deg, #2f3239, #16181c); overflow: hidden; }
.tile.hero .tile-label { color: #e9e3d2; }
.tile.hero .tile-icon { background: rgba(var(--gold-rgb), .16); color: var(--gold-bright); }
.tile.hero .tile-value { font-size: 56px; }
.tile.hero .tile-sub { color: #cfc8b4; }
.tile.hero .meter { margin-top: 10px; background: rgba(255,255,255,.14); }
.tile.hero .meter > i { background: var(--gold-bright); }
.tile.hero .meter.bad > i { background: #ff8a80; }
.delta { font-size: 12px; font-weight: 650; }

/* ---------- Setup checklist ---------- */
.setup { margin-bottom: 20px; }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; padding: 0 20px 20px; }
.setup-step { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none; }
.setup-step:hover { border-color: var(--gold-line); }
.setup-step .mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); flex: 0 0 auto; color: transparent; }
.setup-step.done .mark { border-color: var(--green); background: var(--green); color: #fff; }
.setup-step strong { display: block; font-size: 13.5px; }
.setup-step span { color: var(--muted); font-size: 12.5px; }

/* ---------- Live pass rows ---------- */
.pass-list { display: grid; }
.pass-row { display: grid; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) 120px auto; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); }
.pass-row:first-child { border-top: 0; }
.pass-row.overdue { background: linear-gradient(90deg, var(--red-soft), transparent 70%); }
.pass-who strong { display: block; font-size: 14.5px; }
.pass-who span { color: var(--muted); font-size: 12.5px; }
.pass-where { display: grid; gap: 3px; font-size: 13px; color: var(--slate); min-width: 0; }
.pass-where .chip, .pass-where .dest-chip { justify-self: start; }
.pass-time { display: grid; gap: 6px; text-align: right; }
.pass-time strong { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pass-row.overdue .pass-time strong { color: var(--red); }
.pass-time small { color: var(--muted); font-size: 11.5px; }
.flag-note { display: inline-flex; align-items: center; gap: 4px; color: var(--purple); font-size: 12px; font-weight: 650; }
.flag-note .ui-icon { width: 14px; height: 14px; }

.dest-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 8px; font-size: 12.5px; font-weight: 650; background: var(--surface-3); color: var(--slate); }
.dest-chip .ui-icon { width: 15px; height: 15px; }
.dest-restroom { background: var(--blue-soft); color: var(--blue); }
.dest-nurse { background: var(--red-soft); color: var(--red); }
.dest-office { background: var(--gold-soft); color: var(--gold-ink); }
.dest-attendance { background: var(--green-soft); color: var(--green); }
.dest-library, .dest-counselor, .dest-guidance { background: var(--purple-soft); color: var(--purple); }
.dest-principal { background: var(--amber-soft); color: var(--amber); }

/* ---------- Bar lists (single series, one hue) ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 52px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row > span:first-child { color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row.current > span:first-child { color: var(--ink); font-weight: 700; }
.bar-track { position: relative; height: 16px; }
.bar-track i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--chart); }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 650; }
.bar-row[data-tip] { cursor: default; }

.columns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 10px; height: 180px; padding-top: 22px; border-bottom: 1px solid var(--line); }
.col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.col i { width: min(24px, 60%); border-radius: 4px 4px 0 0; background: var(--chart); min-height: 2px; }
.col b { position: absolute; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; transform: translateY(-18px); }
.col-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.chart-tip { position: fixed; z-index: 300; pointer-events: none; padding: 8px 11px; border-radius: 9px; background: var(--chrome); color: #fff; font-size: 12.5px; box-shadow: var(--shadow-3); white-space: nowrap; }
.chart-tip strong { display: block; }

.mini-list { display: grid; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.mini-row:first-child { border-top: 0; }
.mini-row .grow { flex: 1; min-width: 0; }
.mini-row strong { display: block; font-size: 13.5px; }
.mini-row small { color: var(--muted); }

/* ---------- Room cards ---------- */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.room-card { display: flex; flex-direction: column; gap: 6px; min-height: 110px; padding: 18px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; }
.room-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.room-card[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.room-card strong { font-size: 17px; }
.room-card span { color: var(--muted); font-size: 13px; }
.room-card .chip { align-self: flex-start; margin-top: auto; }

/* ---------- Pair alerts ---------- */
.pair-card { padding: 18px 20px; border-top: 1px solid var(--line); }
.pair-card:first-child { border-top: 0; }
.pair-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pair-names { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.pair-names a { font-weight: 680; color: var(--ink); text-decoration: none; }
.pair-names a:hover { text-decoration: underline; }
.pair-names .ui-icon { color: var(--purple); }
.pair-count { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px; background: var(--purple-soft); color: var(--purple); font-size: 20px; font-weight: 750; }
.pair-times { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pair-times .chip { height: auto; min-height: 24px; padding: 4px 9px; white-space: normal; }

/* ---------- Student drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(12,12,10,.4); animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 91; width: min(560px, 100vw); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-3); animation: slide .22s var(--ease); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .avatar { width: 48px; height: 48px; font-size: 16px; border-radius: 14px; }
.drawer-head h2 { font-size: 21px; }
.drawer-head p { color: var(--muted); font-size: 13px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 24px 32px; display: grid; gap: 22px; align-content: start; }
.drawer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.drawer-stats div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.drawer-stats strong { display: block; font-size: 22px; letter-spacing: -.02em; }
.drawer-stats span { color: var(--muted); font-size: 12px; }
.section-title { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.plain-list { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.plain-list > div { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.plain-list > div:first-child { border-top: 0; }
.plain-list .grow { flex: 1; min-width: 0; }

/* ---------- Pickers, import ---------- */
.picker { position: relative; }
.picker input { padding-right: 40px; }
.picker-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); }
.field.picker .picker-toggle { top: auto; bottom: 6px; transform: none; }
.picker-toggle:hover { background: var(--surface-3); color: var(--ink); }
.picker-count { padding: 6px 10px 4px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.picker-list button.selected strong { color: var(--gold-ink); }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; display: grid; align-content: start; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-3); max-height: 320px; overflow-y: auto; }
.picker-list button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; }
.picker-list button.active, .picker-list button:hover { background: var(--gold-soft); }
.picker-list .avatar { width: 30px; height: 30px; font-size: 11.5px; border-radius: 8px; }
.picker-list strong { display: block; font-size: 13.5px; }
.picker-list small { color: var(--muted); font-size: 12px; }

.dropzone { display: grid; justify-items: center; gap: 10px; padding: 34px 20px; border: 2px dashed var(--line-strong); border-radius: 16px; background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: var(--gold-soft); }
.dropzone .ui-icon { width: 34px; height: 34px; color: var(--gold-ink); }
.dropzone strong { font-size: 15px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.format-sample { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.7; white-space: pre; overflow-x: auto; }
.summary-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preview-table { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 12px; background: var(--chrome); color: #fff; }
.bulk-bar .btn { min-height: 32px; }

/* Settings rows */
.set-section { margin-bottom: 20px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 18px; }
.edit-rows { display: grid; gap: 8px; }
.edit-row { display: grid; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.edit-row.dest { grid-template-columns: 34px minmax(120px, 1.3fr) minmax(130px, 1fr) 110px auto auto auto; }
.edit-row.period { grid-template-columns: minmax(120px, 1.4fr) 130px 130px auto; }
.edit-row input, .edit-row select { min-height: 38px; }
.edit-row .dest-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--gold-soft); color: var(--gold-ink); }
.edit-row .mini-label { display: none; }
.row-actions { display: flex; gap: 4px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav strong { min-width: 190px; text-align: center; font-size: 15px; }

.credentials td code { font-size: 13.5px; font-weight: 700; }
.setup-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--slate); }
.setup-list strong { color: var(--ink); word-break: break-all; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .tile.hero { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: auto; padding: 28px 24px; gap: 28px; }
  .login-hero h1 { font-size: 48px; }
  .art-today, .login-foot { display: none; }
  .art-rule { margin: 18px 0 0; }
  .login-main { padding: 28px 16px 40px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: 272px; transform: translateX(-100%); transition: transform .22s var(--ease); }
  .shell.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex !important; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .top-clock > strong { font-size: 20px; }
  .top-clock small { display: none; }
  .page { padding: 20px 16px 48px; }
  .pass-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; }
  .pass-row .pass-end { grid-column: 3; grid-row: 1; }
  .pass-row .pass-where { grid-column: 2 / -1; grid-row: 2; }
  .pass-row .pass-time { grid-column: 2 / -1; grid-row: 3; display: flex; align-items: baseline; gap: 10px; text-align: left; }
  .edit-row.dest, .edit-row.period { grid-template-columns: 1fr 1fr; }
  .edit-row .dest-icon { display: none; }
  .edit-row .mini-label { display: block; color: var(--muted); font-size: 11.5px; font-weight: 650; }
}
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .top-clock div { display: none; }
  .hall-pill { padding: 0 10px; }
  .drawer-stats { grid-template-columns: 1fr 1fr; }
  .tile.hero .tile-value { font-size: 44px; }
  .login-card { padding: 26px 20px 22px; }
  .bar-row { grid-template-columns: 84px minmax(0, 1fr) 44px; }
  .week-nav strong { min-width: 0; font-size: 13.5px; }
}

/* ---------- Print (weekly report) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  table.data th { position: static; }
}

/* Print the whole student table, not just the first rows. */
@media print { #r-more { display: none !important; } }

/* Classes page */
table.data tr.group-start td { border-top: 2px solid var(--line-strong); }
table.data tr:first-child.group-start td { border-top: 0; }
code.pin { font-size: 15px; font-weight: 750; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.roster-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.roster-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 3px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.roster-chip .avatar { width: 24px; height: 24px; border-radius: 50%; font-size: 10px; }
.roster-chip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.roster-chip button:hover { background: var(--red-soft); color: var(--red); }
.my-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 0 20px 20px; }
.my-class { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.my-class strong { display: block; }
.my-class .pin { display: block; margin: 6px 0 2px; font-size: 20px; }

/* Printed PIN list */
.print-sheet { display: none; }
@media print {
  body.print-pins > :not(.print-sheet) { display: none !important; }
  body.print-pins .print-sheet { display: block; color: #000; font-family: var(--font); }
  .print-sheet h1 { font-size: 22px; margin-bottom: 4px; }
  .print-sheet > p { margin-bottom: 16px; }
  .print-sheet section { break-inside: avoid; margin-bottom: 14px; }
  .print-sheet h2 { font-size: 15px; border-bottom: 1px solid #999; padding-bottom: 4px; margin-bottom: 6px; }
  .print-sheet table { border-collapse: collapse; }
  .print-sheet td { padding: 3px 24px 3px 0; font-size: 13px; }
  .print-sheet code { font-size: 15px; font-weight: 700; letter-spacing: .08em; }
}

/* Schedule grid: classes x mods, a teacher dropdown in each cell */
.schedule-grid th, .schedule-grid td { padding: 6px 5px; text-align: left; }
.schedule-grid thead th { white-space: nowrap; }
.schedule-grid thead th small { display: block; color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.schedule-grid tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); white-space: nowrap; }
.schedule-grid tbody th small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.schedule-grid select { width: 100%; min-width: 104px; min-height: 36px; padding: 6px 4px 6px 7px; font-size: 12.5px; }
.schedule-grid .now { background: var(--gold-soft); }
.schedule-grid thead th.now { color: var(--gold-ink); }
.schedule-grid td.doubled select { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-soft); }
.class-name { border: 0; background: none; padding: 0; color: var(--ink); font-size: 16px; font-weight: 750; text-decoration: underline dotted var(--line-strong); text-underline-offset: 4px; }
.class-name:hover { color: var(--gold-ink); }
.today-mods { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.today-mods span { padding: 3px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; }
.today-mods span.now { border-color: var(--gold); background: var(--gold-soft); font-weight: 700; }
.pass-student-now { margin: -4px 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.dest-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.dest-pick button { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; font-weight: 650; }
.dest-pick button:hover, .dest-pick button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.dest-pick small { color: var(--muted); font-weight: 500; }
.create-pass-btn { min-height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }

/* My class: the teacher's pass screen. Just the class, and who's out. */
.mc { max-width: 1120px; }
.mc-search { flex: 0 1 280px; }
/* The Sub button and the search, side by side (the search input fills its box,
   so it gets a set width here or the row wraps). */
.mc-actions { flex-wrap: nowrap; }
.mc-actions .mc-search { flex: none; width: 260px; }
.mc-out { margin-bottom: 18px; overflow: hidden; border: 1.5px solid var(--gold-line); border-radius: 14px; background: var(--gold-soft); }
.mc-out-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; }
.mc-out-row + .mc-out-row { border-top: 1px solid var(--gold-line); }
.mc-out-row .grow { flex: 1; min-width: 0; }
.mc-out-row .grow strong { display: block; font-size: 15px; }
.mc-out-row small { color: var(--slate); font-size: 13px; }
.mc-timer { font-size: 17px; }
.overdue-row { background: var(--red-soft); }
.overdue-row .mc-timer { color: var(--red); }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; align-content: start; }
.name-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 70px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; transition: border-color .12s, background .12s, transform .12s var(--ease); }
.name-tile:hover, .name-tile:focus-visible { border-color: var(--gold); background: var(--gold-soft); transform: translateY(-1px); }
.name-tile strong { max-width: 100%; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.name-tile span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.name-tile:has(em) strong { max-width: calc(100% - 44px); }
.name-tile em { position: absolute; top: 9px; right: 9px; padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--slate); font-size: 11px; font-style: normal; font-weight: 700; }
.name-tile.is-out { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-soft); }
.name-tile.is-out span { color: var(--red); font-weight: 650; }
/* Passes used today, under the name; red once there are none left. */
.name-tile small { max-width: 100%; overflow: hidden; margin-top: 2px; color: var(--slate); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.name-tile small.is-spent { color: var(--red); }
/* Requested: someone (the counselor, the office...) asked for this student. */
.name-tile.is-requested { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: var(--blue-soft); }
.name-tile small.is-requested { color: var(--blue); }
.mc-req { margin-bottom: 18px; overflow: hidden; border: 1.5px solid var(--blue-line); border-radius: 14px; background: var(--blue-soft); }
.mc-req-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; }
.mc-req-row + .mc-req-row { border-top: 1px solid var(--blue-line); }
.mc-req-row .grow { flex: 1; min-width: 0; }
.mc-req-row .grow strong { display: block; font-size: 15px; }
.mc-req-row small { color: var(--slate); font-size: 13px; }
.dest-pick button.is-requested { border-color: var(--blue); background: var(--blue-soft); }
.dest-pick button:disabled { opacity: .5; cursor: not-allowed; }
.dest-pick button:disabled:hover { border-color: var(--line); background: var(--surface); }
.mc-empty { grid-column: 1 / -1; padding: 56px 20px; border: 1.5px dashed var(--line); border-radius: 14px; }
.dest-pick.big { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dest-pick.big button { flex-direction: row; align-items: center; gap: 14px; min-height: 76px; padding: 14px 16px; font-size: 16.5px; }
.dest-pick.big button .ui-icon { flex: none; color: var(--gold-ink); }
.dest-pick.big button span { display: grid; gap: 2px; }
.dest-pick.big small { font-size: 12.5px; }
@media (max-width: 560px) { .mc-search { flex-basis: 100%; } .mc-actions { width: 100%; flex-wrap: wrap; } .mc-actions .mc-search { width: 100%; } .name-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dest-pick.big { grid-template-columns: 1fr; } .mc-req-row { flex-wrap: wrap; } }

/* My office: room tabs (administrators run every office) and the request form. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--slate); font-weight: 650; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--gold-soft); color: var(--gold-ink); }
.req-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.req-form .btn { min-height: 42px; }
.req-form .form-error { grid-column: 1 / -1; margin: 0; }
.req-form .form-error:empty { display: none; }

/* Lockdown: a solid red bar under the top bar on every screen, the same red
   in both themes (white text on it is 5.6:1). */
.lockdown-bar { --alarm: #c62828; position: sticky; top: 72px; z-index: 29; display: flex; align-items: center; gap: 16px; padding: 16px 32px; background: var(--alarm); color: #fff; box-shadow: 0 8px 20px rgb(0 0 0 / .18); }
.lockdown-icon { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 14px; background: rgb(255 255 255 / .16); }
.lockdown-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.lockdown-text strong { font-size: clamp(22px, 3vw, 32px); font-weight: 850; line-height: 1.1; letter-spacing: .02em; text-transform: uppercase; }
.lockdown-text span { font-size: 14.5px; opacity: .92; }
.btn.lockdown-end { flex: none; border-color: #fff; background: #fff; color: var(--alarm); font-weight: 750; }
.btn.lockdown-end:hover { border-color: #ffe3e1; background: #ffe3e1; }
.locked-down .lockdown-start { display: none; }
.name-tile.is-locked { opacity: .45; cursor: not-allowed; }
.name-tile.is-locked:hover, .name-tile.is-locked:focus-visible { border-color: var(--line); background: var(--surface-2); transform: none; }
@media (max-width: 900px) {
  .lockdown-bar { position: static; flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .lockdown-icon { width: 44px; height: 44px; }
  .btn.lockdown-end { width: 100%; justify-content: center; }
}
