/* KuraDB web shell — basic, dense, functional. House rules from Jonno's Jobs:
   cream paper, solid hairlines, compact tables, purple/green accents. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font: 13px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 14px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; }
p { margin: 0 0 10px; }

a {
  color: var(--purple-dark);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--green-dark); }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img,
svg { max-width: 100%; }

button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

code,
kbd,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.08em 0.35em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

::selection {
  background: var(--pale);
  color: var(--ink);
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -70px;
  left: 12px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 4px;
  background: var(--purple-dark);
  color: #fff;
  font-weight: 700;
}
.skip-link:focus { top: 10px; }

/* -------------------------------------------------------------------------- */
/* Header                                                                      */
/* -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 4px max(2vw, 14px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand img { width: 40px; height: 40px; display: block; }
.brand-lockup { display: flex; flex-direction: column; line-height: 1.1; }
.brand-lockup strong { font-size: 15px; font-weight: 780; letter-spacing: -0.02em; }
.brand-lockup small { color: var(--muted); font-size: 10px; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.main-nav a {
  padding: 6px 9px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
}
.main-nav a:hover { background: var(--cream); color: var(--ink); }
.main-nav a[aria-current="page"] {
  background: var(--pale);
  color: var(--purple-dark);
  font-weight: 720;
}

.global-search {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  max-width: 520px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 5px;
  background: var(--input-bg);
}
.global-search:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--pale);
}
.global-search .icon { color: var(--muted); flex: 0 0 auto; }
.global-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
}
.global-search kbd { flex: 0 0 auto; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.profile-menu { position: relative; }
.profile-menu summary {
  list-style: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--pale);
  color: var(--purple-dark);
  font-size: 11px;
  font-weight: 780;
  cursor: pointer;
}
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu[open] summary { border-color: var(--purple); }
.profile-popup {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  z-index: 90;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-pop);
}
.profile-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.profile-head strong { font-size: 13px; }
.profile-head small { color: var(--muted); font-size: 11px; }
.profile-popup .micro { color: var(--muted); font-size: 11px; margin: 8px 4px 2px; }

.theme-control {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px;
  font-size: 12px;
  color: var(--ink);
}
.theme-control .icon { color: var(--muted); }
.theme-control select {
  margin-left: auto;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  font-size: 12px;
}

/* -------------------------------------------------------------------------- */
/* Main shell                                                                  */
/* -------------------------------------------------------------------------- */

.main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px max(2vw, 14px) 56px;
}
.main.wide { max-width: none; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 2px 0 16px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 1px 0 4px; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--purple-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lede {
  max-width: 78ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.meta { color: var(--muted); font-size: 11.5px; }
.micro { font-size: 11px; line-height: 1.5; color: var(--muted); }
.muted { color: var(--muted); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11.5px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--purple-dark); text-decoration: underline; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px max(2vw, 14px) 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

/* -------------------------------------------------------------------------- */
/* Controls                                                                    */
/* -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover {
  background: var(--surface-hover);
  border-color: var(--purple);
  color: var(--ink);
  text-decoration: none;
}
.button.primary {
  border-color: var(--purple-dark);
  background: var(--purple);
  color: #fff;
  box-shadow: 2px 2px 0 var(--purple-dark);
}
.button.primary:hover {
  background: var(--purple-dark);
  color: #fff;
}
.button.primary:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.button.secondary {
  border-color: var(--line);
  background: var(--paper);
}
.button.subtle {
  border-color: transparent;
  background: transparent;
  color: var(--purple-dark);
}
.button.subtle:hover { border-color: var(--line); background: var(--pale); }
.button.small { min-height: 28px; padding: 0 8px; font-size: 11px; }
.button.disabled,
.button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

input[type="search"],
input[type="date"],
input[type="text"],
input[type="email"],
select,
textarea {
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 12.5px;
}
textarea { padding: 8px 9px; min-height: 80px; resize: vertical; }
input:hover,
select:hover { border-color: var(--line-strong); }
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--focus-outline);
  outline-offset: 1px;
  border-color: var(--focus-outline);
}

/* -------------------------------------------------------------------------- */
/* Panels, tables, pills                                                       */
/* -------------------------------------------------------------------------- */

.panel {
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel.compact { padding: 12px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.panel-head h2 { margin: 0; }
.panel-head .meta { margin: 0; }

.table-wrap {
  width: 100%;
  overflow: auto;
  background: var(--paper);
}
.panel.flush .table-wrap { border: 0; }
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}
th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  background: var(--th-bg);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
td small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-title { color: var(--ink); font-weight: 700; text-decoration: none; }
.row-title:hover { color: var(--purple-dark); text-decoration: underline; }
.row-action { width: 1%; white-space: nowrap; text-align: right; }
.mono { font-family: var(--font-mono); font-size: 11px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--status-pill-muted-bg);
  color: var(--status-pill-muted-text);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.pill.green { background: var(--status-pill-bg); color: var(--status-pill-text); border-color: #c9dcbc; }
.pill.amber { background: #fdf0c9; color: #7c5206; border-color: #f0d99a; }
.pill.red { background: var(--flash-error-bg); color: var(--flash-error-text); border-color: var(--flash-error-border); }
.pill.purple { background: var(--pale); color: var(--purple-dark); border-color: #d8c8e2; }
.pill.slate { background: var(--status-pill-muted-bg); color: var(--status-pill-muted-text); }
.pill.neutral { background: var(--cream); color: var(--muted); }

.code-chip,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

/* -------------------------------------------------------------------------- */
/* Search                                                                      */
/* -------------------------------------------------------------------------- */

.search-controls { padding: 7px; }
.search-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}
.search-field {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--input-bg);
}
.search-field:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--pale);
}
.search-field .icon { color: var(--muted); flex: 0 0 auto; }
.search-field input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}
.select-field { flex: 0 1 180px; min-width: 0; }
.select-field select { width: 100%; height: 38px; }
.search-controls .button { min-height: 38px; }

.date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
}
.field.inline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 650;
}
.field.inline input { height: 34px; }

