/* ClassDojo Offline — SK Dataran Muda
   Native Application Design System (iPad / Desktop App Shell) */

:root {
  --brand: #00b289;
  --brand-dark: #009270;
  --brand-light: #38d9a9;
  --brand-gradient: linear-gradient(135deg, #009270 0%, #00b289 50%, #14b8a6 100%);
  
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f0f4f6;
  --surface-card: #ffffff;
  
  --text: #0f1e22;
  --text-secondary: #4a6368;
  --muted: #6b858b;
  --line: #d8e2e6;
  --line-strong: #c2d2d7;
  
  --pos: #10b981;
  --pos-dark: #059669;
  --pos-soft: rgba(16, 185, 129, 0.12);
  
  --neg: #f43f5e;
  --neg-dark: #e11d48;
  --neg-soft: rgba(244, 63, 94, 0.12);
  
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  
  --blue: #0284c7;
  
  --shadow-sm: 0 2px 6px rgba(15, 30, 34, 0.04);
  --shadow-md: 0 6px 18px rgba(15, 30, 34, 0.06), 0 1px 3px rgba(15, 30, 34, 0.04);
  --shadow-lg: 0 14px 34px rgba(15, 30, 34, 0.09), 0 2px 6px rgba(15, 30, 34, 0.04);
  --shadow-sheet: 0 -12px 48px rgba(15, 30, 34, 0.18), 0 0 0 1px var(--line);
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-theme="dark"] {
  --brand: #10b981;
  --brand-dark: #059669;
  --brand-light: #34d399;
  --brand-gradient: linear-gradient(135deg, #065f46 0%, #059669 50%, #10b981 100%);
  
  --bg: #0b1319;
  --surface: #132029;
  --surface-2: #1b2d39;
  --surface-card: #14232e;
  
  --text: #f1f7fa;
  --text-secondary: #9cb5c1;
  --muted: #7997a5;
  --line: #223746;
  --line-strong: #2c475a;
  
  --pos: #34d399;
  --pos-dark: #10b981;
  --pos-soft: rgba(52, 211, 153, 0.16);
  
  --neg: #fb7185;
  --neg-dark: #f43f5e;
  --neg-soft: rgba(251, 113, 133, 0.16);
  
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.45);
  --shadow-sheet: 0 -12px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--line);
}

/* ---------- 1. Viewport Architecture (App Shell Lock) ---------- */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden; /* App Shell: Never scroll the browser window */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  position: relative;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  touch-action: manipulation;
}

input, select, textarea {
  font: inherit;
  color: inherit;
  user-select: text;
  -webkit-user-select: text;
}

h1, h2, h3, h4, p {
  margin: 0;
}

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

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

/* ---------- 2. Top Bar (App Header) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 146, 112, 0.22), inset 0 -1px 0 rgba(255, 255, 255, 0.15);
  flex: none;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: rotate(-3deg);
  transition: transform 0.2s var(--spring);
}
.brand:hover .brand-mark {
  transform: rotate(0deg) scale(1.06);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-text p {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.88;
  letter-spacing: 0.01em;
}

.dot-offline {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.35);
  display: inline-block;
}

/* Native Segmented Class Switcher */
.class-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
  background: rgba(0, 0, 0, 0.18);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}

.class-tabs button {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.82);
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  min-height: 38px;
  transition: all 0.2s var(--spring);
}
.class-tabs button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.class-tabs button.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.1);
  transform: scale(1.02);
}
html[data-theme="dark"] .class-tabs button.active {
  background: #ffffff;
  color: #065f46;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.score-pill {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  min-width: 58px;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Tactile Native App Buttons */
.btn {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--spring), box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.btn:active {
  transform: scale(0.96) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.45);
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 178, 137, 0.3);
}
.btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}
.btn.danger {
  background: var(--neg);
  border-color: var(--neg);
  color: #fff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
}
.btn.danger:hover {
  background: var(--neg-dark);
  border-color: var(--neg-dark);
}
.btn.wide {
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---------- 3. View Switcher (iOS Segmented Capsule Dock) ---------- */
.viewtabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.viewtabs::-webkit-scrollbar {
  display: none;
}

.viewtabs button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  min-height: 38px;
  transition: all 0.2s var(--spring);
}
.viewtabs button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--brand));
  transform: translateY(-1px);
}
.viewtabs button.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 3px 12px rgba(0, 178, 137, 0.35);
  transform: scale(1.02);
}

