/* =========================================================================
   Blooming Buds — School Diary
   Design language: a school diary/planner, not a generic admin dashboard.
   Signature elements: torn-tab cards (like planner page dividers), a
   spiral-bound edge on the login card, and role colours that persist
   everywhere a role shows up (teacher / student / parent).
   ========================================================================= */

:root {
  /* ---- Colour tokens -------------------------------------------------- */
  --ink: #1F2A3C;
  --ink-soft: #616E82;
  --ink-faint: #98A2B3;

  --canvas: #F2F5FA;
  --paper: #FFFFFF;
  --paper-line: #E4E9F1;

  --marigold: #F5A623;
  --marigold-dark: #D5890C;
  --marigold-wash: #FEF3DF;

  --leaf: #2E9E6D;
  --leaf-dark: #227D56;
  --leaf-wash: #E4F6EE;

  --sky: #3E6BE0;
  --sky-dark: #2E51B3;
  --sky-wash: #E8EEFD;

  --coral: #E0575B;
  --coral-dark: #C13F43;
  --coral-wash: #FBE7E7;

  /* ---- Type ------------------------------------------------------------ */
  --font-display: 'Fredoka', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ---- Shape / motion --------------------------------------------------- */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 2px rgba(31, 42, 60, 0.04), 0 8px 24px -12px rgba(31, 42, 60, 0.16);
  --shadow-pop: 0 12px 32px -8px rgba(31, 42, 60, 0.22);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--canvas);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(31,42,60,0.05) 1px, transparent 0);
  background-size: 22px 22px;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--ink); }
p { margin: 0; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2.5px solid var(--sky);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- Layout shells -------------------------------------------------------- */
.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: row;
}
.page-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }

/* =========================================================================
   Sidebar — admin-panel style navigation
   ========================================================================= */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--paper);
  border-right: 1px solid var(--paper-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 25;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--paper-line);
}
.sidebar__brand .brand__mark { width: 34px; height: 34px; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar__brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.sidebar__brand-sub {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

/* ---- Navigation items --------------------------------------------------- */
.sidebar__nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s var(--ease);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.sidebar__item:hover {
  background: var(--canvas);
  color: var(--ink);
  text-decoration: none;
}
.sidebar__item:active {
  transform: scale(0.98);
}
.sidebar__item svg {
  flex-shrink: 0;
  transition: color 0.15s var(--ease);
}

/* Active state — left accent bar */
.sidebar__item.is-active {
  font-weight: 600;
  background: var(--canvas);
}
.sidebar__item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
}

/* Role-specific active colours */
.sidebar--teacher .sidebar__item.is-active { color: var(--sky-dark); }
.sidebar--teacher .sidebar__item.is-active svg { color: var(--sky); }
.sidebar--teacher .sidebar__item.is-active::before { background: var(--sky); }
.sidebar--teacher .sidebar__item:hover:not(.is-active) { color: var(--sky); }

.sidebar--student .sidebar__item.is-active { color: var(--marigold-dark); }
.sidebar--student .sidebar__item.is-active svg { color: var(--marigold); }
.sidebar--student .sidebar__item.is-active::before { background: var(--marigold); }
.sidebar--student .sidebar__item:hover:not(.is-active) { color: var(--marigold); }

.sidebar--parent .sidebar__item.is-active { color: var(--coral-dark); }
.sidebar--parent .sidebar__item.is-active svg { color: var(--coral); }
.sidebar--parent .sidebar__item.is-active::before { background: var(--coral); }
.sidebar--parent .sidebar__item:hover:not(.is-active) { color: var(--coral); }

/* Spacer pushes user section to bottom */
.sidebar__spacer { flex: 1; }

/* ---- User section at bottom --------------------------------------------- */
.sidebar__user {
  padding: 14px 14px 18px;
  border-top: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar__user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-faint);
}
.sidebar__user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar__user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  font-size: 0.6rem;
  padding: 2px 6px;
  margin-top: 2px;
  width: fit-content;
}
.sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  flex-shrink: 0;
  transition: all 0.15s var(--ease);
}
.sidebar__logout:hover {
  background: var(--coral-wash);
  color: var(--coral);
  text-decoration: none;
}

/* ---- Hamburger toggle (mobile) ------------------------------------------ */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s var(--ease);
}
.sidebar-toggle:hover { background: var(--canvas); }
.sidebar-toggle svg { width: 22px; height: 22px; }

