/* SchoolSystem — Scholara-style education product UI
   Light sidebar · soft pastel canvas · rounded white cards · coral accent
   Inspired by modern school finance / academy dashboards (not dark ERP chrome)
*/

:root {
  --canvas: #f0f1f5;
  --canvas-tint: #e8eaf0;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --sidebar-bg: #ffffff;
  --sidebar-w: 248px;
  --border: rgb(15 23 42 / 0.07);
  --border-strong: rgb(15 23 42 / 0.1);
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  /* Coral primary — Scholara energy, not AI purple */
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-soft: #ffe4e6;
  --primary-glow: rgb(225 29 72 / 0.14);
  --accent-purple: #7c3aed;
  --accent-purple-soft: #ede9fe;
  --accent-sky: #0284c7;
  --accent-sky-soft: #e0f2fe;
  --accent-amber: #d97706;
  --accent-amber-soft: #fef3c7;
  --accent-mint: #059669;
  --accent-mint-soft: #d1fae5;
  --success: #059669;
  --success-bg: #d1fae5;
  --danger: #e11d48;
  --danger-bg: #ffe4e6;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.03), 0 8px 24px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 4px 6px rgb(15 23 42 / 0.02), 0 16px 40px rgb(15 23 42 / 0.06);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body.app-body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
}

body.app-body::before,
.app-wash { display: none !important; }

.font-mono-ui {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

/* -------- Shell: soft canvas + inset content -------- */
.app-shell {
  min-height: 100dvh;
  background: var(--canvas);
}

.app-main-pad {
  padding-left: 0;
  padding-bottom: 5rem;
  min-height: 100dvh;
}

@media (min-width: 768px) {
  .app-main-pad {
    padding-left: var(--sidebar-w);
    padding-bottom: 1.5rem;
  }
}

.app-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.85rem 1rem 0;
  padding: 0 1.15rem 0 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

@media (min-width: 768px) {
  .app-topbar {
    display: flex;
    margin: 1rem 1.25rem 0 calc(var(--sidebar-w) + 0.5rem);
  }
  /* topbar sits in content flow under padded main — override */
  .app-main-pad .app-topbar {
    margin-left: 1.25rem;
    margin-right: 1.25rem;
  }
}

.app-topbar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text);
}

