/* =========================================================================
   Fromehall Mill Studios — design tokens
   A converted mill, now a music studio: stone, timber, brass instrument
   keys, and ruled manuscript paper. The login screen borrows from all four.
   ========================================================================= */

:root {
  /* Color */
  --color-stone: #f5f3ec;       /* page background — warm cream */
  --color-ink: #16271e;         /* deep forest green-black — primary text, dark panel */
  --color-ink-soft: #46584c;    /* secondary text on light surfaces */
  --color-brass: #9fe0b6;       /* bright mint accent — pops on dark green panels */
  --color-green: #2f5d43;       /* primary brand green — buttons, CTAs */
  --color-green-deep: #20402f;  /* pressed/hover green */
  --color-green-light: #4f8567; /* lighter green — active sidebar item, pops on the green sidebar bg */
  --color-moss: #2f5d43;        /* links, focus — brand green */
  --color-manuscript: #ffffff;  /* form card surface — white */
  --color-mint-tint: #eaf3e6;   /* soft icon-badge fill on light surfaces */
  --color-rust: #9c4332;        /* errors */
  --color-line: rgba(22, 39, 30, 0.18);

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Work Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
  --font-login-display: "Oswald", "Segoe UI", system-ui, sans-serif;
  --font-login-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  --radius: 3px;
  --radius-lg: 8px;
}

* {
  box-sizing: border-box;
}

/* The hidden attribute and a class-level `display` rule share the same
   specificity, so any class that sets `display` (`.modal-overlay`,
   `.remember-check`, `.notif-badge`, ...) can silently win and render an
   element that should be hidden. Force it, per MDN's own recommendation
   for this exact conflict. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-stone);
  -webkit-font-smoothing: antialiased;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-brass);
  margin: 0 0 1.5rem;
}

/* ---------------------------------------------------------------------
   Teacher login — hero photo behind a centered card
   --------------------------------------------------------------------- */

.login-page {
  font-family: var(--font-login-body);
}

.login-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: linear-gradient(rgba(16, 30, 21, 0.82), rgba(16, 30, 21, 0.88)), url("/admin-static/images/hero-mill.jpg");
  background-size: cover;
  background-position: center;
}

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 4vw, 2rem);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--color-stone);
}

.login-brand img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
}

.login-brand span {
  font-family: var(--font-login-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ghost-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-stone);
  font-family: var(--font-login-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.55rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem 3.5rem;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--color-manuscript);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 4vw, 2.6rem) clamp(1.75rem, 4vw, 2.5rem);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  animation: rise 0.5s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--color-mint-tint);
  color: var(--color-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.card h1 {
  font-family: var(--font-login-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 1.5rem;
  text-align: center;
  margin: 0 0 0.35rem;
}

.card .lede {
  margin: 0 0 1.75rem;
  color: var(--color-ink-soft);
  font-size: 0.88rem;
  text-align: center;
}

.field {
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-family: var(--font-login-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-ink-soft);
  margin-bottom: 0.4rem;
}

.field input {
  width: 100%;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: #fff;
  font-family: var(--font-login-body);
  font-size: 0.95rem;
  color: var(--color-ink);
  padding: 0.8rem 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--color-moss);
  box-shadow: 0 0 0 3px rgba(47, 93, 67, 0.14);
}

.field select {
  width: 100%;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2346584c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: var(--font-login-body);
  font-size: 0.95rem;
  color: var(--color-ink);
  padding: 0.8rem 2.5rem 0.8rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select:focus {
  outline: none;
  border-color: var(--color-moss);
  box-shadow: 0 0 0 3px rgba(47, 93, 67, 0.14);
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.84rem;
}

.field-row a {
  color: var(--color-moss);
  font-weight: 600;
}

.text-link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--color-moss);
  font-family: var(--font-login-body);
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
}

.text-link-btn:hover {
  text-decoration: underline;
}

.back-to-login-row {
  text-align: center;
  margin: 1rem 0 0;
  font-size: 0.84rem;
}

.remember-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-ink-soft);
  cursor: pointer;
}

.remember-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--color-green);
}

.error-message {
  display: none;
  font-size: 0.85rem;
  color: var(--color-rust);
  background: rgba(156, 67, 50, 0.08);
  border: 1px solid rgba(156, 67, 50, 0.3);
  border-radius: var(--radius-lg);
  padding: 0.7rem 0.9rem;
  margin: 0 0 1.1rem;
}

.error-message.visible {
  display: block;
}

.error-message.success {
  color: var(--color-green);
  background: var(--color-mint-tint);
  border-color: var(--color-green);
}

