* { box-sizing: border-box; }
:root {
  --brand: #16307A;
  --action: #3E6AE1;
  --action-dark: #2F55C4;
  --workspace: #EFF2F8;
  --surface: #FFFFFF;
  --ink: #182230;
  --muted: #667085;
  --line: #D9E1EE;
  --line-soft: #E6EBF3;
  --radius: 14px;
  --side: #0D1D40;
  --side-ink: #B9C6E4;
  --side-muted: #8FA3CF;
  --shadow: 0 1px 2px rgba(16,24,40,0.05), 0 8px 24px rgba(16,24,40,0.05);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
body { font-family: 'Manrope', system-ui, -apple-system, sans-serif; margin: 0; color: var(--ink); background: var(--workspace); }
a { color: var(--action); }
.topbar { display: flex; justify-content: space-between; align-items: center; background: var(--surface); color: var(--ink); padding: 0.7rem 1.2rem; border-bottom: 1px solid var(--line-soft); }
.topbar a { color: var(--action); text-decoration: none; }
.topbar .topbar-brand { color: var(--brand); }
.topbar-brand { font-weight: 800; font-size: 1.1rem; white-space: nowrap; letter-spacing: -0.01em; }
.topbar-brand .campus { font-weight: 500; font-size: 0.85rem; color: var(--muted); opacity: 1; }
.task-alarm { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; font-size: 1.15rem; line-height: 1; }
.task-count { position: absolute; top: -0.3rem; right: -0.55rem; min-width: 1.15rem; height: 1.15rem; padding: 0 0.22rem; border-radius: 999px; background: #d92d20; color: #fff; border: 2px solid #fff; font-size: 0.68rem; font-weight: 800; line-height: 1rem; text-align: center; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 212px; flex-shrink: 0; background: var(--side); color: #fff; padding: 1rem 0.8rem; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: none; }
.sidebar .brand { color: #fff; text-decoration: none; padding: 0 0.4rem; flex-direction: column; align-items: flex-start; gap: 0.5rem; white-space: normal; }
.sidebar .brand .logo-badge img { height: 34px; }
.sidebar .brand-text { display: block; line-height: 1.3; }
.sidebar .brand-text strong { font-size: 1.15rem; font-weight: 800; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar nav > a, .sidebar nav .navdrop > summary { display: flex; justify-content: space-between; align-items: center; color: var(--side-ink); text-decoration: none; opacity: 1; font-weight: 600; padding: 0.55rem 0.75rem; border-radius: 10px; }
.sidebar nav > a:hover, .sidebar nav .navdrop > summary:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar nav > a.active { color: #fff; background: rgba(255,255,255,0.12); font-weight: 800; }
.sidebar nav .navdrop > summary { cursor: pointer; list-style: none; }
.sidebar nav .navdrop > summary::-webkit-details-marker { display: none; }
.sidebar nav .navdrop[open] > summary { color: #fff; background: rgba(255,255,255,0.12); }
.sidebar nav .navdrop .chev { font-size: 0.75rem; transition: transform 0.15s; }
.sidebar nav .navdrop[open] .chev { transform: rotate(180deg); }
.sidebar .navdrop-menu { padding: 0.2rem 0 0.25rem 0.5rem; }
.sidebar .navdrop-menu a { display: block; color: var(--side-ink); text-decoration: none; opacity: 1; font-weight: 600; padding: 0.45rem 0.75rem; border-radius: 10px; font-size: 0.95rem; }
.sidebar .navdrop-menu a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar .navdrop-menu a.active { color: #fff; background: rgba(255,255,255,0.12); font-weight: 800; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-col main { flex: 1; }
.menu-toggle { display: none; background: none; border: none; color: var(--brand); font-size: 1.4rem; cursor: pointer; padding: 0.25rem 0.5rem; }
/* Compact multi-select filter dropdowns: a details/summary button with a checkbox panel. */
.msdrop { position: relative; display: inline-block; }
.msdrop > summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.8rem; background: #fff; font-size: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.msdrop > summary::-webkit-details-marker { display: none; }
.msdrop > summary:hover { border-color: #9AA9C4; }
.msdrop .chev { font-size: 0.75rem; color: #666; }
.msdrop .count { font-size: 0.85rem; color: var(--action); font-weight: 700; }
.msdrop-panel { position: absolute; z-index: 60; top: calc(100% + 0.25rem); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,0.14); padding: 0.4rem; max-height: 18rem; overflow-y: auto; min-width: 13rem; }
.msdrop-panel label { display: flex; gap: 0.5rem; align-items: center; padding: 0.35rem 0.5rem; border-radius: 6px; cursor: pointer; font-weight: 400; margin: 0; white-space: nowrap; }
.msdrop-panel label:hover { background: #EEF3FF; }
.msdrop-panel input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.msdrop-panel .msall-label { font-weight: 600; border-bottom: 1px solid var(--line-soft); margin-bottom: 0.3rem; padding-bottom: 0.55rem; }
/* Printable diagnostic report (parent handout). */
.report { max-width: 800px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 3px solid #16307A; padding-bottom: 0.8rem; margin-bottom: 1rem; }
.report-brand { font-size: 1.4rem; font-weight: 700; color: #16307A; }
.report-title { font-size: 1.1rem; font-weight: 600; text-align: right; }
.report-student { font-size: 1.05rem; }
.report-table { width: 100%; }
.report-overall { font-size: 1.1rem; }
.bar { display: inline-block; width: 55%; max-width: 12rem; height: 0.7rem; background: #e8ebf0; border-radius: 4px; vertical-align: middle; margin-right: 0.4rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bar-fill { display: block; height: 100%; background: #3E6AE1; border-radius: 4px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.report-cta { margin-top: 1.2rem; }
.report-sign { margin-top: 2rem; }
/* Tab bar (Imports page). */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--line-soft); margin: 1rem 0; }
.tabs a { padding: 0.6rem 1.2rem; text-decoration: none; color: #555; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--brand); }
.tabs a.active { color: var(--action); border-bottom-color: var(--action); }
@media print {
  .sidebar, .topbar, .appfooter, .scrim, .no-print, .flash { display: none !important; }
  .main-col { margin: 0 !important; }
  main { padding: 0 !important; }
  body { background: #fff; margin: 0; }
  .print-clean { border: none !important; box-shadow: none !important; appearance: none; -webkit-appearance: none; padding-left: 0; padding-right: 0; background: transparent; }
  textarea.print-clean { resize: none; overflow: hidden; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .topbar { justify-content: flex-start; gap: 0.5rem; }
  /* Left panel slides in over the content on small screens — never a top bar. */
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; z-index: 100;
    transform: translateX(-105%); transition: transform 0.2s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,0.25); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 90; }
}
.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.brand .logo-badge { background: #fff; border: 1px solid rgba(255,255,255,0.35); border-radius: 10px; padding: 0.25rem 0.5rem; display: inline-flex; align-items: center; box-shadow: 0 1px 2px rgba(16,24,40,0.05); }
.brand .logo-badge img { height: 28px; width: auto; display: block; }
.brand .campus { font-weight: 400; font-size: 0.85rem; opacity: 0.85; }
.userbox { margin-left: auto; font-size: 0.9rem; display: flex; gap: 0.8rem; align-items: center; }
.linklike { background: none; border: none; color: var(--action); cursor: pointer; font: inherit; padding: 0; min-height: 0; text-decoration: underline; }
.linklike:hover { background: none; color: var(--action); text-decoration: underline; }
main { width: 100%; margin: 1.5rem 0; padding: 0 1.5rem 3rem; }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; color: #101E38; } h2 { font-size: 1.25rem; margin-top: 2rem; }
.flash { background: #e6f4ea; border: 1px solid #a3d9b1; padding: 0.6rem 0.9rem; border-radius: 10px; transition: opacity 0.6s; }
.usermenu { position: relative; }
.usermenu > summary { cursor: pointer; list-style: none; font-weight: 600; white-space: nowrap; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 0.4rem); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,0.14); padding: 0.5rem; min-width: 11rem; z-index: 70; display: flex; flex-direction: column; gap: 0.15rem; }
.usermenu-panel a, .usermenu-panel .linklike { padding: 0.45rem 0.6rem; border-radius: 8px; text-align: left; color: var(--ink); text-decoration: none; font-weight: 600; }
.usermenu-panel a:hover, .usermenu-panel .linklike:hover { background: #EEF3FF; }
/* Segmented control (schedule Day/Week/Month and similar view switches). */
.seg { display: inline-flex; background: #E8ECF3; border-radius: 10px; padding: 0.25rem; gap: 0.25rem; }
.seg a { padding: 0.45rem 1rem; border-radius: 8px; text-decoration: none; color: #52627A; font-weight: 700; min-height: 2.1rem; display: inline-flex; align-items: center; }
.seg a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(16,24,40,0.15); }
/* Sticky save bar for long forms. */
.savebar { position: sticky; bottom: 0; background: rgba(255,255,255,0.95); backdrop-filter: blur(4px); border-top: 1px solid var(--line-soft); padding: 0.8rem 0; margin-top: 1.2rem; display: flex; gap: 0.6rem; align-items: center; z-index: 20; }
/* Scroll wrapper so wide tables scroll inside their card on small screens. */
.tablewrap { overflow-x: auto; }
.tablewrap table { min-width: 640px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ctr, th.ctr { text-align: center; }
/* Diagnostic report control toolbar (screen only). */
.report-toolbar { border: 1px solid var(--line); border-radius: 12px; background: #F8FAFF; padding: 0.9rem 1.1rem; margin-top: 1.5rem; }
.report-toolbar p { margin: 0.35rem 0; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Wide tables scroll sideways inside a wrap instead of breaking the layout;
   headers stick while a long wrapped table scrolls. */
.tablewrap { overflow-x: auto; }
.tablewrap thead th { position: sticky; top: 0; z-index: 2; }
/* Click-to-sort headers (sort.js): pointer + arrow on the active column. */
th.sortable-th { cursor: pointer; user-select: none; }
th.sortable-th:hover { background: #E8EEF6; color: var(--ink); }
th.sortable-th.sorted[data-dir='asc']::after { content: ' ▲'; }
th.sortable-th.sorted[data-dir='desc']::after { content: ' ▼'; }

/* Tabbed panels (template editor). */
.tabbar { display: flex; gap: 0.3rem; border-bottom: 2px solid var(--line); margin: 1rem 0 1.2rem; }
.tabbtn { background: transparent; color: var(--muted); border: none; border-bottom: 3px solid transparent; border-radius: 0; font-weight: 700; padding: 0.55rem 0.9rem; margin-bottom: -2px; }
.tabbtn:hover { background: #EEF3FF; color: var(--brand); }
.tabbtn.on { color: var(--brand); border-bottom-color: var(--action); }
table.gscale { width: auto; }
table.gscale td, table.gscale th { border-bottom: none; padding: 0.25rem 0.6rem 0.25rem 0; }

/* Student form school picker options (live search results). */
.schoolopt { padding: 0.4rem 0.8rem; cursor: pointer; }
.schoolopt:hover { background: #eef2f7; }
.schoolopt.active { background: #dbe7f5; }

/* Global search (topbar). */
.globalsearch { position: relative; flex: 0 1 26rem; margin: 0 0.8rem; }
.globalsearch input { margin: 0; height: 2.6rem; }
.gs-panel { position: absolute; left: 0; right: 0; top: calc(100% + 0.35rem); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,0.16); padding: 0.4rem; z-index: 80; max-height: 24rem; overflow-y: auto; }
.gs-group { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #667085; padding: 0.45rem 0.6rem 0.2rem; }
.gs-row { display: block; padding: 0.45rem 0.6rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
.gs-row:hover { background: #EEF3FF; }
.gs-row span { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.gs-empty { margin: 0; padding: 0.6rem; color: var(--muted); }
@media (max-width: 760px) { .globalsearch { display: none; } }

/* Attendance one-tap status chips (session page). */
.attchips { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.attchip { min-height: 2.2rem; padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #52627A; font-weight: 700; font-size: 0.85rem; text-transform: capitalize; }
.attchip:hover { background: #EEF3FF; }
.attchip.on { color: #fff; }
.attchip.on[data-s="present"] { background: #177245; border-color: #177245; }
.attchip.on[data-s="absent"] { background: #b3261e; border-color: #b3261e; }
.attchip.on[data-s="late"] { background: #E8A13A; border-color: #E8A13A; color: #4A2F00; }
.attchip.on[data-s="excused"] { background: var(--brand); border-color: var(--brand); }

/* Stage pipeline chips (leads list header). */
.stagechips { display: flex; gap: 0.45rem; flex-wrap: wrap; margin: 0.6rem 0 0.2rem; }
.chip { display: inline-flex; align-items: center; padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.chip:hover { border-color: #9AA9C4; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.err { background: #fdecea; border: 1px solid #f5b5b0; padding: 0.6rem 0.9rem; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,40,0.04); }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line-soft); }
th { background: #F4F7FB; color: #52627A; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: #F8FAFF; }
tr.fb-complete td { background: #EDF0F5; color: #68707C; }
form label { display: block; margin: 0.7rem 0; font-weight: 600; font-size: 0.92rem; }
input, select, textarea { width: 100%; margin-top: 0.25rem; padding: 0.55rem; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; font-weight: 400; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(62,106,225,0.18); }
input[type="checkbox"] { width: auto; margin-top: 0; }
input.inline { width: auto; margin-left: 0.5rem; }
input[type="date"], input[type="time"] { font-family: var(--mono); font-size: 0.95rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem; background: var(--action); color: #fff; border: none; padding: 0.55rem 1.1rem; border-radius: 10px; cursor: pointer; font-size: 1rem; font-weight: 600; line-height: 1.25; text-decoration: none; }
details.collapsible > summary.btn { list-style: none; }
details.collapsible > summary.btn::-webkit-details-marker { display: none; }
details.collapsible > summary.btn::marker { content: none; }
details.collapsible > form { margin-top: 1rem; }
.btn.secondary { background: #fff; color: var(--action); border: 1px solid #B9C8EE; }
button:hover, .btn:hover { opacity: 1; background: var(--action-dark); }
.btn.secondary:hover { background: #EEF3FF; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.searchbar { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: flex-end; }
.searchbar label { margin: 0; min-width: 0; }
.searchbar select, .searchbar input:not([type="checkbox"]) { height: 2.6rem; }
.searchbar select { max-width: 100%; }
/* Buttons sharing a row must look the same: never let a button label wrap
   (a wrapped label grows taller than its neighbours) — the field shrinks. */
.searchbar .btn, .searchbar button { white-space: nowrap; flex: 0 0 auto; }
.filtercard { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin: 1rem 0 1.25rem; }
.filtercard form { margin: 0 !important; }
.filtercard form + form { margin-top: 0.85rem !important; }
.filter-label { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; font-weight: 600; font-size: 0.92rem; }
.filter-label select { width: auto; }
.searchbar input { flex: 1; } .searchbar button { white-space: nowrap; }
.check { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }
.check input[type="checkbox"] { width: auto; }
.cards { display: flex; gap: 1rem; margin: 1rem 0; }
.card { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.2rem 1.5rem; box-shadow: var(--shadow); }
.stat { font-size: 2rem; font-weight: 800; color: var(--brand); } .lbl { color: var(--muted); font-size: 0.9rem; }
.actions li { margin: 0.4rem 0; }
.meta { color: #555; }
pre { background: #fff; padding: 0.8rem; border: 1px solid var(--line-soft); border-radius: 12px; overflow-x: auto; font-size: 0.85rem; }
body.center { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.card.login { max-width: 360px; width: 90%; }
.inlineform { display: inline-flex; gap: 0.4rem; align-items: center; }
.inlineform select { width: auto; margin: 0; }

/* Scheduling module helpers */
.muted { color: var(--muted); }
.weeknav { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.form label { display: block; margin: 0.6rem 0; }
.form input, .form select, .form textarea { display: block; margin-top: 0.25rem; }
.program-edit { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 1rem 0; background: #fff; }
.program-edit h3 { margin-top: 0; }
.note { background: #fff; border: 1px solid var(--line-soft); border-radius: 12px; padding: 0.75rem 1rem; margin: 0.5rem 0; }
.note p { margin: 0.25rem 0; }
.appfooter { text-align: center; color: #888; font-size: 0.8rem; padding: 1.5rem 0 1rem; }

/* Password field with an inside "Show" toggle */
.pw-field { position: relative; }
.pw-field input { width: 100%; padding-right: 3.6rem; }
.pw-field button { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--action); font-weight: 600; font-size: 0.85rem;
  cursor: pointer; padding: 0.25rem 0.45rem; margin: 0; min-height: 0; }
.pw-field button:hover { opacity: 0.7; background: none; }

/* Student profile */
.profile-head { display: flex; align-items: center; gap: 1.2rem; padding: 1.4rem 1.6rem; }
.profile-head h1 { margin: 0 0 0.3rem; }
.profile-head .meta { margin: 0.2rem 0; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--action); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; flex-shrink: 0; }
.profile-actions { margin-left: auto; display: flex; gap: 0.6rem; flex-shrink: 0; }
.contactline { margin: 0.3rem 0 0; display: flex; gap: 1rem; flex-wrap: wrap; color: #444; }
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem;
  font-weight: 600; text-transform: capitalize; vertical-align: middle; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.active { background: #e6f4ea; color: #177245; }
.badge.inactive { background: #eef1f6; color: #667085; }
.badge.withdrawn { background: #fdecea; color: #b3261e; }
.badge.neutral { background: #e8eefc; color: #3E6AE1; }
.badge.open { background: #e8eefc; color: #3E6AE1; }
.badge.completed { background: #e6f4ea; color: #177245; }
.badge.overdue { background: #fdecea; color: #b3261e; }
.badge.due-today { background: #fff4e0; color: #96660A; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; align-items: stretch; }
.cols2 h2 { margin-top: 0; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1.2rem; margin: 0; }
.detail-grid dt { color: #6b768c; font-size: 0.88rem; }
.detail-grid dd { margin: 0; font-weight: 500; }
.guardian-mini { border: 1px solid var(--line-soft); border-radius: 12px; padding: 0.8rem 1rem; margin: 0.6rem 0; }
.guardian-mini-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.guardian-mini div { margin: 0.15rem 0; color: #444; }
/* Guardian cards on the student form */
.guardian-card { border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; margin: 0.8rem 0; background: #fff; }
.guardian-card .grid2 { margin-top: 0.4rem; }
#guardian-search { max-width: 320px; }
#guardian-results button, #guardian-to-link button { margin: 0.15rem; }
#guardian-to-link span { display: inline-block; background: #eaf0fe; border-radius: 8px; padding: 0.25rem 0.5rem; margin: 0.2rem; }
@media (max-width: 700px) {
  .cols2 { grid-template-columns: 1fr; }
  .profile-head { flex-wrap: wrap; }
  .profile-actions { margin-left: 0; }
}

/* Multi-select panels inside .form pages: keep each checkbox and its label
   text on one row (the .form label/input block rules would stack them). */
.form .msdrop-panel label { display: flex; }
.form .msdrop-panel input[type="checkbox"] { display: inline-block; }

/* Schedule month calendar */
.monthcal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.monthcal th { text-align: left; padding: 0.4rem 0.5rem; font-size: 0.82rem; color: var(--muted); }
.monthcal td { border: 1px solid var(--line); vertical-align: top; height: 6.8rem; padding: 0.35rem 0.4rem; background: #fff; }
.monthcal td.outmonth { background: #F4F6FA; }
.monthcal td.todaycell { outline: 2px solid var(--action); outline-offset: -2px; }
.monthcal .daynum { font-weight: 700; margin-bottom: 0.3rem; }
.monthcal .daynum a { color: inherit; text-decoration: none; }
.monthcal .sess { display: block; font-size: 0.76rem; line-height: 1.25; padding: 0.14rem 0.3rem; margin-bottom: 0.2rem; background: #EEF3FF; border-radius: 5px; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monthcal .more { font-size: 0.74rem; }

/* Week view: day separator rows inside the single sessions table */
tr.dayrow td { background: #E7EDF7; font-weight: 700; color: var(--ink); }
tr.dayrow:hover td { background: #E7EDF7; }

/* Diagnostic report v2 — colorful parent handout. */
.report { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rband { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: linear-gradient(135deg, #16307A, #0D1D40); color: #fff; border-radius: 12px; padding: 1rem 1.2rem; border-bottom: 4px solid #F2B33D; margin-bottom: 0.9rem; }
.rband-brand { font-size: 1.3rem; font-weight: 800; }
.rband-sub { opacity: 0.85; font-size: 0.85rem; }
.rband-title { font-weight: 700; text-align: right; font-size: 1.05rem; line-height: 1.3; }
.rsec { color: #16307A; border-bottom: 2px solid #F2B33D; padding-bottom: 0.25rem; margin: 1.1rem 0 0.6rem; font-size: 1.1rem; }
.rtiles { display: flex; gap: 0.7rem; margin: 0.6rem 0; flex-wrap: wrap; }
.rtile { background: #EFF2F8; border: 1px solid #D8E0F0; border-radius: 10px; padding: 0.5rem 0.9rem; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 6.5rem; }
.rtile-num { font-size: 1.25rem; font-weight: 800; color: #16307A; line-height: 1.2; }
.rtile-lab { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: #667085; }
.gradebadge { display: inline-block; font-size: 1.2rem; font-weight: 800; color: #fff; border-radius: 8px; padding: 0.05rem 0.7rem; line-height: 1.35; }
.gscale { display: flex; align-items: center; gap: 0.6rem; margin: 0.35rem 0 0.25rem; flex-wrap: wrap; }
.gscale-lab { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #667085; }
.gscale table { border-collapse: collapse; }
.gscale th, .gscale td { border: 1px solid #D8E0F0; padding: 0.1rem 0.55rem; text-align: center; font-size: 0.8rem; }
.gscale th { background: #EFF2F8; color: #16307A; }
.gscale th.gs-cur, .gscale td.gs-cur { background: #F2B33D; color: #16307A; font-weight: 800; }
.sc-legend { display: flex; gap: 1.1rem; justify-content: flex-end; font-size: 0.8rem; color: #475467; margin: 0.2rem 0 0.4rem; }
.sc-legend .sw { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 0.3rem; }
.sw-c, .seg-c { background: #4472C4; }
.sw-w, .seg-w { background: #E19A93; }
.sw-o, .seg-o { background: #FFC000; }
.sc-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.3rem 0; }
.sc-lab { flex: 0 0 16rem; text-align: left; }
.sc-bar { flex: 1; display: flex; height: 1.4rem; background: #F2F4F7; background-image: linear-gradient(to right, #D8E0F0 1px, transparent 1px); background-size: 25% 100%; }
.sc-seg { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.78rem; font-weight: 700; overflow: hidden; white-space: nowrap; }
.seg-o { color: #7A5B00; }
.sc-total { border-top: 2px solid #16307A; padding-top: 0.45rem; margin-top: 0.5rem; font-weight: 700; }
.sc-axis { display: flex; gap: 0.6rem; }
.sc-ticks { flex: 1; position: relative; height: 1rem; font-size: 0.72rem; color: #667085; }
.sc-ticks span { position: absolute; transform: translateX(-50%); }
.sc-ticks span:first-child { transform: none; }
.sc-ticks span:last-child { transform: translateX(-100%); }

/* Fast answer entry (record / edit answers): progress bar, color grid, type-in box. */
.aentry { margin: 1rem 0; }
.abar-wrap { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.abar-track { flex: 1; height: 0.65rem; background: #E8ECF3; border-radius: 999px; overflow: hidden; display: block; }
.abar { display: block; height: 100%; background: #3E6AE1; width: 0; transition: width 0.15s; }
.abar-lab { font-weight: 700; white-space: nowrap; }
.agrid { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.8rem; }
.acell { width: 2.9rem; padding: 0.25rem 0 0.3rem; border: 1.5px solid #D5DBE7; border-radius: 0.45rem; background: #F4F6FA; text-align: center; cursor: pointer; font: inherit; line-height: 1.15; }
.acell .an { display: block; font-size: 0.62rem; color: #7A8699; font-weight: 700; }
.acell .al { display: block; font-size: 1rem; font-weight: 800; min-height: 1.15em; }
.acell.correct { background: #DFF2E1; border-color: #58A05C; color: #1E6B2E; }
.acell.wrong { background: #FBE3E1; border-color: #D66A62; color: #9C2B21; }
.acell.omit { background: #FCEFC7; border-color: #D9A62E; color: #7A5B00; }
.acell.cur { outline: 3px solid #3E6AE1; outline-offset: 1px; }
.abox { width: 100%; font-family: 'JetBrains Mono', monospace; font-size: 1.15rem; letter-spacing: 0.12em; padding: 0.7rem 0.9rem; }
.acontext { margin: 0.6rem 0 0.2rem; }
.atally { margin: 0.3rem 0; font-weight: 600; }
.ps-langlab { font-weight: 700; color: #16307A; margin: 0.9rem 0 0.3rem; }
.gb-green { background: #22A06B; } .gb-blue { background: #3E6AE1; } .gb-amber { background: #E8A13A; } .gb-red { background: #D64545; }
.bar-fill.fb-green { background: #22A06B; } .bar-fill.fb-blue { background: #3E6AE1; } .bar-fill.fb-amber { background: #E8A13A; } .bar-fill.fb-red { background: #D64545; }
.lvlchip { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; color: #fff; margin-left: 0.4rem; vertical-align: middle; }
.rcards { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.7rem; }
.rcard { flex: 1 1 300px; border-radius: 10px; padding: 0.7rem 0.9rem; }
.rcard h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.rcard ul { margin: 0; padding-left: 1.1rem; }
.rcard li { margin-bottom: 0.3rem; }
.rcard-focus { background: #FDF0EC; border: 1px solid #F3C6B8; border-left: 5px solid #D64545; }
.rcard-focus h3 { color: #B3372F; }
.rcard-strength { background: #EDF7F1; border: 1px solid #BFE6CF; border-left: 5px solid #22A06B; }
.rcard-strength h3 { color: #17784E; }
.codechip { display: inline-block; background: #16307A; color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 5px; padding: 0.05rem 0.4rem; margin-right: 0.25rem; }
@page { size: Letter; margin: 11mm 16mm 16mm; }

@media print {
  .report { font-size: 11.5px; max-width: none; zoom: 0.93; margin-left: auto; margin-right: auto; }
  .rband { padding: 0.8rem 1rem; margin-bottom: 0.7rem; }
  .rsec { margin: 0.8rem 0 0.5rem; }
  .rcard, .rtile { break-inside: avoid; }
  .sc-row { break-inside: avoid; }
  /* Bilingual print: English plus the language chosen on screen (default + Korean). */
  .report[data-print="enkr"] .ps-en, .report[data-print="enkr"] .ps-kr { display: block !important; }
  .report[data-print="enkr"] .ps-zh { display: none !important; }
  .report[data-print="enzh"] .ps-en, .report[data-print="enzh"] .ps-zh { display: block !important; }
  .report[data-print="enzh"] .ps-kr { display: none !important; }
  .report[data-print="en"] .ps-en { display: block !important; }
  .report[data-print="en"] .ps-kr, .report[data-print="en"] .ps-zh { display: none !important; }
  .rcard { min-width: 0; }
  .rcard li { overflow-wrap: break-word; }
}

/* Breakdown rows: fixed label column so every bar starts at the same x. */
.brow { display: flex; align-items: center; gap: 0.6rem; margin: 0.35rem 0; }
.blab { flex: 0 0 16rem; white-space: nowrap; }
.brow .bar { flex: 1 1 auto; width: auto; max-width: 18rem; min-width: 4rem; margin-right: 0; }
.bval { white-space: nowrap; }

/* Schedule header (staff view): title row + single toolbar row, with the
   Google calendars in a Calendars dropdown panel (.msdrop pattern, switch
   rows). Instructor view keeps the plain header — none of this applies. */
.sched-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sched-head h1 { margin: 0; }
.sched-head-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.sched-sync { font-size: 0.9rem; white-space: nowrap; }
.sched-tools .seg a { min-height: 2.25rem; }
.sched-tools select { min-height: 2.25rem; }
.sched-tools-right { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.caldrop > summary { min-height: 2.6rem; padding: 0.55rem 1.1rem; border: 1px solid #B9C8EE; border-radius: 10px; background: #fff; color: var(--action); font-weight: 600; }
.caldrop > summary:hover { border-color: #B9C8EE; background: #EEF3FF; }
.caldrop-panel { left: auto; right: 0; min-width: 17rem; padding: 0.5rem; }
.caldrop-head { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); padding: 0.3rem 0.6rem 0.5rem; display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.caldrop-all { display: flex; gap: 0.8rem; }
.caldrop-allbtn { background: none; border: none; min-height: 0; padding: 0.15rem 0; color: var(--action); font-size: 0.78rem; font-weight: 600; letter-spacing: 0; cursor: pointer; }
.caldrop-allbtn:hover { background: none; text-decoration: underline; }
.caldrop-panel .caldrop-row { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; padding: 0.35rem 0.6rem; border-radius: 8px; cursor: pointer; font-weight: 400; margin: 0; white-space: normal; }
.caldrop-panel .caldrop-row:hover { background: #EEF3FF; }
.caldrop-swatch { width: 0.95rem; height: 0.95rem; border-radius: 4px; flex: none; }
.caldrop-name { flex: 1; }
.caldrop-empty { padding: 0.35rem 0.6rem; margin: 0; }
.cal-switch { position: relative; display: inline-flex; flex: none; }
.cal-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cal-switch-track { display: block; width: 2.4rem; height: 1.35rem; border-radius: 999px; background: #C4CEDD; position: relative; transition: background 0.15s; }
.cal-switch-track::after { content: ''; position: absolute; top: 0.15rem; left: 0.15rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,0.3); transition: left 0.15s; }
.cal-switch input:checked + .cal-switch-track { background: var(--action); }
.cal-switch input:checked + .cal-switch-track::after { left: 1.2rem; }
.cal-switch input:focus-visible + .cal-switch-track { outline: 2px solid var(--action); outline-offset: 2px; }
.caldrop-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; border-top: 1px solid var(--line-soft); margin-top: 0.4rem; padding: 0.55rem 0.6rem 0.25rem; font-size: 0.85rem; }
/* Panel rows are a flex div: name + switch stay one <label> (clicking the
   name still toggles), while the admin colour picker sits outside the
   label so its palette buttons can't become the label's control. */
.caldrop-panel .caldrop-main { flex: 1; display: flex; align-items: center; gap: 0.6rem; cursor: pointer; margin: 0; padding: 0; font-weight: 400; white-space: normal; }
.calcolor { position: relative; flex: none; }
.calcolor-swatch { display: block; cursor: pointer; list-style: none; }
.calcolor-swatch::-webkit-details-marker { display: none; }
.calcolor-pop { position: absolute; top: calc(100% + 0.3rem); left: 0; z-index: 70; width: 11.75rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,0.14); padding: 0.55rem; cursor: default; }
.calcolor-title { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.45rem; }
.calcolor-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.35rem; }
.calcolor-btn { width: 1.35rem; height: 1.35rem; min-height: 0; padding: 0; border: 1px solid rgba(16,24,40,0.2); border-radius: 5px; cursor: pointer; }
.calcolor-btn.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.calcolor-reset { display: block; margin-top: 0.55rem; background: none; border: none; min-height: 0; padding: 0.2rem 0; color: var(--action); font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.calcolor-reset:hover { background: none; text-decoration: underline; }
.caldrop-refresh { background: none; color: var(--action); border: none; min-height: 0; padding: 0.25rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.caldrop-refresh:hover { background: none; text-decoration: underline; }

/* Week grid: days as columns, hours down the left */
.wkscroll { overflow-x: auto; }
.wkgrid { display: grid; grid-template-columns: 3.4rem repeat(7, minmax(0, 1fr)); min-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wkgrid.six { grid-template-columns: 3.4rem repeat(6, minmax(0, 1fr)); }
.sunday-note { margin-top: 0.6rem; font-size: 0.85rem; }
.wk-corner { border-bottom: 1px solid var(--line); }
.wk-dayhead { padding: 0.5rem 0.25rem; text-align: center; font-weight: 700; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line-soft); }
.wk-dayhead span { color: var(--muted); font-weight: 600; }
.wk-dayhead.today { color: var(--action); }
.wk-gutter { position: relative; }
.wk-hour { position: absolute; right: 0.45rem; transform: translateY(-50%); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.wk-hour:first-of-type { transform: none; }
.wk-day { position: relative; border-left: 1px solid var(--line-soft); background-image: repeating-linear-gradient(to bottom, var(--line-soft) 0, var(--line-soft) 1px, transparent 1px, transparent 48px); }
.wk-day.today { background-color: #F5F8FF; }
.wk-ev { position: absolute; box-sizing: border-box; overflow: hidden; display: block; background: #E3EBFD; border-left: 3px solid var(--action); border-radius: 6px; padding: 0.15rem 0.3rem; font-size: 0.72rem; line-height: 1.25; color: var(--ink); text-decoration: none; }
.wk-ev:hover { background: #D3E0FC; }
.wk-ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-ev-t { font-weight: 700; }
.wk-ev-p { color: var(--muted); }
.wk-ev-i { color: var(--muted); }
.dygrid { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dy-day { position: relative; border-left: 1px solid var(--line-soft); background-image: repeating-linear-gradient(to bottom, var(--line-soft) 0, var(--line-soft) 1px, transparent 1px, transparent 48px); }
.dy-day.today { background-color: #F5F8FF; }
.dy-ev-main { display: block; color: inherit; text-decoration: none; }
.dy-ev-att { position: absolute; top: 0.15rem; right: 0.35rem; font-size: 0.68rem; font-weight: 700; color: var(--action); }