/* ---------- 4. Main Viewport & Scroll Container ---------- */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px 36px;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 30, 34, 0.2) transparent;
}
.main::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.main::-webkit-scrollbar-track {
  background: transparent;
}
.main::-webkit-scrollbar-thumb {
  background: rgba(15, 30, 34, 0.2);
  border-radius: 999px;
}
html[data-theme="dark"] .main {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
html[data-theme="dark"] .main::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

/* Action Toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.toolbar input[type="date"],
.toolbar input[type="number"],
.toolbar select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  min-height: 40px;
}

/* ---------- 5. 3D Tactile Squircle Student Pods (.pupil) ---------- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.pupil {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  min-height: 82px;
  width: 100%;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: visible;
}
html[data-theme="dark"] .pupil {
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pupil:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--brand);
  border-color: var(--brand);
}
.pupil:active {
  transform: scale(0.95) !important;
  transition: transform 0.08s var(--spring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pupil .avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  transition: transform 0.3s var(--spring);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}
.pupil:hover .avatar {
  transform: scale(1.1) rotate(-3deg);
}

.pupil .meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pupil .name {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pupil .tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 1px 8px;
  border-radius: 999px;
  width: fit-content;
  margin-top: 3px;
}

.pupil .pts {
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: all 0.2s var(--spring);
}
.pts.pos {
  background: var(--pos-soft);
  color: var(--pos);
  border-color: var(--pos);
}
.pts.neg {
  background: var(--neg-soft);
  color: var(--neg);
  border-color: var(--neg);
}
.pts.zero {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
}

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 16px;
}

/* ---------- 6. Native Bottom Sheet / Drawer Modals ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  background: rgba(11, 20, 26, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: modalFadeIn 0.2s ease;
}
.modal-root[hidden] {
  display: none;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 740px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  animation: sheetSpringUp 0.32s var(--spring);
  position: relative;
}
@keyframes sheetSpringUp {
  from { transform: translateY(80px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Tactile Grab Handle */
.sheet::before {
  content: '';
  display: block;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 10px auto 4px;
  opacity: 0.8;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.sheet-head .avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}
.sheet-head h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.sheet-head .sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.sheet-body {
  padding: 20px 24px 32px;
}

.beh-group {
  margin-bottom: 22px;
}
.beh-group h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 800;
}
.beh-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.beh {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 54px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--spring), background 0.15s ease, border-color 0.15s ease;
}
.beh:hover {
  transform: translateY(-2px);
  background: var(--surface);
}
.beh:active {
  transform: scale(0.94) !important;
}
.beh .ico {
  font-size: 20px;
  line-height: 1;
}
.beh .val {
  margin-left: auto;
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 999px;
}
.beh.positive {
  border-color: color-mix(in srgb, var(--pos) 30%, var(--line));
}
.beh.positive .val {
  color: var(--pos);
  background: var(--pos-soft);
}
.beh.negative {
  border-color: color-mix(in srgb, var(--neg) 30%, var(--line));
}
.beh.negative .val {
  color: var(--neg);
  background: var(--neg-soft);
}