.submit {
  width: 100%;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--color-green);
  color: var(--color-stone);
  font-family: var(--font-login-body);
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.submit:hover {
  background: var(--color-green-deep);
}

.submit:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

.submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* .submit is normally a <button> — this variant lets an <a> wear the
   same look (e.g. "Continue to sign in" after a successful reset). */
.submit-link {
  display: block;
  text-align: center;
  text-decoration: none;
}

.card-foot {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-line);
  font-size: 0.8rem;
  color: var(--color-ink-soft);
  text-align: center;
}

.card-foot a {
  color: var(--color-moss);
  font-weight: 600;
}

.login-footnote {
  text-align: center;
  padding: 1.1rem 2rem;
  font-size: 0.78rem;
  color: rgba(245, 243, 236, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }
  .submit {
    transition: none;
  }
}


/* =========================================================================
   Dashboard — sidebar app shell
   ========================================================================= */

.app-shell {
  display: flex;
  height: 100vh;
  background: var(--color-manuscript);
  overflow: hidden;
}

.sidebar {
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 72px;
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--color-green) 0%, var(--color-green-deep) 100%);
  color: var(--color-stone);
  transition: width 0.2s ease;
  z-index: 20;
}

.app-shell.collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem;
  border-bottom: 1px solid rgba(245, 243, 236, 0.1);
  overflow: hidden;
}

.app-shell.collapsed .sidebar-brand {
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem 0.6rem;
}

.sidebar-brand-name {
  flex: 1;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  white-space: nowrap;
}

.app-shell.collapsed .sidebar-brand-name {
  display: none;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(245, 243, 236, 0.75);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: rgba(245, 243, 236, 0.08);
  color: var(--color-stone);
}

.sidebar-link.active {
  background: rgba(245, 243, 236, 0.1);
  color: var(--color-stone);
  border-left: 3px solid var(--color-green-light);
  padding-left: calc(0.75rem - 3px);
}

.app-shell.collapsed .sidebar-link span {
  display: none;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid rgba(245, 243, 236, 0.2);
  color: rgba(245, 243, 236, 0.75);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.sidebar-toggle:hover {
  border-color: var(--color-brass);
  color: var(--color-brass);
}

.sidebar-toggle svg {
  transition: transform 0.2s ease;
}

.app-shell.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-overlay {
  display: none;
}

.main-area {
  position: relative;
  z-index: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-manuscript);
  overflow-x: hidden;
  overflow-y: auto;
}

/* Watermark is dashboard-only — .has-watermark is added to .main-area
   just there, not on every shell page. */
.main-area.has-watermark::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/admin-static/images/hero-mill.jpg");
  background-size: cover;
  background-position: center 35%;
  opacity: 0.16;
  mask-image: radial-gradient(ellipse 75% 75% at 65% 55%, black 0%, transparent 88%);
  -webkit-mask-image: radial-gradient(ellipse 75% 75% at 65% 55%, black 0%, transparent 88%);
  z-index: -1;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--color-manuscript);
  border-bottom: 1px solid var(--color-line);
  padding: 0.85rem clamp(1.25rem, 4vw, 2rem);
}

.hamburger {
  display: none;
  align-items: center;
  margin-right: auto;
  background: none;
  border: none;
  color: var(--color-ink);
  padding: 0.25rem;
  cursor: pointer;
}

.topbar-date {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-ink-soft);
}

/* Always-present wrapper for everything right-aligned in the topbar, so
   the right-alignment survives regardless of which children inside it
   happen to be hidden (search on pages that don't support it, the bell
   for a role without enquiries.view) — margin-left:auto lives here, not
   on any one conditionally-visible child. */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 220px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: #fff;
  color: var(--color-ink-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.topbar-search:focus-within {
  border-color: var(--color-moss);
  box-shadow: 0 0 0 3px rgba(47, 93, 67, 0.14);
}

.topbar-search-icon {
  flex-shrink: 0;
}

.topbar-search-input {
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-ink);
}

.topbar-search-input:focus {
  outline: none;
}