/* ---- Sidebar overlay (mobile) ------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(31, 42, 60, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.15s var(--ease);
}

/* ---- Desktop: sidebar always visible ------------------------------------ */
@media (min-width: 1025px) {
  .sidebar-toggle { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* ---- Mobile: sidebar as slide-out drawer -------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    z-index: 30;
    box-shadow: none;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(31, 42, 60, 0.15);
  }
  .sidebar.is-open ~ .sidebar-overlay {
    display: block;
  }
  .sidebar-toggle { display: flex; }
  .page-main { min-height: 100dvh; }
}

/* ---- Very small screens ------------------------------------------------- */
@media (max-width: 480px) {
  .sidebar { width: 260px; }
}

/* ---- Top app bar ------------------------------------------------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-line);
}
.appbar__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 38px; height: 38px;
  flex-shrink: 0;
  object-fit: contain;
  display: inline-block;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}
.brand__subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}
.appbar__actions { display: flex; align-items: center; gap: 10px; }
.appbar__spacer { flex: 1; }

.person {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.person strong { color: var(--ink); font-weight: 600; }
.person__detail { color: var(--ink-soft); font-size: 0.78rem; }
.child-chip__detail { display: block; font-size: 0.7rem; color: var(--ink-soft); font-weight: 400; }

/* ---- Role badge / chip -------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip--teacher { background: var(--sky-wash); color: var(--sky-dark); }
.chip--student { background: var(--marigold-wash); color: var(--marigold-dark); }
.chip--parent  { background: var(--coral-wash); color: var(--coral-dark); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--primary { background: var(--marigold); color: #4A2E00; box-shadow: 0 6px 16px -6px rgba(245,166,35,0.55); }
.btn--primary:hover { background: var(--marigold-dark); }
.btn--sky { background: var(--sky); color: #fff; box-shadow: 0 6px 16px -6px rgba(62,107,224,0.5); }
.btn--sky:hover { background: var(--sky-dark); }
.btn--leaf { background: var(--leaf); color: #fff; box-shadow: 0 6px 16px -6px rgba(46,158,109,0.5); }
.btn--leaf:hover { background: var(--leaf-dark); }
.btn--coral { background: var(--coral); color: #fff; box-shadow: 0 6px 16px -6px rgba(224,87,91,0.5); }
.btn--coral:hover { background: var(--coral-dark); }
.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--paper-line);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--canvas); color: var(--ink); }
.btn[disabled] { opacity: 0.55; cursor: progress; transform: none; }
.btn--compact { padding: 8px 14px; font-size: 0.82rem; }

/* ---- Cards & the "diary tab" signature ---------------------------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  position: relative;
}
@media (max-width: 560px) {
  .card { padding: 18px; border-radius: var(--radius-md); }
}

/* a small coloured tab peeking out of the top-left corner, like a
   divider tab on a page in a school diary */
.tab-card { padding-top: 30px; }
.tab-card::before {
  content: attr(data-tab);
  position: absolute;
  top: -1px;
  left: 22px;
  transform: translateY(-100%);
  background: var(--tab-color, var(--sky));
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px 5px;
  border-radius: 8px 8px 0 0;
}