/* -------------------------------------------------------------------------- */
/* Dashboard                                                                   */
/* -------------------------------------------------------------------------- */

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--line);
  overflow: hidden;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--paper);
}
.metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.metric strong {
  font-size: 24px;
  font-weight: 760;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.metric small { color: var(--muted); font-size: 11px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}
.side-stack { display: grid; gap: 14px; }

.action-list { display: grid; }
.action-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.action-list a:last-child { border-bottom: 0; }
.action-list a:hover { color: var(--purple-dark); }
.action-list .icon { color: var(--muted); flex: 0 0 auto; }
.action-list span { display: flex; flex-direction: column; min-width: 0; }
.action-list strong { font-size: 12.5px; }
.action-list small { color: var(--muted); font-size: 11px; }
.action-list .icon:last-child { margin-left: auto; }
.notice-panel { background: var(--pale); border-color: #d8c8e2; }
.notice-panel h2 { margin-bottom: 4px; }

/* -------------------------------------------------------------------------- */
/* Student detail                                                              */
/* -------------------------------------------------------------------------- */

.attendance-score {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 4px 0;
}
.score-ring {
  --score: 0;
  flex: 0 0 114px;
  width: 114px;
  height: 114px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 0 54%, transparent 55%),
    conic-gradient(var(--purple) calc(var(--score) * 1%), var(--meter-bar-bg) 0);
}
.score-ring strong { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-ring span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.score-breakdown { flex: 1; min-width: 0; display: grid; gap: 0; }
.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.score-row:last-child { border-bottom: 0; }
.score-row strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.score-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.score-dot.green { background: var(--green); }
.score-dot.amber { background: #c98a12; }
.score-dot.red { background: var(--due-color); }

/* -------------------------------------------------------------------------- */
/* Empty state                                                                 */
/* -------------------------------------------------------------------------- */

.empty-state {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px dashed var(--empty-border);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.empty-state.small { padding: 12px; gap: 12px; }
.empty-state img { flex: 0 0 auto; width: 112px; height: 112px; }
.empty-state.small img { width: 76px; height: 76px; }
.empty-state h2 { margin-bottom: 4px; }
.empty-state p { margin: 0 0 8px; max-width: 62ch; color: var(--muted); }

/* -------------------------------------------------------------------------- */
/* Roll marking                                                                */
/* -------------------------------------------------------------------------- */

.roll-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.roll-header h1 { font-size: 22px; margin-bottom: 2px; }
.roll-header-actions { display: flex; align-items: center; gap: 7px; }

.roll-progress {
  margin-bottom: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.progress-track {
  height: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--meter-bar-bg);
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  background: var(--purple);
  transition: width 180ms ease;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.progress-meta strong { color: var(--ink); }

.roll-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
}
.roll-student {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) minmax(330px, 2fr) 44px;
  align-items: center;
  gap: 12px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--line);
}
.roll-student:last-child { border-bottom: 0; }
.roll-student:hover { background: var(--surface-hover); }
.roll-student-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.roll-student-name strong { display: block; font-size: 12.5px; }
.roll-student-name small { display: block; color: var(--muted); font-size: 10.5px; }
.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--pale);
  color: var(--purple-dark);
  font-size: 10px;
  font-weight: 780;
}
.avatar.small { width: 28px; height: 28px; font-size: 9.5px; }