.notif-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--color-line);
  border-radius: 50%;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.notif-bell:hover {
  border-color: var(--color-moss);
  color: var(--color-moss);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 999px;
  background: var(--color-rust);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Sidebar profile — bottom-left user block with a flyout menu
   --------------------------------------------------------------------- */

.sidebar-profile {
  position: relative;
  padding: 0.75rem;
  border-top: 1px solid rgba(245, 243, 236, 0.1);
}

.sidebar-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: var(--radius);
  color: var(--color-stone);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.sidebar-profile-btn:hover,
.sidebar-profile-btn[aria-expanded="true"] {
  background: rgba(245, 243, 236, 0.08);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-mint-tint);
  color: var(--color-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.user-name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-stone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(245, 243, 236, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-profile-more {
  flex-shrink: 0;
  opacity: 0.6;
}

.app-shell.collapsed .user-info,
.app-shell.collapsed .sidebar-profile-more {
  display: none;
}

.sidebar-profile-menu {
  display: none;
  position: absolute;
  left: 0.75rem;
  bottom: calc(100% + 0.5rem);
  width: 200px;
  background: var(--color-manuscript);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(22, 39, 30, 0.18);
  padding: 0.4rem;
  z-index: 30;
}

.sidebar-profile-menu.open {
  display: block;
}

.sidebar-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.sidebar-profile-menu-item:hover {
  background: var(--color-mint-tint);
}

.sidebar-profile-menu-item.danger {
  color: var(--color-rust);
}

.sidebar-profile-menu-item.danger:hover {
  background: rgba(156, 67, 50, 0.08);
}

.dash-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) 1.5rem;
}

.dash-card {
  background: linear-gradient(135deg, var(--color-manuscript) 0%, var(--color-mint-tint) 160%);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  box-shadow: 0 1px 2px rgba(22, 39, 30, 0.06), 0 8px 24px rgba(22, 39, 30, 0.05);
}

.dash-card .eyebrow {
  color: var(--color-moss);
  margin-bottom: 1rem;
}

.dash-card h1 {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.greet-name {
  color: var(--color-green);
}

.dash-card p {
  color: var(--color-ink-soft);
  line-height: 1.6;
  margin: 0 0 0.5rem;
}

/* ---------------------------------------------------------------------
   Dashboard quick links — shortcuts to the sections also in the sidebar.
   Deliberately redundant with the nav for now; worth it once the sidebar
   has enough items that "everything" isn't a couple of clicks away.
   --------------------------------------------------------------------- */

.dashboard-main {
  max-width: none;
}

.welcome-card {
  padding: 1.1rem 1.5rem;
  margin-bottom: 0.25rem;
}

.welcome-card .eyebrow {
  margin-bottom: 0.3rem;
}

.welcome-card h1 {
  font-size: 1.3rem;
  margin: 0 0 0.3rem;
}

.welcome-card p:not(.eyebrow) {
  margin: 0;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 300px));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--color-manuscript);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--color-ink);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-link-card:hover {
  border-color: var(--color-moss);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(22, 39, 30, 0.08);
}

.quick-link-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-mint-tint);
  color: var(--color-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-link-icon svg {
  width: 26px;
  height: 26px;
}

.quick-link-text h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-ink);
}

.quick-link-text p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  line-height: 1.45;
}

/* ---------------------------------------------------------------------
   Attendance calendar — FullCalendar re-themed to match the app instead
   of its default blue.
   --------------------------------------------------------------------- */

.calendar-wrap {
  background: var(--color-manuscript);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-top: 1rem;
}

.fc {
  font-family: var(--font-body);
}

.fc .fc-toolbar-title {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
}

.fc .fc-button-primary {
  background-color: var(--color-green);
  border-color: var(--color-green);
  text-transform: capitalize;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:not(:disabled):active {
  background-color: var(--color-green-deep);
  border-color: var(--color-green-deep);
}

.fc .fc-button-primary:disabled {
  background-color: var(--color-green);
  border-color: var(--color-green);
  opacity: 0.5;
}

.fc .fc-day-today {
  background-color: var(--color-mint-tint) !important;
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
  color: var(--color-ink);
  text-decoration: none;
}

.fc .fc-daygrid-day {
  cursor: pointer;
}

.fc-event {
  cursor: pointer;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0 4px;
}

/* ---------------------------------------------------------------------
   Attendance register — AM/PM student lists. Built as rows from the
   start (not a table retrofitted for mobile later) since it's exactly
   the same list-of-records shape as the admin-table--cards pattern.
   --------------------------------------------------------------------- */

.attendance-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.attendance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--color-manuscript);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
}

.attendance-row-name {
  font-weight: 600;
  color: var(--color-ink);
}

.attendance-status-select {
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2346584c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-ink);
  padding: 0.45rem 2rem 0.45rem 0.7rem;
  cursor: pointer;
  min-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.attendance-status-select:focus {
  outline: none;
  border-color: var(--color-moss);
  box-shadow: 0 0 0 3px rgba(47, 93, 67, 0.14);
}