.quick {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.quick .btn {
  flex: 1;
  font-size: 18px;
  font-weight: 800;
  min-height: 54px;
  border-radius: var(--radius-md);
}

.history {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.history h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 800;
}
.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
  font-weight: 600;
}
.hist-row .when {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- 7. Attendance ---------- */
.att-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.att-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.att-card .avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex: none;
}
.att-card .nm {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.seg button {
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 12px;
  min-height: 32px;
  color: var(--muted);
  transition: all 0.15s ease;
}
.seg button[aria-pressed="true"][data-v="present"] {
  background: var(--pos);
  color: #fff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}
.seg button[aria-pressed="true"][data-v="late"] {
  background: var(--warn);
  color: #fff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}
.seg button[aria-pressed="true"][data-v="absent"] {
  background: var(--neg);
  color: #fff;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.3);
}

/* ---------- 8. Reports ---------- */
.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 22px;
}
.stat {
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .k {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.stat .v {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.tablewrap {
  overflow: auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 800;
}
td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  min-width: 3px;
}

/* ---------- 9. Picker ---------- */
.picker-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  gap: 22px;
  text-align: center;
}
.picker-name {
  font-size: clamp(30px, 7vw, 68px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
  min-height: 1.2em;
}
.picker-sub {
  color: var(--muted);
  font-weight: 600;
  font-size: 16px;
}
.picker-avatar {
  width: 130px;
  height: 130px;
  border-radius: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 48px;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s var(--spring);
}
.spin {
  animation: pickerPulse 0.16s linear infinite alternate;
}
@keyframes pickerPulse {
  to { transform: scale(1.06); }
}

/* ---------- 10. Toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #0f1e22;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.24s var(--spring);
}
.toast.pos {
  background: var(--pos-dark);
}
.toast.neg {
  background: var(--neg-dark);
}
@keyframes toastIn {
  from { transform: translateY(14px) scale(0.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- 11. Groups ---------- */
.group {
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease, border-color 0.2s ease;
}
.group:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}
.group:active {
  transform: scale(0.96) !important;
}
.grp-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.grp-name {
  font-weight: 800;
  font-size: 16px;
}
.grp-total {
  margin-left: auto;
  font-weight: 900;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 999px;
}
.grp-total.pos {
  color: var(--pos);
  background: var(--pos-soft);
}
.grp-total.neg {
  color: var(--neg);
  background: var(--neg-soft);
}
.grp-total.zero {
  color: var(--muted);
  background: var(--surface-2);
}
.grp-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
}
.grp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.grp-edit {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface);
}
.grp-edit:hover {
  background: var(--surface-2);
}
.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.member {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px 6px 14px;
  font-size: 13px;
  font-weight: 700;
}
.member .x {
  border: none;
  background: transparent;
  color: var(--neg);
  font-weight: 900;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

/* ---------- 12. Smartboard Big Mode ---------- */
html[data-big="1"] .grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
html[data-big="1"] .pupil {
  min-height: 124px;
  padding: 20px;
  gap: 20px;
  border-radius: var(--radius-xl);
}
html[data-big="1"] .pupil .avatar {
  width: 78px;
  height: 78px;
  border-radius: 22px;
}
html[data-big="1"] .pupil .name {
  font-size: 21px;
  -webkit-line-clamp: 3;
}
html[data-big="1"] .pupil .tag {
  display: none;
}
html[data-big="1"] .pupil .pts {
  font-size: 30px;
  min-width: 64px;
  height: 64px;
}
html[data-big="1"] .brand-text h1 {
  font-size: 24px;
}
html[data-big="1"] .score-pill {
  font-size: 24px;
  padding: 10px 24px;
}
html[data-big="1"] .class-tabs button {
  font-size: 17px;
  padding: 12px 24px;
}
html[data-big="1"] .beh {
  min-height: 68px;
  font-size: 18px;
}
html[data-big="1"] .sheet {
  max-width: 980px;
}
html[data-big="1"] .grp-name {
  font-size: 20px;
}
html[data-big="1"] .grp-total {
  font-size: 32px;
}
html[data-big="1"] .chip {
  width: 48px;
  height: 48px;
  font-size: 16px;
}
html[data-big="1"] .picker-name {
  font-size: clamp(44px, 10vw, 104px);
}
html[data-big="1"] .picker-avatar {
  width: 180px;
  height: 180px;
  font-size: 72px;
  border-radius: 50px;
}

/* ---------- 13. Settings & Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  width: 100%;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.row > * {
  flex: 1;
}
.settings-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 8px;
}
hr.sep {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.hint {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- 14. Responsive Layout ---------- */
@media (max-width: 768px) {
  .main {
    padding: 14px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .brand-text p {
    display: none;
  }
  .score-pill {
    min-width: 50px;
    padding: 6px 12px;
  }
}

@media print {
  .topbar, .viewtabs, .toolbar, .btn, .toasts {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
    overflow: visible !important;
    height: auto !important;
  }
  .tablewrap {
    border-color: #999;
  }
}