.app-topbar-meta {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.app-search {
  display: none;
  align-items: center;
  gap: 0.5rem;
  min-width: 220px;
  max-width: 320px;
  flex: 1;
  height: 2.5rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (min-width: 900px) {
  .app-search { display: flex; }
}

.app-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

@media (min-width: 768px) {
  .app-content {
    padding: 1.1rem 1.25rem 2rem;
  }
}

/* -------- Light sidebar (Scholara style) -------- */
.side-rail {
  position: fixed;
  inset: 0.75rem auto 0.75rem 0.75rem;
  z-index: 40;
  width: calc(var(--sidebar-w) - 12px);
  display: none;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--text-2);
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

@media (min-width: 768px) {
  .side-rail {
    display: flex;
  }
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.15rem 1.1rem 0.95rem;
}

.side-brand-mark {
  display: flex;
  height: 2.4rem;
  width: 2.4rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #e11d48;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.side-brand-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-brand-sub {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side-user {
  margin: 0.35rem 0.85rem 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.side-user .avatar {
  height: 2rem;
  width: 2rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.side-user .name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.side-user .handle {
  margin: 0.05rem 0 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0.7rem 0.75rem;
  scrollbar-width: thin;
}

.side-nav-label {
  margin: 0.85rem 0.55rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.side-link {
  display: flex;
  min-height: 2.55rem;
  align-items: center;
  gap: 0.7rem;
  border-radius: 12px;
  padding: 0.45rem 0.75rem;
  margin-bottom: 2px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.side-link:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.side-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.side-link svg {
  flex-shrink: 0;
  stroke-width: 1.6;
  opacity: 0.9;
}

.side-footer {
  padding: 0.55rem 0.7rem 0.85rem;
  border-top: 1px solid var(--border);
}

/* -------- Mobile -------- */
.mobile-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 3.4rem;
  align-items: center;
  justify-content: space-between;
  margin: 0.55rem 0.65rem 0;
  padding: 0 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

@media (min-width: 768px) {
  .mobile-top,
  .mobile-dock { display: none !important; }
}

.mobile-dock {
  position: fixed;
  left: 0.65rem;
  right: 0.65rem;
  bottom: calc(0.55rem + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.2rem;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.dock-item {
  display: flex;
  min-height: 3rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border-radius: 14px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}

.dock-item.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

/* -------- Type -------- */
.page-kicker {
  display: inline-flex;
  margin: 0 0 0.4rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
}

.page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1.15;
}

.page-sub {
  margin: 0.35rem 0 0;
  max-width: 40rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.section-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

@media (min-width: 640px) {
  .page-head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.breadcrumb {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover { color: var(--primary); }

/* -------- Cards -------- */
.bezel {
  border-radius: calc(var(--radius) + 2px);
  padding: 0;
  background: transparent;
}

.bezel-core {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.28s var(--ease), transform 0.22s var(--ease), border-color 0.22s var(--ease);
}

a.panel:hover,
.panel.is-interactive:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: rgb(15 23 42 / 0.1);
}

.stat-tile {
  padding: 1.05rem 1.15rem;
}

.stat-tile .value {
  margin: 0.35rem 0 0;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-icon {
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin-bottom: 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon svg {
  height: 1.15rem;
  width: 1.15rem;
  stroke-width: 1.6;
}

/* Flat pastel KPI cards — solid fills only, no gradients */
.kpi-lavender { background: #ede9fe; border-color: #ddd6fe; }
.kpi-lavender .stat-icon { background: #ddd6fe; color: #6d28d9; }
.kpi-sky { background: #e0f2fe; border-color: #bae6fd; }
.kpi-sky .stat-icon { background: #bae6fd; color: #0369a1; }
.kpi-peach { background: #ffedd5; border-color: #fed7aa; }
.kpi-peach .stat-icon { background: #fed7aa; color: #b45309; }
.kpi-mint { background: #d1fae5; border-color: #a7f3d0; }
.kpi-mint .stat-icon { background: #a7f3d0; color: #047857; }
.kpi-rose { background: #ffe4e6; border-color: #fecdd3; }
.kpi-rose .stat-icon { background: #fecdd3; color: #be123c; }

/* -------- Tables / lists -------- */
.list-row {
  display: flex;
  min-height: 3.35rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease);
}

.list-row:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table tbody tr:hover {
  background: rgb(225 29 72 / 0.02);
}

/* -------- Forms -------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.8rem; font-weight: 700; color: var(--text-2); }

.control {
  min-height: 2.7rem;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #fff;
  padding: 0.5rem 0.85rem;
  font-size: 0.925rem;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.control-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2394a3b8' stroke-width='1.75' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}

textarea.control { min-height: 5.5rem; resize: vertical; }

/* -------- Buttons -------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.18s var(--ease);
}

.btn:active { transform: scale(0.98); }

.btn-primary,
.btn-accent {
  background: #e11d48;
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover,
.btn-accent:hover {
  background: #be123c;
}

.btn-ghost {
  background: #fff;
  color: var(--text-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.btn-ghost:hover { background: var(--surface-soft); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-icon-trail {
  display: inline-flex;
  height: 1.5rem;
  width: 1.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.18);
}

/* -------- Pills -------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.pill::before {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 999px;
  background: currentColor;
}

.pill-active { background: var(--success-bg); color: var(--success); }
.pill-suspended { background: var(--danger-bg); color: var(--danger); }
.pill-pending { background: var(--warn-bg); color: var(--warn); }

/* -------- Pagination -------- */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.pagination-meta {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.pagination-meta strong {
  color: var(--text-2);
  font-weight: 800;
}

.pagination-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.pagination-btn,
.pagination-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
  padding: 0 0.7rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.pagination-btn:hover,
.pagination-num:hover {
  border-color: rgb(225 29 72 / 0.25);
  color: var(--primary);
  background: var(--primary-soft);
}

.pagination-num.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  pointer-events: none;
}

.pagination-btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 0 0.25rem;
  font-weight: 800;
  color: var(--faint);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .pagination-nav {
    justify-content: center;
  }
}

/* -------- Timetable grid -------- */
.tt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tt-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

.tt-grid th,
.tt-grid td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
}

.tt-grid thead th {
  background: var(--surface-soft);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.65rem 0.5rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.tt-period-col {
  width: 7.5rem;
  min-width: 7.5rem;
  background: var(--surface-soft) !important;
  text-align: left !important;
  padding: 0.65rem 0.75rem !important;
  position: sticky;
  left: 0;
  z-index: 3;
}

.tt-grid tbody th.tt-period-col {
  z-index: 1;
}

.tt-period-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  padding: 0.15rem 0.2rem;
  margin: -0.15rem -0.2rem;
  transition: background 0.12s var(--ease);
}

.tt-period-link:hover {
  background: var(--primary-soft);
}

.tt-period-link:hover .tt-period-edit-hint {
  opacity: 1;
}

.tt-period-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.tt-period-time {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}

.tt-period-edit-hint {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  opacity: 0.55;
}

.tt-edit-times-link {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  color: var(--primary);
  text-decoration: none;
}

.tt-edit-times-link:hover {
  text-decoration: underline;
}

.tt-break-tag {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--warn);
  background: var(--warn-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.tt-break-row td,
.tt-break-row th {
  background: #fffbeb;
}

.tt-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 4.25rem;
  padding: 0.45rem 0.4rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s var(--ease);
}

a.tt-cell:hover {
  background: var(--primary-soft);
}

.tt-cell-empty {
  align-items: center;
  justify-content: center;
  color: var(--faint);
}

.tt-cell-plus {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.tt-cell-filled {
  background: #fff;
  border-left: 3px solid transparent;
}

.tt-cell-filled .tt-cell-sub {
  color: var(--text);
}

/* Subject color chips on timetable */
.tt-subj-rose { background: #ffe4e6 !important; border-left-color: #e11d48 !important; }
.tt-subj-rose .tt-cell-sub { color: #9f1239 !important; }
.tt-subj-rose .tt-cell-meta { color: #be123c !important; }
.tt-subj-rose .tt-cell-room { color: #9f1239 !important; }

.tt-subj-sky { background: #e0f2fe !important; border-left-color: #0284c7 !important; }
.tt-subj-sky .tt-cell-sub { color: #075985 !important; }
.tt-subj-sky .tt-cell-meta { color: #0369a1 !important; }
.tt-subj-sky .tt-cell-room { color: #075985 !important; }

.tt-subj-mint { background: #d1fae5 !important; border-left-color: #059669 !important; }
.tt-subj-mint .tt-cell-sub { color: #065f46 !important; }
.tt-subj-mint .tt-cell-meta { color: #047857 !important; }
.tt-subj-mint .tt-cell-room { color: #065f46 !important; }

.tt-subj-violet { background: #ede9fe !important; border-left-color: #7c3aed !important; }
.tt-subj-violet .tt-cell-sub { color: #5b21b6 !important; }
.tt-subj-violet .tt-cell-meta { color: #6d28d9 !important; }
.tt-subj-violet .tt-cell-room { color: #5b21b6 !important; }

.tt-subj-amber { background: #fef3c7 !important; border-left-color: #d97706 !important; }
.tt-subj-amber .tt-cell-sub { color: #92400e !important; }
.tt-subj-amber .tt-cell-meta { color: #b45309 !important; }
.tt-subj-amber .tt-cell-room { color: #92400e !important; }

.tt-subj-peach { background: #ffedd5 !important; border-left-color: #ea580c !important; }
.tt-subj-peach .tt-cell-sub { color: #9a3412 !important; }
.tt-subj-peach .tt-cell-meta { color: #c2410c !important; }
.tt-subj-peach .tt-cell-room { color: #9a3412 !important; }

.tt-subj-indigo { background: #e0e7ff !important; border-left-color: #4f46e5 !important; }
.tt-subj-indigo .tt-cell-sub { color: #3730a3 !important; }
.tt-subj-indigo .tt-cell-meta { color: #4338ca !important; }
.tt-subj-indigo .tt-cell-room { color: #3730a3 !important; }

.tt-subj-teal { background: #ccfbf1 !important; border-left-color: #0d9488 !important; }
.tt-subj-teal .tt-cell-sub { color: #115e59 !important; }
.tt-subj-teal .tt-cell-meta { color: #0f766e !important; }
.tt-subj-teal .tt-cell-room { color: #115e59 !important; }

.tt-subj-pink { background: #fce7f3 !important; border-left-color: #db2777 !important; }
.tt-subj-pink .tt-cell-sub { color: #9d174d !important; }
.tt-subj-pink .tt-cell-meta { color: #be185d !important; }
.tt-subj-pink .tt-cell-room { color: #9d174d !important; }

.tt-subj-lime { background: #ecfccb !important; border-left-color: #65a30d !important; }
.tt-subj-lime .tt-cell-sub { color: #3f6212 !important; }
.tt-subj-lime .tt-cell-meta { color: #4d7c0f !important; }
.tt-subj-lime .tt-cell-room { color: #3f6212 !important; }

.tt-subj-cyan { background: #cffafe !important; border-left-color: #0891b2 !important; }
.tt-subj-cyan .tt-cell-sub { color: #155e75 !important; }
.tt-subj-cyan .tt-cell-meta { color: #0e7490 !important; }
.tt-subj-cyan .tt-cell-room { color: #155e75 !important; }

.tt-subj-slate { background: #f1f5f9 !important; border-left-color: #64748b !important; }
.tt-subj-slate .tt-cell-sub { color: #334155 !important; }
.tt-subj-slate .tt-cell-meta { color: #475569 !important; }
.tt-subj-slate .tt-cell-room { color: #334155 !important; }

.tt-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.tt-legend-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-right: 0.25rem;
}

.tt-legend-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  border-left: 3px solid transparent;
}

.tt-legend-edit {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
}

.tt-legend-edit:hover { text-decoration: underline; }

/* Color picker on Subjects page */
.subject-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.subject-color-opt {
  position: relative;
  cursor: pointer;
  line-height: 0;
}

.subject-color-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.subject-color-dot {
  display: inline-block;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 2px solid rgb(15 23 42 / 0.08);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.4);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.subject-color-opt input:checked + .subject-color-dot {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary);
}

.subject-color-opt:hover .subject-color-dot {
  transform: scale(1.08);
}

.tt-cell-break {
  align-items: center;
  justify-content: center;
  background: transparent;
  min-height: 3rem;
  opacity: 0.75;
}

.tt-cell-sub {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tt-cell-meta {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tt-cell-room {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-sky);
  font-variant-numeric: tabular-nums;
}

.tt-cell-readonly {
  pointer-events: none;
}

/* -------- Flash -------- */
.flash {
  border-radius: 14px;
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.flash-ok { background: var(--success-bg); color: var(--success); border-color: rgb(5 150 105 / 0.12); }
.flash-err { background: var(--danger-bg); color: var(--danger); border-color: rgb(225 29 72 / 0.12); }

.avatar-mark,
.initial-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 800;
}

.initial-chip {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgb(225 29 72 / 0.1);
}

.rise, .rise-d1, .rise-d2, .rise-d3, .rise-d4 {
  animation: none !important;
  filter: none !important;
  opacity: 1 !important;
  transform: none !important;
}

/* Map legacy utilities → coral product */
.text-copper, .text-copper-deep, .hover\:text-copper-deep:hover,
.text-blue-700, .text-teal-700, .hover\:text-teal-800:hover {
  color: var(--primary) !important;
}
.bg-copper, .bg-blue-600 { background: var(--primary) !important; }
.bg-copper-soft, .bg-teal-50 { background: var(--primary-soft) !important; }
.text-teal-800 { color: var(--primary) !important; }
.bg-paper, .bg-paper\/80, .bg-paper-2 { background: var(--surface-soft) !important; }
.text-ink, .text-ink-2 { color: var(--text) !important; }
.text-ink-muted, .text-ink-faint { color: var(--muted) !important; }
.ring-teal-100 { --tw-ring-color: rgb(225 29 72 / 0.15) !important; }

.meter {
  height: 0.45rem;
  border-radius: 999px;
  background: rgb(15 23 42 / 0.06);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #e11d48;
}

/* -------- Login -------- */
.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--canvas);
}

.login-brand { display: none !important; }

.login-form-wrap {
  width: 100%;
  max-width: 420px;
  padding: 0;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.55rem 1.55rem;
}

.login-card h1 {
  margin: 1rem 0 0.3rem;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-card .hint {
  margin: 0 0 1.35rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

/* Feed items */
.feed-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: 0; }
.feed-icon {
  height: 2.25rem;
  width: 2.25rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
}

/* -------- Attendance register -------- */
.att-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.att-present { background: #d1fae5; color: #065f46; }
.att-absent { background: #ffe4e6; color: #9f1239; }
.att-late { background: #fef3c7; color: #92400e; }
.att-excused { background: #ede9fe; color: #5b21b6; }

.att-status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.att-status-opt {
  position: relative;
  cursor: pointer;
  line-height: 1;
}

.att-status-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.att-status-opt span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease);
}

.att-status-opt input:checked + span {
  border-color: transparent;
}

.att-status-present input:checked + span {
  background: #d1fae5;
  color: #065f46;
}
.att-status-absent input:checked + span {
  background: #ffe4e6;
  color: #9f1239;
}
.att-status-late input:checked + span {
  background: #fef3c7;
  color: #92400e;
}
.att-status-excused input:checked + span {
  background: #ede9fe;
  color: #5b21b6;
}

.att-status-opt:hover span {
  border-color: rgb(225 29 72 / 0.25);
}

.att-row:hover {
  background: rgb(248 250 252 / 0.8);
}

.kpi-amber { background: #fef3c7; border-color: #fde68a; }
.kpi-amber .stat-icon { background: #fde68a; color: #b45309; }

/* -------- Student attendance calendar -------- */
.att-cal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .att-cal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .att-cal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.att-cal-month {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem;
  background: #fff;
}

.att-cal-month-title {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.att-cal-dows {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
  margin-bottom: 0.25rem;
}

.att-cal-dows span {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--faint);
  padding: 0.15rem 0;
}

.att-cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
  margin-bottom: 0.2rem;
}

.att-cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 1.85rem;
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid transparent;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease);
}

a.att-cal-day:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.08);
  z-index: 1;
}

.att-cal-day.is-empty {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.att-cal-day.is-present {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.att-cal-day.is-absent {
  background: #ffe4e6;
  color: #9f1239;
  border-color: #fecdd3;
}

.att-cal-day.is-late {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.att-cal-day.is-excused {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}

.att-cal-day.is-none {
  background: #f8fafc;
  color: #94a3b8;
}

.att-cal-day.is-today {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.att-cal-day.is-out {
  opacity: 0.35;
}

.att-cal-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 4px;
  border: 1px solid rgb(15 23 42 / 0.08);
}

.att-cal-swatch.is-present { background: #d1fae5; }
.att-cal-swatch.is-absent { background: #ffe4e6; }
.att-cal-swatch.is-late { background: #fef3c7; }
.att-cal-swatch.is-excused { background: #ede9fe; }
.att-cal-swatch.is-none { background: #f1f5f9; }
.att-cal-swatch.is-today {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--primary);
}

/* -------- Exams marksheet -------- */
.marks-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.marks-table th, .marks-table td { white-space: nowrap; }
.marks-sticky {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}
.marks-sticky-2 {
  position: sticky;
  left: 2rem;
  background: #fff;
  z-index: 2;
  min-width: 10rem;
}
.marks-table thead .marks-sticky,
.marks-table thead .marks-sticky-2 {
  background: var(--surface-soft);
  z-index: 3;
}

.exam-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
}
.grade-a { background: #d1fae5; color: #065f46; }
.grade-b { background: #ccfbf1; color: #115e59; }
.grade-c { background: #e0f2fe; color: #075985; }
.grade-d { background: #fef3c7; color: #92400e; }
.grade-e { background: #ffedd5; color: #9a3412; }
.grade-f { background: #ffe4e6; color: #9f1239; }