.attendance-status-select.status-present {
  border-color: var(--color-green);
  color: var(--color-green);
}

.attendance-status-select.status-absent {
  border-color: var(--color-rust);
  color: var(--color-rust);
}

.attendance-row-note {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--color-ink-soft);
  font-style: italic;
}

/* Day-of-week schedule picker on the student profile */
.day-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.day-toggle {
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-ink-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.day-toggle:hover {
  border-color: var(--color-moss);
}

.day-toggle.active {
  background: var(--color-green);
  border-color: var(--color-green);
  color: #fff;
}

.day-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

@media (min-width: 480px) {
  .attendance-status-select {
    min-width: 180px;
  }
}

/* ---------------------------------------------------------------------
   Attendance register grid — students x dates, the classic paper-register
   shape. A genuine grid like the permissions matrix, not a list of
   records, so it keeps a normal horizontal-scroll table on mobile
   instead of the admin-table--cards treatment (same reasoning already
   applied to the permissions matrix on /admin).
   --------------------------------------------------------------------- */

.week-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.week-nav-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-ink);
}

.attendance-grid-table th,
.attendance-grid-table td {
  text-align: center;
  white-space: nowrap;
}

.attendance-grid-table th:first-child,
.attendance-grid-table td:first-child {
  text-align: left;
}

.attendance-grid-table th.grid-today {
  background: var(--color-mint-tint);
  color: var(--color-green);
}

.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.grid-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--color-line);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-ink-soft);
  transition: transform 0.1s ease;
}

.grid-chip:hover {
  transform: scale(1.12);
}

.grid-chip.chip-empty {
  color: var(--color-line);
  border-style: dashed;
}

.grid-chip.chip-present {
  background: var(--color-mint-tint);
  border-color: var(--color-green);
  color: var(--color-green);
}

.grid-chip.chip-absent {
  background: rgba(156, 67, 50, 0.1);
  border-color: var(--color-rust);
  color: var(--color-rust);
}

.grid-chip.chip-neutral {
  border-color: var(--color-ink-soft);
  color: var(--color-ink-soft);
}

/* A single faint marker for a day the student isn't scheduled to
   attend at all — visually distinct from the dashed "not marked yet"
   chip pair, so it doesn't read as a gap in the register. */
.grid-cell-unscheduled {
  display: block;
  text-align: center;
  color: var(--color-line);
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------------
   Enquiries page
   --------------------------------------------------------------------- */

.page-header {
  margin-bottom: 1.5rem;
}

.page-header .eyebrow {
  color: var(--color-moss);
  margin-bottom: 0.35rem;
}

.page-header h1 {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-ink);
  margin: 0;
}

.enquiries-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.enquiry-row {
  background: var(--color-manuscript);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.enquiry-row.unread {
  background: var(--color-mint-tint);
  border-color: var(--color-green);
}

.enquiry-row-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
}

.enquiry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-green);
  flex-shrink: 0;
  opacity: 0;
}

.enquiry-row.unread .enquiry-dot {
  opacity: 1;
}

.enquiry-name {
  font-weight: 600;
  color: var(--color-ink);
  flex-shrink: 0;
}

.enquiry-type {
  flex: 1;
  min-width: 100px;
  color: var(--color-ink-soft);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enquiry-date {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-ink-soft);
}

.enquiry-detail {
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid var(--color-line);
}

.enquiry-detail p {
  margin: 1rem 0;
  color: var(--color-ink);
  line-height: 1.6;
  white-space: pre-wrap;
}

.enquiry-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}

.enquiry-detail-meta a {
  color: var(--color-moss);
  font-weight: 600;
}

.enquiry-detail-meta span {
  color: var(--color-ink-soft);
}

/* ---------------------------------------------------------------------
   Admin page — logins table + permissions matrix
   --------------------------------------------------------------------- */

.admin-main {
  max-width: 960px;
}

.admin-section {
  margin-bottom: 2.5rem;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.admin-section-head h2 {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
  margin: 0;
}

.admin-section-hint {
  color: var(--color-ink-soft);
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
}

.btn-primary {
  background: var(--color-green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-primary:hover {
  background: var(--color-green-deep);
}

.btn-secondary {
  background: none;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--color-moss);
  color: var(--color-moss);
}

.table-wrap {
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-manuscript);
  font-family: var(--font-body);
  font-size: 0.88rem;
  white-space: nowrap;
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--color-line);
}

.admin-table thead th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-soft);
  background: var(--color-mint-tint);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-active {
  background: var(--color-mint-tint);
  color: var(--color-green);
}