/* ---- Login page ----------------------------------------------------------- */
.auth {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth__frame { width: 100%; max-width: 420px; }
.auth__intro { text-align: center; margin-bottom: 22px; }
.auth__intro .brand__mark { width: 56px; height: 56px; margin: 0 auto 12px; }
.auth__intro h1 { font-size: 1.5rem; }
.auth__intro p { color: var(--ink-soft); margin-top: 4px; font-size: 0.92rem; }

.auth-card {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 28px 26px 26px 38px;
  overflow: hidden;
}
/* spiral-bound left edge */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 18px;
  background-image: radial-gradient(circle, var(--canvas) 3.5px, transparent 3.6px);
  background-size: 100% 26px;
  background-position: 9px 13px;
  background-repeat: repeat-y;
  border-right: 1px dashed var(--paper-line);
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.role-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.role-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--paper-line);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.15s var(--ease);
  user-select: none;
}
.role-tab svg { width: 20px; height: 20px; }
.role-tabs input:checked + .role-tab {
  border-color: transparent;
  color: #fff;
  transform: translateY(-2px);
}
.role-tabs input:focus-visible + .role-tab { outline: 2.5px solid var(--sky); outline-offset: 2px; }
.role-tabs input[value="teacher"]:checked + .role-tab { background: var(--sky); box-shadow: 0 8px 18px -8px rgba(62,107,224,0.6); }
.role-tabs input[value="student"]:checked + .role-tab { background: var(--marigold); color: #4A2E00; box-shadow: 0 8px 18px -8px rgba(245,166,35,0.6); }
.role-tabs input[value="parent"]:checked + .role-tab { background: var(--coral); box-shadow: 0 8px 18px -8px rgba(224,87,91,0.6); }

/* ---- Floating-label fields ------------------------------------------------ */
.field { position: relative; margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 0; }
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--paper-line);
  background: var(--canvas);
  border-radius: var(--radius-sm);
  padding: 18px 14px 8px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.field textarea { padding-top: 20px; resize: vertical; min-height: 110px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--sky);
  background: var(--paper);
}
.field label {
  position: absolute;
  left: 15px;
  top: 13px;
  font-size: 0.95rem;
  color: var(--ink-faint);
  pointer-events: none;
  transition: all 0.13s var(--ease);
  background: transparent;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field select:focus + label,
.field select.has-value + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label {
  top: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--sky-dark);
}
.field--select select { appearance: none; padding-right: 36px; cursor: pointer; }
.field--select::after {
  content: '';
  position: absolute;
  right: 15px; top: 22px;
  width: 9px; height: 9px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg);
  pointer-events: none;
}
.field--select label { top: 6px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-soft); position: static; display: block; margin-bottom: 4px; }
.field--select select { padding: 12px 32px 12px 12px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.password-field .toggle-visibility {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 6px;
  display: flex;
}
.password-field .toggle-visibility:hover { color: var(--ink-soft); }

/* ---- Alerts / toast --------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.alert--error { background: var(--coral-wash); color: var(--coral-dark); }
.alert--notice { background: var(--marigold-wash); color: var(--marigold-dark); }
.alert svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

.hint-note {
  margin-top: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

@media (max-width: 520px) {
  .auth { padding: 24px 12px; }
  .auth-card { padding: 20px 14px 20px 14px; }
  .auth-card::before { display: none; }
  .auth__frame { max-width: 100%; }
  .auth__intro h1 { font-size: 1.15rem; }
  .auth__intro .brand__mark { width: 44px; height: 44px; }
  .role-tab { padding: 10px 4px 8px; font-size: 0.72rem; }
  .role-tab svg { width: 18px; height: 18px; }
}

/* ---- Section headings on dashboards ------------------------------------- */
.page-head { padding: 26px 0 8px; }
.page-head h2 { font-size: 1.4rem; }
.page-head p { color: var(--ink-soft); font-size: 0.92rem; margin-top: 3px; }
.page-head__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head__row .btn { flex-shrink: 0; margin-top: 4px; }

/* ---- Filter bar (student/parent) ---------------------------------------- */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar .field { margin-bottom: 0; min-width: 170px; flex: 1; }
.filter-bar .btn { flex-shrink: 0; }

/* ---- Search bar (student) ----------------------------------------------- */
.search-bar { margin-bottom: 22px; }
.search-field {
  position: relative;
}
.search-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
  z-index: 1;
}
.search-field input {
  padding-left: 40px !important;
}
.search-field input:focus + label,
.search-field input:not(:placeholder-shown) + label {
  left: 40px;
}

