/* MLA Timetabling: product styles on top of app.css */

body { font-feature-settings: "tnum" 0; }
.num, td.n, .kpi-value, .figure { font-variant-numeric: tabular-nums; }

/* shell */
.brand { display: grid; gap: 14px; padding: 4px 8px 12px; }
.brand img { width: 132px; height: auto; }
.brand .product { font-weight: 600; font-size: 16px; color: var(--text); }
.scope { display: grid; gap: 2px; padding: 10px 10px; margin: 0 0 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.scope b { font-weight: 600; }
.scope span { color: var(--muted); font-size: var(--fs-small); }
.nav-item .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--negative); color: #fff; font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.viewer { display: grid; gap: 6px; padding: 12px 8px 4px; border-top: 1px solid var(--border); }
.viewer label { color: var(--muted); font-size: var(--fs-small); }
.viewer select { width: 100%; }
.clock { display: flex; justify-content: space-between; gap: 8px; padding: 8px; color: var(--muted); font-size: var(--fs-small); }
.clock b { color: var(--text); font-weight: 500; }
.sfstate { display: flex; align-items: center; gap: 8px; padding: 0 8px 4px; color: var(--muted); font-size: var(--fs-small); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); flex: none; }
.dot.off { background: var(--negative); }
.dot.wait { background: #c58a14; }

.canvas { max-width: 1480px; }
.title-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.finding { margin-top: 6px; color: var(--text); }
.finding b { font-weight: 600; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
.stack { display: grid; gap: var(--gap); align-content: start; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.danger { color: var(--negative); }
a.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #b9c3d1; }
a.link:hover { text-decoration-color: currentColor; }

/* readiness: the term's pipeline as one divided strip */
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.stage { padding: 16px 20px; display: grid; gap: 6px; align-content: start; }
.stage + .stage { border-left: 1px solid var(--border); }
.stage .label { color: var(--muted); }
.stage .value { font-size: 28px; line-height: 1.1; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stage .value small { font-size: 15px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stage .note { font-size: var(--fs-small); color: var(--muted); }
.stage .bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.stage .bar i { display: block; height: 100%; background: var(--accent); }
.stage.done .label::after { content: " \2713"; color: var(--positive); }

/* issue list */
.issue { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; }
.issue .kind { min-width: 76px; }

/* today */
.today-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; }
.today-row .time { font-variant-numeric: tabular-nums; color: var(--muted); }
.today-row .what b { font-weight: 600; }
.today-row .what span { display: block; color: var(--muted); font-size: var(--fs-small); }
.today-row.now .time { color: var(--text); font-weight: 600; }

/* ratio bars (attendance by programme) */
.ratio { display: grid; gap: 12px; }
.ratio-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) 56px; gap: 12px; align-items: center; }
.ratio-row .name span { display: block; color: var(--muted); font-size: var(--fs-small); }
.ratio-track { position: relative; height: 12px; background: var(--raised); border-radius: 2px; }
.ratio-track i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 2px; }
.ratio-track i.low { background: var(--negative); }
.ratio-track .target { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.ratio-row .n { text-align: right; font-variant-numeric: tabular-nums; }

/* week grid */
.weekbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: var(--gap); }
.weekbar .week-label { font-weight: 600; min-width: 210px; }
.timetable { display: grid; width: max-content; min-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.tt-wrap { overflow-x: auto; }
.tt-head { position: sticky; top: 0; z-index: 2; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; }
.tt-head span { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-small); }
.tt-head.today { color: var(--accent); }
.tt-head.closed span { color: var(--negative); }
.tt-times { position: relative; border-right: 1px solid var(--border); }
.tt-times div:first-child { transform: translateY(2px); }
.tt-times div { position: absolute; right: 8px; transform: translateY(-50%); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tt-day { position: relative; border-left: 1px solid var(--rule); background-image: linear-gradient(var(--rule) 1px, transparent 1px); background-size: 100% var(--hour); }
.tt-day.closed { background-color: #f6f7f9; background-image: repeating-linear-gradient(135deg, transparent 0 7px, #e9ecf0 7px 8px); }
.tt-session { position: absolute; padding: 5px 7px 5px 9px; border-radius: 4px; background: #eef2f7; border-left: 3px solid var(--accent); overflow: hidden; cursor: pointer; font-size: 12.5px; line-height: 16px; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.tt-session:hover { background: #e2e8f0; }
.tt-session:active { transform: scale(.99); }
.tt-session b { display: block; font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-session span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-session.cancelled { background: #f7f7f8 repeating-linear-gradient(135deg, transparent 0 6px, #e7e9ec 6px 7px); border-left-color: #9aa3ae; }
.tt-session.cancelled b { text-decoration: line-through; color: var(--muted); }
.tt-session.moved { border-left-style: dashed; }
.tt-session.closedreg::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
.tt-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--signal); z-index: 1; pointer-events: none; }
.tt-session { z-index: 2; }
.tt-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: var(--fs-small); margin-top: 12px; }
.legend i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; background: #eef2f7; border-left: 3px solid var(--accent); }
.legend i.c { background: repeating-linear-gradient(135deg, #f7f7f8 0 3px, #dfe2e6 3px 4px); border-left-color: #9aa3ae; }
.legend i.m { border-left-style: dashed; }
.legend i.r { background: #fff; border: 0; position: relative; }
.legend i.r::after { content: ""; position: absolute; left: 3px; top: 1px; width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }

/* drawer */
dialog.drawer { margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(560px, 100%); border: 0; padding: 0; background: var(--surface); box-shadow: -8px 0 32px rgba(15, 25, 40, .14); }
dialog.drawer::backdrop { background: rgba(19, 28, 43, .28); }
dialog.drawer[open] { animation: slidein var(--t-ui) var(--ease-out); }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 24px 24px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 20px; font-weight: 600; }
.drawer-body { padding: 20px 24px 32px; display: grid; gap: 20px; overflow: auto; }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; }
.facts dt { color: var(--muted); }
.choice { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 6px; }
.choice + .choice { margin-top: 8px; }
.choice span { color: var(--muted); font-size: var(--fs-small); }

/* register */
.reg-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #24324a; }
.reg-row .who b { font-weight: 600; }
.reg-row .who span { display: block; color: var(--muted); font-size: var(--fs-small); }
.marks { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--raised); }
.marks button { height: 30px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; transition: background-color var(--t-hover) ease; }
.marks button:hover { color: var(--text); }
.marks button[aria-pressed="true"][data-s="present"] { background: #dcfae5; color: #04250e; }
.marks button[aria-pressed="true"][data-s="late"] { background: #fffbeb; color: #92400e; }
.marks button[aria-pressed="true"][data-s="absent"] { background: #ffedea; color: #831c1e; }
.marks button[aria-pressed="true"][data-s="authorised"] { background: #e8ebef; color: #2f3a4a; }
.how { font-size: 12px; color: var(--muted); }

/* check-in screen for the classroom display */
.checkin-screen { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.qr-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px; display: grid; gap: 20px; justify-items: center; text-align: center; }
.qr-panel svg { width: min(360px, 100%); height: auto; }
.pin { font-size: 64px; line-height: 1; font-weight: 600; letter-spacing: .12em; font-variant-numeric: tabular-nums; color: var(--accent); }
.countdown { height: 4px; width: 220px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.countdown i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.big-count { font-size: 40px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* student view */
.student-card { display: grid; gap: 16px; max-width: 520px; }
.pin-input { font-size: 32px; letter-spacing: .3em; text-align: center; height: 64px; font-variant-numeric: tabular-nums; }
.next-class { padding: 20px; border-radius: var(--radius-card); background: var(--accent); color: #fff; display: grid; gap: 4px; }
.next-class span { color: #c9d4e4; }
.next-class b { font-size: 22px; font-weight: 600; }

/* login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(400px, 100%); display: grid; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px; }
.login img { width: 160px; }
.login h1 { font-size: 22px; font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 50; max-width: min(560px, calc(100% - 32px)); }
.toast.err { background: var(--negative); }
.notice { padding: 12px 14px; border-radius: 6px; background: var(--pill-warning-bg); color: var(--pill-warning-ink); border: 1px solid #fde68a; }
.info { padding: 12px 14px; border-radius: 6px; background: var(--raised); color: var(--text); }
pre.mail { white-space: pre-wrap; font: inherit; margin: 6px 0 0; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
table .input { height: 32px; width: 100%; }
.mobile-bar { display: none; }

@media (max-width: 1100px) {
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage:nth-child(4) { border-left: 0; }
  .stage:nth-child(n + 4) { border-top: 1px solid var(--border); }
  .checkin-screen { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
  .mobile-bar img { height: 26px; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage { border-left: 0 !important; border-top: 1px solid var(--border); }
  .stage:nth-child(-n + 2) { border-top: 0; }
  .stage:nth-child(2n) { border-left: 1px solid var(--border) !important; }
  .stage:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ratio-row { grid-template-columns: 1fr 64px; }
  .ratio-row .ratio-track { grid-column: 1 / -1; grid-row: 2; }
  .pin { font-size: 48px; }
  .reg-row { grid-template-columns: 36px 1fr; }
  .reg-row .marks { grid-column: 1 / -1; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin: 0 0 8px; }
}

.student-card form, .student-card .field { min-width: 0; }
.student-card .input, .student-card .btn { width: 100%; }