.badge-inactive {
  background: rgba(156, 67, 50, 0.1);
  color: var(--color-rust);
}

.row-actions {
  display: flex;
  gap: 0.4rem;
}

.row-btn {
  background: none;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.row-btn:hover {
  border-color: var(--color-moss);
  color: var(--color-moss);
}

.permissions-matrix th:not(:first-child),
.permissions-matrix td.perm-cell {
  text-align: center;
}

.permissions-matrix input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--color-green);
  cursor: pointer;
}

.permissions-matrix input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.permission-code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-ink);
}

.permission-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  font-weight: 400;
  white-space: normal;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 39, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}

.modal {
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-ink);
  text-align: left;
  text-transform: none;
  margin: 0 0 1.25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.modal-actions .submit {
  width: auto;
}

.save-status {
  align-self: center;
  color: var(--color-green);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   Students — register table, profile page, avatar/photo, contact cards
   --------------------------------------------------------------------- */

.table-link {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}

.table-link:hover {
  color: var(--color-moss);
  text-decoration: underline;
}

.back-link {
  display: inline-block;
  color: var(--color-ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.25rem;
}

.back-link:hover {
  color: var(--color-moss);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-mint-tint);
  color: var(--color-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-lg {
  width: 96px;
  height: 96px;
  font-size: 1.6rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.avatar-upload-actions {
  display: flex;
  gap: 0.4rem;
}

.avatar-upload .error-message {
  margin: 0;
  max-width: 200px;
  text-align: center;
}

.profile-header-info h1 {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-ink);
  margin: 0 0 0.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 1.25rem;
  margin-bottom: 0.5rem;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.contact-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--color-manuscript);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.contact-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.contact-card-name-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.contact-card-name {
  font-weight: 600;
  color: var(--color-ink);
}

.contact-card-relationship {
  font-size: 0.82rem;
  color: var(--color-ink-soft);
}

.contact-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.contact-card-details span {
  color: var(--color-ink-soft);
}

.contact-card-details a {
  color: var(--color-moss);
  font-weight: 600;
}

/* Mobile: the sidebar becomes an off-canvas overlay instead of collapsing */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .app-shell.collapsed .sidebar {
    width: var(--sidebar-width);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(22, 39, 30, 0.5);
    z-index: 15;
  }

  .hamburger {
    display: flex;
  }

  .sidebar-toggle {
    display: none;
  }

  /* Search drops to its own full-width row below the bell/date, rather
     than competing with them for space in an already-tight mobile topbar. */
  .topbar {
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }

  .topbar-right {
    flex-wrap: wrap;
    width: 100%;
  }

  .topbar-search {
    order: 1;
    flex-basis: 100%;
    width: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }

  /* Barely visible behind full-width cards/forms on a narrow screen —
     not worth the extra paint on mobile. */
  .main-area.has-watermark::before {
    display: none;
  }

  /* Record-list tables (logins, students) become stacked cards on mobile —
     opt-in via .admin-table--cards, so the permissions matrix (a genuine
     grid, not a list of records) keeps its normal horizontal-scroll table
     instead of being forced into a card shape that wouldn't make sense
     for it. */
  .table-wrap--cards {
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .admin-table--cards thead {
    display: none;
  }

  .admin-table--cards,
  .admin-table--cards tbody,
  .admin-table--cards tr,
  .admin-table--cards td {
    display: block;
    width: 100%;
  }

  .admin-table--cards tbody tr {
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--color-manuscript);
  }

  .admin-table--cards tbody tr:last-child {
    margin-bottom: 0;
  }

  .admin-table--cards td {
    border-bottom: none;
    padding: 0.35rem 0;
    white-space: normal;
  }

  .admin-table--cards td:not(.cell-primary):not(.cell-avatar):not(.cell-actions) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .admin-table--cards td:not(.cell-primary):not(.cell-avatar):not(.cell-actions)::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-ink-soft);
  }

  .admin-table--cards .cell-avatar {
    display: flex;
    justify-content: center;
    padding-bottom: 0.5rem;
  }

  .admin-table--cards .cell-primary {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    padding-bottom: 0.75rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--color-line);
  }

  .admin-table--cards .cell-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--color-line);
  }

  .admin-table--cards .cell-actions:empty {
    display: none;
    border-top: none;
    padding: 0;
    margin: 0;
  }

  .admin-table--cards .cell-actions .row-actions {
    display: flex;
    gap: 0.5rem;
    flex: 1;
  }

  .admin-table--cards .cell-actions .row-btn {
    flex: 1;
    text-align: center;
  }
}