/* ---- Child chips (parent) ---------------------------------------------- */
.child-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}
.child-chip {
  flex-shrink: 0;
  border: 1.5px solid var(--paper-line);
  background: var(--paper);
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.child-chip.is-active {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(224,87,91,0.55);
}

/* ---- Homework diary entries --------------------------------------------- */
.entry-list { display: flex; flex-direction: column; gap: 16px; }
.entry {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-md);
  padding: 18px 18px 18px 22px;
  box-shadow: var(--shadow-card);
}
.entry::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 4px;
  background: var(--entry-accent, var(--sky));
}
.entry__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.entry__date {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.entry__date svg { width: 16px; height: 16px; color: var(--ink-faint); }
.entry__subject {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: var(--sky-wash);
  color: var(--sky-dark);
}
.entry__head .due-badge { margin-left: auto; }
.due-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.due-badge--overdue { background: var(--coral-wash); color: var(--coral-dark); }
.due-badge--soon { background: var(--marigold-wash); color: var(--marigold-dark); }
.due-badge--ok { background: var(--leaf-wash); color: var(--leaf-dark); }
.entry__desc { color: var(--ink); font-size: 0.95rem; white-space: pre-line; }
.entry__attachments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.attachment-thumb {
  width: 76px; height: 76px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--paper-line);
  position: relative;
  display: block;
}
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Empty state --------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-soft);
}
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 14px; color: var(--paper-line); }
.empty-state h3 { font-size: 1.05rem; color: var(--ink); margin-bottom: 4px; }
.empty-state p { font-size: 0.88rem; }

/* ---- Upload dropzone (teacher) ------------------------------------------- */
.dropzone {
  border: 2px dashed var(--paper-line);
  border-radius: var(--radius-md);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  background: var(--canvas);
}
.dropzone.is-dragover { border-color: var(--sky); background: var(--sky-wash); }
.dropzone svg { width: 30px; height: 30px; color: var(--ink-faint); margin: 0 auto 8px; }
.dropzone__title { font-weight: 600; font-size: 0.92rem; }
.dropzone__hint { font-size: 0.78rem; color: var(--ink-faint); margin-top: 2px; }
.dropzone input[type="file"] { display: none; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.preview-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; border: 1px solid var(--paper-line); }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .remove-btn {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(31,42,60,0.65);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

/* ---- Footer --------------------------------------------------------------- */
.app-footer {
  margin-top: auto;
  padding: 26px 20px 32px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ---- Small helpers --------------------------------------------------------- */
.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;
}
.section-gap { margin-top: 26px; }

/* =========================================================================
   Bottom Navigation — mobile tab bar, desktop inline tabs
   ========================================================================= */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--paper);
  border-top: 1px solid var(--paper-line);
  padding: 6px 12px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  box-shadow: 0 -2px 12px rgba(31,42,60,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 20px 6px;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: all 0.18s var(--ease);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav__item svg {
  transition: transform 0.18s var(--ease), color 0.18s var(--ease);
}
.bottom-nav__item:active {
  transform: scale(0.92);
}
.bottom-nav__item span {
  line-height: 1;
}

/* Active indicator dot */
.bottom-nav__item.is-active::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  animation: navDotIn 0.25s var(--ease);
}
@keyframes navDotIn {
  from { transform: translateX(-50%) scale(0); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Role-specific active colours */
.bottom-nav--teacher .bottom-nav__item.is-active { color: var(--sky-dark); }
.bottom-nav--teacher .bottom-nav__item.is-active svg { color: var(--sky); }
.bottom-nav--teacher .bottom-nav__item.is-active::before { background: var(--sky); }
.bottom-nav--teacher .bottom-nav__item:hover:not(.is-active) { color: var(--sky); background: var(--sky-wash); }

.bottom-nav--student .bottom-nav__item.is-active { color: var(--marigold-dark); }
.bottom-nav--student .bottom-nav__item.is-active svg { color: var(--marigold); }
.bottom-nav--student .bottom-nav__item.is-active::before { background: var(--marigold); }
.bottom-nav--student .bottom-nav__item:hover:not(.is-active) { color: var(--marigold); background: var(--marigold-wash); }

.bottom-nav--parent .bottom-nav__item.is-active { color: var(--coral-dark); }
.bottom-nav--parent .bottom-nav__item.is-active svg { color: var(--coral); }
.bottom-nav--parent .bottom-nav__item.is-active::before { background: var(--coral); }
.bottom-nav--parent .bottom-nav__item:hover:not(.is-active) { color: var(--coral); background: var(--coral-wash); }

/* Hover for non-active items */
.bottom-nav__item:hover:not(.is-active) {
  color: var(--ink-soft);
  background: var(--canvas);
}

/* ---- Desktop: nav inside appbar ---------------------------------------- */
@media (min-width: 769px) {
  .bottom-nav {
    position: static;
    border-top: none;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    gap: 2px;
    margin-left: 16px;
  }
  .bottom-nav__item {
    flex-direction: row;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
  }
  .bottom-nav__item svg { width: 16px; height: 16px; }
  .bottom-nav__item.is-active::before { display: none; }
  .bottom-nav__item.is-active {
    font-weight: 700;
  }
  .bottom-nav--teacher .bottom-nav__item.is-active { background: var(--sky-wash); }
  .bottom-nav--student .bottom-nav__item.is-active { background: var(--marigold-wash); }
  .bottom-nav--parent .bottom-nav__item.is-active { background: var(--coral-wash); }
}

/* ---- Mobile: push content above bottom nav ----------------------------- */
@media (max-width: 768px) {
  .page { padding-bottom: 72px; }
  .appbar__actions .btn--compact { display: none; }
}

/* ---- Responsive appbar ------------------------------------------------- */
@media (max-width: 640px) {
  .appbar__inner { padding: 12px 16px; }
  .brand__title { font-size: 0.95rem; }
  .container { padding: 0 16px; }
  .page-head h2 { font-size: 1.2rem; }
  .person__detail { display: none; }
  .appbar__actions { gap: 6px; }
}
@media (max-width: 480px) {
  .person strong { display: none; }
  .bottom-nav__item { padding: 8px 14px 6px; font-size: 0.62rem; }
  .bottom-nav__item svg { width: 20px; height: 20px; }
}

/* =========================================================================
   Manage Homework — filters, table, modal
   ========================================================================= */

/* ---- Filter bar --------------------------------------------------------- */
.manage-filters { padding-top: 22px; }
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: end;
}
.filter-row .field { margin-bottom: 0; }
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-actions .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .filter-row { grid-template-columns: 1fr; }
}