.code-grid {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.code-option {
  position: relative;
  display: inline-flex;
  flex: 1 1 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  cursor: pointer;
  user-select: none;
}
.code-option:hover { border-color: var(--line-strong); background: var(--cream); }
.code-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.code-option .code-letter { font-size: 13px; font-weight: 800; line-height: 1; }
.code-option .code-label {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.code-option:has(input:checked) {
  border-color: var(--purple);
  background: var(--pale);
  box-shadow: inset 0 0 0 1px var(--purple);
}
.code-option.present:has(input:checked) {
  border-color: var(--green);
  background: var(--softgreen);
  box-shadow: inset 0 0 0 1px var(--green);
}
.code-option.absent:has(input:checked) {
  border-color: var(--due-color);
  background: var(--flash-error-bg);
  box-shadow: inset 0 0 0 1px var(--due-color);
}
.code-option.authorised:has(input:checked) {
  border-color: #b07a12;
  background: #fdf0c9;
  box-shadow: inset 0 0 0 1px #b07a12;
}
.code-option input:focus-visible + .code-letter {
  outline: 2px solid var(--focus-outline);
  outline-offset: 3px;
  border-radius: 2px;
}
.marked-state {
  justify-self: end;
  min-width: 26px;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.marked-state.present { background: var(--softgreen); color: var(--green-dark); }
.marked-state.explained { background: #fdf0c9; color: #7c5206; }
.marked-state.absent { background: var(--flash-error-bg); color: var(--flash-error-text); }
.marked-state.unmarked { color: var(--faint); background: var(--cream); }

.roll-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 -4px 14px rgb(41 38 50 / 6%);
}
.roll-actions-copy { display: flex; flex-direction: column; gap: 1px; }
.roll-actions-copy strong { font-size: 12.5px; }
.roll-actions-copy span { color: var(--muted); font-size: 11px; }
.roll-actions-buttons { display: flex; gap: 7px; }

.flash {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
}
.flash.success { background: var(--flash-success-bg); border-color: var(--flash-success-border); color: var(--flash-success-text); }
.flash.error { background: var(--flash-error-bg); border-color: var(--flash-error-border); color: var(--flash-error-text); }
.flash.info { background: var(--flash-info-bg); border-color: var(--flash-info-border); color: var(--flash-info-text); }

/* -------------------------------------------------------------------------- */
/* Search results                                                              */
/* -------------------------------------------------------------------------- */

.search-results { display: grid; gap: 14px; }
.result-list { display: grid; }
.result-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.result-row:last-child { border-bottom: 0; }
.result-row:hover { color: var(--purple-dark); }
.result-row span:not(.avatar):not(.badge) { display: flex; flex-direction: column; min-width: 0; }
.result-row strong { font-size: 12.5px; }
.result-row small { color: var(--muted); font-size: 11px; }
.result-row .icon:last-child { margin-left: auto; color: var(--muted); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.pagination div { display: flex; gap: 5px; }

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .site-header { flex-wrap: wrap; gap: 6px 12px; }
  .main-nav { order: 4; width: 100%; border-top: 1px solid var(--line); padding-top: 5px; }
  .global-search { order: 3; flex: 1 1 100%; max-width: none; }
  .header-tools { order: 2; }
  .brand { order: 1; }
  .content-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .main { padding: 14px 10px 56px; }
  .site-header { padding: 5px 10px; }
  .brand-lockup small { display: none; }
  .main-nav a { font-size: 12px; padding: 7px 8px; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-stack { grid-template-columns: 1fr; }
  .search-toolbar { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .select-field { flex: 1 1 140px; }
  .search-toolbar .button { flex-grow: 1; }
  .page-header { align-items: flex-start; }
  .roll-student {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 9px 10px;
  }
  .code-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }
  .code-option {
    min-width: 0;
    height: 46px;
    flex: none;
  }
  .marked-state { justify-self: start; }
  .roll-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 0;
    padding: 9px 10px max(9px, env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgb(41 38 50 / 14%);
  }
  .roll-actions-copy span { display: none; }
  .roll-actions-buttons { flex: 1; justify-content: flex-end; }
  .roll-actions-buttons .button { min-height: 42px; }
  .roll-page { padding-bottom: 82px; }
  .attendance-score { align-items: flex-start; }
  .score-ring { flex-basis: 96px; width: 96px; height: 96px; }
  .score-ring strong { font-size: 19px; }
}

@media (max-width: 520px) {
  h1 { font-size: 21px; }
  .header-tools .button { display: none; }
  .global-search kbd { display: none; }
  .metric strong { font-size: 21px; }
  .panel { padding: 10px; }
  .empty-state { align-items: flex-start; }
  .empty-state img { width: 72px; height: 72px; }
  .score-breakdown { width: 100%; }
  .attendance-score { flex-direction: column; }
  .site-footer { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Public landing page                                                         */
/* -------------------------------------------------------------------------- */

.landing-body { background: var(--cream); }
.landing-header {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  padding: 6px max(4vw, 18px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.landing-nav {
  display: flex;
  gap: 3px;
  margin-left: auto;
  flex-wrap: wrap;
}
.landing-nav a {
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 12.5px;
  text-decoration: none;
}
.landing-nav a:hover { background: var(--cream); color: var(--purple-dark); }
.landing-main {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0 max(4vw, 18px) 48px;
}
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 42px;
  align-items: center;
  padding: 54px 0 46px;
  border-bottom: 1px solid var(--line);
}
.landing-copy h1 {
  max-width: 18ch;
  margin: 4px 0 14px;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.landing-copy .lede { max-width: 58ch; font-size: 15px; }
.landing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 10px;
}
.landing-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.landing-art > img {
  width: 100%;
  max-width: 280px;
  height: auto;
}
.landing-note {
  width: 100%;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.landing-note strong { display: block; font-size: 12.5px; }
.landing-note span { display: block; color: var(--muted); font-size: 11.5px; }
.landing-section { padding: 42px 0; border-bottom: 1px solid var(--line); }
.landing-section > h2 { max-width: 30ch; font-size: 24px; }
.landing-section > .lede { max-width: 65ch; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--line);
  overflow: hidden;
}
.feature {
  min-width: 0;
  padding: 16px;
  background: var(--paper);
}
.feature h3 { margin-bottom: 5px; font-size: 13px; }
.feature p { margin: 0; color: var(--muted); font-size: 12px; }
.landing-demo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}
.landing-demo > div:first-child { max-width: 62ch; }
.landing-demo h2 { margin-bottom: 6px; }
.landing-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px max(4vw, 18px) 30px;
  color: var(--muted);
  font-size: 11px;
}

/* -------------------------------------------------------------------------- */
/* Sign-in                                                                     */
/* -------------------------------------------------------------------------- */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px 14px;
  background: var(--cream);
}
.auth-wrap { width: 100%; max-width: 470px; }
.auth-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--ink);
  text-decoration: none;
}
.auth-brand img { width: 56px; height: 56px; display: block; }
.auth-brand span { display: flex; flex-direction: column; line-height: 1.1; }
.auth-brand strong { font-size: 18px; font-weight: 780; letter-spacing: -0.02em; }
.auth-brand small { color: var(--muted); font-size: 11px; }
.auth-head h1 { margin-bottom: 6px; font-size: 23px; }
.auth-head .lede { font-size: 12.5px; }
.auth-providers { display: grid; gap: 8px; margin: 16px 0 4px; }
.auth-provider { width: 100%; min-height: 42px; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}
.stack-form { display: grid; gap: 8px; }
.stack-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 650; }
.stack-form input { min-height: 40px; }
.auth-legal { margin-top: 16px; }
.auth-back { display: inline-block; margin-top: 8px; font-size: 12px; }

@media (max-width: 820px) {
  .landing-hero { grid-template-columns: 1fr; gap: 24px; padding: 32px 0; }
  .landing-art { flex-direction: row; align-items: flex-start; }
  .landing-art > img { max-width: 160px; }
  .landing-note { max-width: none; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .landing-header { flex-wrap: wrap; padding: 8px 14px; }
  .landing-nav { order: 3; width: 100%; border-top: 1px solid var(--line); padding-top: 5px; }
  .landing-header > .button { margin-left: auto; }
  .landing-main { padding-inline: 14px; }
  .feature-grid { grid-template-columns: 1fr; }
  .landing-art { flex-direction: column; align-items: flex-start; }
  .landing-copy h1 { font-size: 2rem; }
  .auth-card { padding: 16px; }
}

.code-option.selected {
  border-color: var(--purple);
  background: var(--pale);
  box-shadow: inset 0 0 0 1px var(--purple);
}
.code-option.present.selected {
  border-color: var(--green);
  background: var(--softgreen);
  box-shadow: inset 0 0 0 1px var(--green);
}
.code-option.absent.selected {
  border-color: var(--due-color);
  background: var(--flash-error-bg);
  box-shadow: inset 0 0 0 1px var(--due-color);
}
.code-option.authorised.selected {
  border-color: #b07a12;
  background: #fdf0c9;
  box-shadow: inset 0 0 0 1px #b07a12;
}
.read-only-banner { max-width: 1100px; }

.demo-notes {
  margin: 8px 0 12px;
  padding-left: 16px;
  color: var(--ink-soft);
  font-size: 12px;
}
.demo-notes li { margin: 0 0 5px; }
.demo-notes strong { color: var(--ink); }