/* ---- Result count ------------------------------------------------------- */
.result-count {
  margin: 16px 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-faint);
}

/* ---- Homework table ----------------------------------------------------- */
.hw-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}
.hw-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  white-space: nowrap;
}
.hw-table thead { background: var(--canvas); }
.hw-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--paper-line);
}
.hw-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--paper-line);
  vertical-align: middle;
  color: var(--ink);
}
.hw-table tbody tr { transition: background 0.1s; }
.hw-table tbody tr:hover { background: var(--canvas); }
.hw-table tbody tr:last-child td { border-bottom: none; }
.th-actions { text-align: center; }
.desc-cell {
  max-width: 220px;
  white-space: normal;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.4;
}
.mono { font-family: var(--font-mono); font-weight: 500; font-size: 0.82rem; }
.action-cell {
  text-align: center;
  white-space: nowrap;
}

/* ---- Icon buttons (edit / delete) --------------------------------------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.12s var(--ease);
  vertical-align: middle;
}
.btn-icon + .btn-icon { margin-left: 4px; }
.btn-icon:hover { background: var(--canvas); }
.btn-icon--edit:hover { color: var(--sky); border-color: var(--sky); }
.btn-icon--delete:hover { color: var(--coral); border-color: var(--coral); }

/* ---- Modal -------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(31, 42, 60, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s var(--ease);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 1.15rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 24px 24px; }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.static-field {
  padding: 12px 14px;
  background: var(--canvas);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.current-docs { margin-top: 12px; margin-bottom: 8px; }
.doc-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.doc-thumbs a {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--paper-line);
  display: block;
}
.doc-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.file-input {
  display: block;
  padding: 10px 0;
  font-size: 0.88rem;
}

/* ---- Mobile table: card layout ------------------------------------------ */
@media (max-width: 640px) {
  .hw-table table,
  .hw-table thead,
  .hw-table tbody,
  .hw-table tr,
  .hw-table th,
  .hw-table td { display: block; }
  .hw-table thead { display: none; }
  .hw-table tbody tr {
    background: var(--paper);
    border: 1px solid var(--paper-line);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
  }
  .hw-table td {
    border: none;
    padding: 4px 0;
    white-space: normal;
    text-align: left;
  }
  .hw-table td[data-label]::before {
    content: attr(data-label) ': ';
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    margin-right: 6px;
  }
  .action-cell { text-align: left; padding-top: 8px; }
  .modal-card { max-height: 85vh; }
}

/* =========================================================================
   FAB — Floating Action Button (mobile only)
   ========================================================================= */
.fab {
  display: none;
  position: fixed;
  bottom: 84px;
  right: 20px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--sky);
  color: #fff;
  box-shadow: 0 6px 20px -4px rgba(62,107,224,0.55), 0 2px 8px rgba(62,107,224,0.3);
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.fab:active {
  transform: scale(0.9);
}
.fab__label {
  display: none;
}
@media (max-width: 768px) {
  .fab {
    display: flex;
  }
}
@media (min-width: 769px) {
  .fab {
    display: none !important;
  }
}

/* =========================================================================
   Stats Row — summary cards
   ========================================================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}
.stat-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}
.stat-card--total .stat-card__icon { background: var(--sky-wash); color: var(--sky); }
.stat-card--week .stat-card__icon { background: var(--leaf-wash); color: var(--leaf); }
.stat-card--today .stat-card__icon { background: var(--marigold-wash); color: var(--marigold); }
.stat-card__body { display: flex; flex-direction: column; min-width: 0; }
.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}
.stat-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  margin-top: 2px;
}
@media (max-width: 560px) {
  .stats-row { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-card__icon { width: 36px; height: 36px; }
  .stat-card__value { font-size: 1.15rem; }
}

/* =========================================================================
   Filter Panel — collapsible
   ========================================================================= */
.filter-panel {
  margin-bottom: 20px;
}
.filter-panel__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  transition: background 0.15s var(--ease);
  box-shadow: var(--shadow-card);
}
.filter-panel__toggle::-webkit-details-marker { display: none; }
.filter-panel__toggle::marker { display: none; content: ''; }
.filter-panel__toggle:hover { background: var(--canvas); }
.filter-panel__toggle svg:first-child { color: var(--leaf); }
.filter-panel__chevron {
  margin-left: auto;
  transition: transform 0.2s var(--ease);
}
.filter-panel[open] .filter-panel__chevron {
  transform: rotate(180deg);
}
.filter-panel__body {
  margin-top: 8px;
  animation: slideDown 0.2s var(--ease);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.filter-panel[open] .filter-panel__toggle {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom-color: transparent;
}
.filter-panel .manage-filters {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border-top: none;
  box-shadow: none;
  margin-bottom: 0;
}
.filter-actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.filter-actions-row .btn { white-space: nowrap; }

/* =========================================================================
   Date Groups — homework grouped by date
   ========================================================================= */
.date-groups {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.date-group__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 6px;
  border-bottom: 2px solid var(--paper-line);
  margin-bottom: 14px;
}
.date-group__heading svg {
  color: var(--ink-faint);
  flex-shrink: 0;
}
.date-group__date {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.date-group__label {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-weight: 500;
}
.date-group__count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-faint);
  background: var(--canvas);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.date-group__cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 560px) {
  .date-group__heading { flex-wrap: wrap; }
  .date-group__count { margin-left: 0; }
}

/* =========================================================================
   Lightbox — image zoom, navigate, download
   ========================================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 15, 25, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s var(--ease);
}
.lightbox__toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  z-index: 210;
  background: linear-gradient(to bottom, rgba(10,15,25,0.7) 0%, transparent 100%);
}
.lightbox__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
  text-decoration: none;
}
.lightbox__btn:hover {
  background: rgba(255,255,255,0.25);
}
.lightbox__btn:active {
  transform: scale(0.92);
}
.lightbox__close {
  position: absolute;
  right: 16px;
  top: 12px;
}
.lightbox__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.lightbox__img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.2s var(--ease);
  transform-origin: center center;
}
.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.4);
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
@media (max-width: 560px) {
  .lightbox__toolbar { gap: 4px; padding: 10px 12px; }
  .lightbox__btn { width: 36px; height: 36px; border-radius: 8px; }
  .lightbox__btn svg { width: 18px; height: 18px; }
  .lightbox__img { max-width: 98vw; max-height: 78vh; }
}

/* =========================================================================
   Sidebar — group label
   ========================================================================= */
.sidebar__group {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 16px 14px 4px;
}

/* =========================================================================
   Attendance — status toggle buttons
   ========================================================================= */
.att-student-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}
.att-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease);
}
.att-student-row:hover {
  border-color: var(--sky);
}
.att-student-row__info { min-width: 0; }
.att-student-row__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-student-row__roll {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--ink-faint);
  margin-top: 1px;
}

/* Status toggle */
.status-toggle {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.status-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--paper-line);
  background: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  color: var(--ink-faint);
}
.status-toggle__btn:hover { border-color: var(--ink-faint); }
.status-toggle__btn:active { transform: scale(0.92); }

/* Present (green) */
.status-toggle__btn--present.is-active {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
  box-shadow: 0 2px 8px rgba(46, 158, 109, 0.3);
}
/* Late (yellow) */
.status-toggle__btn--late.is-active {
  background: var(--marigold);
  border-color: var(--marigold);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
}
/* Absent (red) */
.status-toggle__btn--absent.is-active {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  box-shadow: 0 2px 8px rgba(224, 87, 91, 0.3);
}
/* Half Day (orange) */
.status-toggle__btn--halfday.is-active {
  background: #E67E22;
  border-color: #E67E22;
  color: #fff;
  box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
}

/* Toolbar */
.att-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.att-toolbar__stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.att-stat {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.att-stat strong {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
}
.att-stat--present strong { color: var(--leaf); }
.att-stat--absent strong { color: var(--coral); }
.att-toolbar__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Save row */
.att-save-row {
  margin-top: 8px;
}

/* Attendance badge for manage page */
.att-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.att-badge--present { background: var(--leaf-wash); color: var(--leaf-dark); }
.att-badge--absent { background: var(--coral-wash); color: var(--coral-dark); }
.att-badge--late { background: var(--marigold-wash); color: var(--marigold-dark); }
.att-badge--halfday { background: #FEF3DF; color: #D35400; }
.att-badge--none { background: var(--canvas); color: var(--ink-faint); }

/* Attendance stats row for manage page */
.att-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 560px) {
  .att-toolbar { flex-direction: column; align-items: stretch; }
  .att-toolbar__stats { justify-content: space-between; }
  .att-toolbar__actions { justify-content: stretch; }
  .att-toolbar__actions .btn { flex: 1; }
  .att-student-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .status-toggle { justify-content: flex-end; }
  .att-stats-row { grid-template-columns: 1fr; }
}

/* =========================================================================
   Student attendance summary + today notification
   ========================================================================= */
.att-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.att-summary__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.att-summary__item svg { flex-shrink: 0; }
.att-summary__item--present { border-left: 3px solid var(--leaf); }
.att-summary__item--present svg { color: var(--leaf); }
.att-summary__item--absent { border-left: 3px solid var(--coral); }
.att-summary__item--absent svg { color: var(--coral); }
.att-summary__item--late { border-left: 3px solid var(--marigold); }
.att-summary__item--late svg { color: var(--marigold); }
.att-summary__item--halfday { border-left: 3px solid #E67E22; }
.att-summary__item--halfday svg { color: #E67E22; }
.att-summary__value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.att-summary__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* Today attendance alert */
.att-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideDown 0.2s var(--ease);
}
.att-alert svg { flex-shrink: 0; }
.att-alert--present { background: var(--leaf-wash); color: var(--leaf-dark); border: 1px solid rgba(46,158,109,0.2); }
.att-alert--absent { background: var(--coral-wash); color: var(--coral-dark); border: 1px solid rgba(224,87,91,0.2); }
.att-alert--late { background: var(--marigold-wash); color: var(--marigold-dark); border: 1px solid rgba(245,166,35,0.2); }
.att-alert--halfday { background: #FEF3DF; color: #D35400; border: 1px solid rgba(230,126,34,0.2); }
.att-alert--pending { background: var(--sky-wash); color: var(--sky-dark); border: 1px solid rgba(62,107,224,0.2); }

@media (max-width: 560px) {
  .att-summary { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================================
   Install banner — PWA / Add to Home Screen prompt
   ========================================================================= */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--paper);
  border-top: 1px solid var(--paper-line);
  box-shadow: 0 -4px 20px rgba(31, 42, 60, 0.12);
  padding: 14px 16px 16px;
  text-align: center;
  animation: slideUp 0.3s var(--ease);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.install-banner__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin-bottom: 10px;
}
.install-banner__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}
.install-banner__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.3;
}
.install-banner__text strong {
  font-size: 0.85rem;
  color: var(--ink);
}
.install-banner__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.install-banner__close:hover { background: var(--canvas); }
.install-banner__btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--sky);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.install-banner__btn:hover { background: var(--sky-dark); }
.install-banner__hint {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.4;
}
.install-banner__share-icon {
  display: inline-block;
  font-size: 1.1rem;
}
