/* ── Theme: green palette + sharp corners ── */
:root {
  /* Green */
  --bs-primary: #2d6a4f;
  --bs-primary-rgb: 45, 106, 79;
  --bs-primary-bg-subtle: #d8f3dc;
  --bs-primary-border-subtle: #95d5b2;
  --bs-primary-text-emphasis: #1b4332;
  --bs-link-color: #2d6a4f;
  --bs-link-hover-color: #1b4332;
  --bs-link-color-rgb: 45, 106, 79;
  /* Sharp corners */
  --bs-border-radius: 0;
  --bs-border-radius-sm: 0;
  --bs-border-radius-lg: 0;
  --bs-border-radius-xl: 0;
  --bs-border-radius-2xl: 0;
  --bs-border-radius-xxl: 0;
}
[data-bs-theme="dark"] {
  --bs-primary: #40916c;
  --bs-primary-rgb: 64, 145, 108;
  --bs-primary-bg-subtle: #1b4332;
  --bs-primary-border-subtle: #2d6a4f;
  --bs-primary-text-emphasis: #74c69d;
  --bs-link-color: #74c69d;
  --bs-link-hover-color: #95d5b2;
  --bs-link-color-rgb: 116, 198, 157;
}

body {
  min-height: 100vh;
}

a {
  text-decoration: none;
}

.app-shell-bg {
  min-height: 100vh;
}

.public-shell {
  min-height: 100vh;
}

/* ── Top navigation — two rows ── */
.shell-topnav {
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Row 1: brand + user info */
.topnav-top {
  background: #1b4332;
  border-bottom: 1px solid rgba(0,0,0,0.25);
}
.topnav-top > .container-xxl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.75rem;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}
.topnav-brand:hover { color: #d8f3dc; }

.topnav-mark {
  background: #2d6a4f;
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topnav-name {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}

.topnav-tenant {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
}

.topnav-icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.25rem 0.4rem;
  line-height: 1;
}
.topnav-icon-btn:hover { color: #fff; }

.topnav-locale-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
}
.topnav-locale-btn.active { color: #fff; border-bottom: 2px solid #74c69d; }
.topnav-locale-btn:hover  { color: #fff; }

.topnav-user {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.topnav-signout {
  background: none;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.65);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.1s, color 0.1s;
}
.topnav-signout:hover { border-color: rgba(255,255,255,0.5); color: #fff; }

/* Row 2: nav links */
.topnav-bottom {
  background: #2d6a4f;
  border-bottom: 2px solid #1b4332;
}
.topnav-bottom > .container-xxl {
  display: flex;
  align-items: stretch;
}

.topnav-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 0;
  cursor: pointer;
}

.topnav-links-wrap { display: contents; }
/* Bootstrap collapse hides it — force visible on desktop */
@media (min-width: 992px) {
  .topnav-links-wrap,
  .topnav-links-wrap.collapse,
  .topnav-links-wrap.collapsing { display: contents !important; }
}

.topnav-links {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav-links::-webkit-scrollbar { display: none; }

.topnav-link {
  display: block;
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.1s, border-color 0.1s;
}
.topnav-link:hover  { color: #fff; border-bottom-color: rgba(255,255,255,0.3); }
.topnav-link.active { color: #fff; border-bottom-color: #74c69d; }

.topnav-sep-item {
  display: flex;
  align-items: center;
  padding: 0 0.25rem;
}
.topnav-sep {
  width: 1px;
  height: 1rem;
  background: rgba(255,255,255,0.2);
  display: block;
}

/* Mobile */
@media (max-width: 991.98px) {
  .topnav-toggle-btn { display: block; }
  .topnav-top > .container-xxl { height: auto; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .topnav-user { display: none; }
  .topnav-links-wrap {
    display: block;
    width: 100%;
  }
  .topnav-links-wrap.collapse:not(.show) { display: none; }
  .topnav-links-wrap.show {
    display: block;
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 0.25rem 0 0.5rem;
  }
  .topnav-links {
    flex-direction: column;
    overflow: visible;
  }
  .topnav-link { border-bottom: none; border-left: 2px solid transparent; }
  .topnav-link.active { border-left-color: #74c69d; }
  .topnav-bottom > .container-xxl { flex-direction: column; align-items: flex-start; }
}

/* ── Shell page layout ── */
.shell-frame {
  min-height: 100vh;
}

.shell-main {
  padding: 1.5rem 0 2rem;
}

.public-main {
  min-width: 0;
}

.shell-sidebar-panel,
.child-card,
.child-details,
.child-credits,
.institution-credits,
.enrollment-card,
.entry-panel,
.section-card-muted {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.surface {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.shell-sidebar-panel {
  padding: 1.25rem;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(100vh - 3rem);
  padding: 1.25rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bs-border-color);
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
}

.sidebar-footer {
  border-top: 1px solid var(--bs-border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

.sidebar-footer-email {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bs-secondary-color);
  padding: 0.25rem 0.5rem;
  border-radius: 0;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: var(--bs-tertiary-bg);
}

.sidebar-toggle-icon {
  font-weight: bold;
  transition: transform 0.2s ease;
}

body.sidebar-collapsed .sidebar-toggle-icon {
  transform: scaleX(-1);
}

.shell-brand {
  /* Border and spacing moved to sidebar-header */
}

.shell-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
}

.shell-brand-mark {
  align-items: center;
  background: #1b4332;
  border-radius: 0;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  height: 2.75rem;
  justify-content: center;
  width: 2.75rem;
}

.shell-brand-title {
  color: var(--bs-emphasis-color);
  display: block;
  font-weight: 700;
}

.shell-brand-subtitle,
.section-intro,
.summary-copy,
.quick-link-copy,
.chooser-card-copy,
.entry-copy,
.entry-feature-copy,
.message-bubble-meta,
.detail-label,
.summary-label {
  color: var(--bs-secondary-color);
}

.summary-card,
.detail-item,
.entry-stat,
.entry-form-card,
.entry-aside-card,
.entry-feature-item,
.enrollment-summary-card,
.attendance-day,
.quick-link-card,
.empty-panel,
.section-card {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  padding: 1rem;
}

.shell-badge,
.entry-kicker,
.chooser-meta-pill,
.locked-badge,
.context-chip {
  align-items: center;
  background: var(--bs-primary-bg-subtle);
  border: 1px solid var(--bs-primary-border-subtle);
  border-radius: 0;
  color: var(--bs-primary-text-emphasis);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.75rem;
  text-transform: uppercase;
}

.context-chip-active {
  background: #2d6a4f;
  border-color: #2d6a4f;
  color: #fff;
}

.shell-nav-title {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.shell-nav-link {
  border-radius: 0;
  color: var(--bs-body-color);
  padding: 0.625rem 0.875rem;
}

.shell-nav-link.active {
  background: #2d6a4f;
  color: #fff;
}

.shell-topbar {
  align-items: center;
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1.25rem;
}

.topbar-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bs-body-color);
}

.shell-topbar-actions,
.form-actions,
.entry-form-actions,
.shell-flash-stack,
.entry-aside-stack,
.thread-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.shell-user-card {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  padding: 0.75rem 1rem;
}

.theme-toggle-button {
  background: transparent;
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  color: var(--bs-body-color);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0.35rem 0.65rem;
}

.theme-toggle-button:hover {
  background: var(--bs-secondary-bg);
}

.locale-switcher {
  display: inline-flex;
  gap: 0.375rem;
}

.locale-switcher-button {
  background: transparent;
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  color: var(--bs-body-color);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
}

.locale-switcher-button-active {
  background: var(--bs-dark);
  border-color: var(--bs-dark);
  color: #fff;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--bs-border-color);
  flex-wrap: wrap;
}

.workspace-stack {
  display: grid;
  gap: 1.5rem;
}
.workspace-stack > * {
  min-width: 0;
}

.workspace-grid {
  display: grid;
  gap: 1.5rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-grid,
.detail-list,
.child-section-grid,
.attendance-grid,
.chooser-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 480px);
  justify-content: center;
}

.entry-stat-grid {
  display: grid;
  gap: 1rem;
}

.summary-grid {
  display: grid;
  gap: 1rem;
}

.summary-value,
.entry-title {
  color: var(--bs-emphasis-color);
  font-weight: 700;
}

.summary-value {
  font-size: 2rem;
}

.detail-value,
.quick-link-title,
.chooser-card-title,
.entry-feature-label {
  color: var(--bs-emphasis-color);
  font-weight: 600;
}

.quick-link-card,
.chooser-card,
.inbox-row {
  color: inherit;
  display: block;
}

.chooser-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.25rem;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chooser-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.chooser-card-description {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.quick-link-card:hover,
.chooser-card:hover,
.inbox-row:hover,
.context-chip:hover {
  border-color: var(--bs-primary-border-subtle);
}

.stat-chip {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  color: inherit;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.stat-chip:hover {
  border-color: var(--bs-primary-border-subtle);
  color: inherit;
}

.stat-chip-value {
  color: var(--bs-emphasis-color);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1;
}

.stat-chip-label {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.attendance-toggles {
  display: grid;
  gap: 0.75rem;
}

.attendance-toggles label,
.calendar-toggle {
  align-items: center;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
}

.attendance-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.attendance-display span {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
}

.attendance-display span.active {
  background: var(--bs-success-bg-subtle);
  border-color: var(--bs-success-border-subtle);
  color: var(--bs-success-text-emphasis);
}

.parent-calendar-head,
.parent-calendar-body {
  display: grid;
}

.parent-calendar-head div {
  text-align: center;
  padding: 0.5rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.parent-calendar-day {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.25rem;
  aspect-ratio: 1 / 1;
}

.cal-circle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--bs-border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bs-emphasis-color);
  background: transparent;
  cursor: default;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
}

button.cal-circle {
  cursor: pointer;
}

button.cal-circle:hover {
  border-color: var(--bs-emphasis-color);
}

.cal-circle-filled {
  background: #fde047;
  border-color: #eab308;
  color: #1e293b;
}

button.cal-circle-filled:hover {
  background: #fde047;
}

.cal-circle-attended {
  border-color: #eab308;
}

.cal-circle-empty {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
}

.cal-circle-muted {
  opacity: 0.25;
}

.cal-circle-today {
  border-color: #2d6a4f;
  border-width: 2px;
  font-weight: 700;
  outline: 3px solid #2d6a4f;
  outline-offset: 2px;
}

.message-bubble,
.teacher-message-bubble {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  display: inline-block;
  max-width: 42rem;
  padding: 0.875rem 1rem;
}

.message-bubble-outbound,
.teacher-message-bubble-outbound {
  background: var(--bs-dark);
  border-color: var(--bs-dark);
  color: #fff;
}

.message-thread-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 13rem);
}

body.turbo-native .message-thread-page {
  height: calc(100dvh - 7rem);
  margin-left: -1rem;
  margin-right: -1rem;
  width: calc(100% + 2rem);
}

.message-thread-bubble {
  border-radius: 0.5rem;
  max-width: 70%;
  padding: 0.75rem 1rem;
}

.message-thread-bubble-in {
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
}

.message-thread-bubble-out {
  background: var(--bs-primary);
  color: #fff;
}

.message-thread-bubble-out .text-secondary {
  color: rgba(255,255,255,0.7) !important;
}

.inbox-list {
  border-top: 1px solid var(--bs-border-color);
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.inbox-list > li {
  border-bottom: 1px solid var(--bs-border-color);
}

.inbox-list > li:last-child {
  border-bottom: 0;
}

.inbox-row {
  border-bottom: 1px solid var(--bs-border-color);
  padding: 1rem 1.25rem;
}

.entry-panel-muted {
  background: var(--bs-dark);
  border-color: var(--bs-dark);
  color: #fff;
}

.entry-panel-muted .entry-title,
.entry-panel-muted .entry-feature-label,
.entry-panel-muted h3,
.entry-panel-muted p,
.entry-panel-muted label {
  color: #fff;
}

.entry-panel-muted .entry-copy,
.entry-panel-muted .entry-feature-copy,
.entry-panel-muted .text-body-secondary {
  color: rgba(255, 255, 255, 0.75) !important;
}

.entry-support-links a {
  color: var(--bs-secondary-color);
  text-decoration: underline;
}

.entry-empty-state {
  background: var(--bs-tertiary-bg);
  border: 1px dashed var(--bs-border-color);
  border-radius: 0;
  padding: 1rem;
}

.oauth-login {
  margin-top: 1rem;
}

.error_explanation {
  background: var(--bs-danger-bg-subtle);
  border: 1px solid var(--bs-danger-border-subtle);
  border-radius: 0;
  color: var(--bs-danger-text-emphasis);
  padding: 1rem;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.list-disc {
  list-style: disc;
}

.pl-5 {
  padding-left: 1.25rem;
}

.grid {
  display: grid;
}

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.block {
  display: block;
}

.hidden {
  display: none;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1 1 0%;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.w-full {
  width: 100%;
}

.w-fit {
  width: fit-content;
}

.min-w-0 {
  min-width: 0;
}

.max-w-2xl {
  max-width: 42rem;
}

.max-w-3xl {
  max-width: 48rem;
}

.max-w-xl {
  max-width: 36rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-8 { margin-bottom: 2rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-2 { padding-top: 0.5rem; }
.pb-0 { padding-bottom: 0; }
.pb-5 { padding-bottom: 1.25rem; }
.pb-6 { padding-bottom: 1.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.02em; }
.leading-6 { line-height: 1.5rem; }
.leading-7 { line-height: 1.75rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.rounded-2xl { border-radius: 0; }
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); }
.shadow-none { box-shadow: none; }

.text-slate-300,
.text-slate-400,
.text-slate-500,
.text-body-secondary {
  color: var(--bs-secondary-color) !important;
}

.text-slate-600,
.text-slate-700,
.text-slate-800,
.text-slate-900,
.text-slate-950 {
  color: var(--bs-emphasis-color) !important;
}

.text-white {
  color: #fff !important;
}

.bg-white {
  background: #fff !important;
}

.bg-slate-50,
.bg-slate-50\/70,
.bg-slate-50\/80,
.bg-slate-50\/85,
.bg-slate-100 {
  background: var(--bs-tertiary-bg) !important;
}

.bg-amber-100 { background: var(--bs-warning-bg-subtle) !important; }
.bg-emerald-100,
.bg-teal-50,
.bg-teal-100 { background: var(--bs-success-bg-subtle) !important; }
.bg-sky-100,
.bg-blue-50,
.bg-blue-100 { background: var(--bs-primary-bg-subtle) !important; }
.bg-slate-900,
.bg-slate-950 { background: var(--bs-dark) !important; }

.text-amber-800 { color: var(--bs-warning-text-emphasis) !important; }
.text-emerald-800,
.text-teal-800 { color: var(--bs-success-text-emphasis) !important; }
.text-sky-800,
.text-blue-700 { color: var(--bs-primary-text-emphasis) !important; }

.border,
.border-slate-100,
.border-slate-200,
.border-slate-200\/80,
.border-slate-300 {
  border-color: var(--bs-border-color) !important;
}

.border-dashed {
  border-style: dashed !important;
}

.badge {
  font-weight: 600;
}

/* Professional tables */
.table {
  --bs-table-cell-padding-x: 0.875rem;
  --bs-table-cell-padding-y: 0.75rem;
}
.table thead th {
  background: var(--bs-tertiary-bg);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  border-bottom: 2px solid var(--bs-border-color);
  white-space: nowrap;
}
/* First/last cell padding aligns table edges with card content above */
.table > :not(caption) > * > :first-child { padding-left: 1.5rem; }
.table > :not(caption) > * > :last-child  { padding-right: 1.5rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: var(--bs-primary-bg-subtle); }

/* Icon-only action buttons */
.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

/* button_to wraps a <form> — keep it inline inside flex action cells */
td form:has(.btn-icon) { display: inline-flex; }

/* Better badge/status styles */
.badge-status-active {
  background: #d8f3dc;
  color: #1b4332;
  border: 1px solid #95d5b2;
  padding: 0.25rem 0.625rem;
  border-radius: 0;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-status-inactive, .badge-status-invited {
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  border: 1px solid var(--bs-border-color);
  padding: 0.25rem 0.625rem;
  border-radius: 0;
  font-size: 0.72rem;
  font-weight: 600;
}
[data-bs-theme="dark"] .badge-status-active {
  background: #1b4332;
  color: #74c69d;
  border-color: #2d6a4f;
}

/* Page header improvements */
.page-header h1, .page-header .h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--bs-emphasis-color);
  margin: 0;
}
.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--bs-emphasis-color);
  margin-bottom: 0.25rem;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  margin: 0;
}

/* Better form styles */
.form-control:focus, .form-select:focus {
  border-color: #40916c;
  box-shadow: 0 0 0 0.2rem rgba(45, 106, 79, 0.15);
}

@media (min-width: 576px) {
  .sm\:w-auto { width: auto; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:items-end { align-items: end; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:px-8 { padding-left: 2rem; padding-right: 2rem; }
  .sm\:py-8 { padding-top: 2rem; padding-bottom: 2rem; }
  .sm\:text-3xl { font-size: 1.875rem; }
  .sm\:min-w-40 { min-width: 10rem; }
}

@media (min-width: 768px) {
  .form-grid,
  .detail-list,
  .child-section-grid,
  .attendance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-5,
  .parent-calendar-head,
  .parent-calendar-body { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .md\:flex-row { flex-direction: row; }
  .md\:items-end { align-items: end; }
  .md\:justify-between { justify-content: space-between; }
}

@media (min-width: 992px) {
  .shell-layout {
    align-items: flex-start;
    flex-direction: row;
  }

  .shell-sidebar {
    position: sticky;
    top: 1.5rem;
  }

  .shell-content {
    flex: 1 1 auto;
  }

  .shell-topbar {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lg\:flex-row { flex-direction: row; }
  .lg\:items-center { align-items: center; }
  .lg\:items-start { align-items: flex-start; }
  .lg\:justify-between { justify-content: space-between; }
}

@media (min-width: 1200px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  }

  .summary-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .child-section-grid,
  .xl\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.attendance-modal {
  background: transparent;
  border: 0;
  max-width: 42rem;
  padding: 0;
  width: min(42rem, calc(100vw - 2rem));
}

.attendance-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.attendance-modal-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0;
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.22);
  padding: 1.5rem;
}

.attendance-modal-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.attendance-modal-form,
.attendance-modal-summary {
  display: grid;
  gap: 0.75rem;
}

.attendance-modal-toggle {
  background: var(--bs-tertiary-bg);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.attendance-modal-toggle input[type="checkbox"] {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.attendance-modal-toggle:has(:checked) {
  background: var(--bs-success-bg-subtle);
  border-color: var(--bs-success-border-subtle);
  color: var(--bs-success-text-emphasis);
}

.attendance-modal-divider {
  border: 0;
  border-top: 1px solid var(--bs-border-color);
  margin: 1rem 0;
}

.attendance-modal-section {
  margin-bottom: 0.5rem;
}

.attendance-modal-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  margin-bottom: 0.4rem;
}

.attendance-modal-placeholder {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

.attendance-modal-detail-value {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.attendance-modal-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.25rem;
}

.attendance-modal-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.attendance-modal-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--bs-emphasis-color);
}

.attendance-modal-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bs-secondary-color);
}

.attendance-modal-classmates-table {
  border-collapse: collapse;
  width: 100%;
}

.attendance-modal-classmates-table th,
.attendance-modal-classmates-table td {
  border: 1px solid var(--bs-border-color);
  padding: 0.4rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.attendance-modal-classmates-table th {
  background: var(--bs-tertiary-bg);
  font-weight: 600;
}

.attendance-modal-classmates-table td:first-child {
  padding-right: 1.5rem;
}

.calendar-day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ── Mobile calendar ─────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .parent-calendar-head,
  .parent-calendar-body {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .parent-calendar-day {
    padding: 0.2rem 0.1rem;
  }

  .cal-circle {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
  }
}

/* ── Android WebView / Hotwire Native hardening ─────────────────────── */

/* Suppress the grey flash on tap in Android WebView */
* { -webkit-tap-highlight-color: transparent; }

/* Prevent Android's pull-to-refresh conflicting with page scroll */
body { overscroll-behavior-y: contain; }

/* Speed up touch response — skip 300ms tap delay */
a, button, [role="button"], label, input[type="submit"], input[type="button"] {
  touch-action: manipulation;
}

/* Minimum 44×44 touch targets for all interactive nav elements */
.mobile-bottom-nav a,
.mobile-bottom-nav button {
  min-height: 44px;
  min-width: 44px;
}

/* Prevent text zoom on form input focus in WebView */
input, select, textarea {
  font-size: max(16px, 1rem);
}

/* ── Mobile bottom nav ───────────────────────────────────────────────── */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  display: flex;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bottom-nav a,
.mobile-bottom-nav button.mobile-nav-icon-btn,
.mobile-bottom-nav button.mobile-nav-cog {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--bs-secondary-color);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-bottom-nav a.active {
  color: #2d6a4f;
}
.mobile-bottom-nav-parent a,
.mobile-bottom-nav-parent button.mobile-nav-icon-btn {
  padding: 14px 4px;
}
.mobile-bottom-nav-text a,
.mobile-bottom-nav-text button.mobile-nav-cog {
  padding: 8px 4px;
  font-size: 11px;
}
.mobile-nav-disabled {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 4px;
  color: var(--bs-secondary-color);
  opacity: 0.3;
  pointer-events: none;
  user-select: none;
}
.nav-badge {
  display: inline-block;
  margin-left: 0.4rem;
  min-width: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  vertical-align: middle;
}
.mobile-bottom-nav-parent a.mobile-nav-bell { position: relative; }
.mobile-nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.mobile-settings-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1001;
}
.mobile-settings-backdrop.open { display: block; }
.mobile-settings-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bs-body-bg);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--bs-border-color);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 1002;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.mobile-settings-sheet.open { transform: translateY(0); }
.mobile-settings-sheet .sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--bs-border-color);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.mobile-settings-sheet .sheet-user {
  font-size: 13px;
  color: var(--bs-secondary-color);
  margin-bottom: 4px;
}
.mobile-settings-sheet .sheet-locale-row {
  gap: 10px;
  cursor: default;
}
.mobile-settings-sheet .sheet-locale-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--bs-secondary-color);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.mobile-settings-sheet .sheet-locale-link.active {
  color: #2d6a4f;
}
.mobile-settings-sheet .sheet-tenant {
  font-weight: 600;
  margin-bottom: 16px;
}
.mobile-settings-sheet .sheet-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bs-secondary-color);
  margin-bottom: 4px;
}
.mobile-settings-sheet .sheet-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--bs-border-color);
  text-decoration: none;
  color: var(--bs-body-color);
  font-size: 15px;
  gap: 10px;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  cursor: pointer;
}
.mobile-settings-sheet .sheet-row:last-child {
  border-bottom: 1px solid var(--bs-border-color);
}
.mobile-settings-sheet .sheet-row.danger { color: var(--bs-danger); }
.mobile-settings-sheet .sheet-row.active { color: #2d6a4f; font-weight: 600; }
.mobile-settings-sheet .sheet-user { text-decoration: none; }
.mobile-settings-sheet .sheet-user:hover { text-decoration: underline; }
.mobile-settings-sheet .sheet-divider {
  height: 1px;
  background: var(--bs-border-color);
  margin: 8px 0;
}

/* ── Mobile bottom nav — dark mode ──────────────────────────────────── */
[data-bs-theme="dark"] .mobile-bottom-nav,
[data-bs-theme="dark"] .mobile-settings-sheet {
  background: var(--bs-body-bg);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .mobile-settings-sheet .sheet-row {
  color: var(--bs-body-color);
}

/* Hide web submit buttons in native app — native toolbar button handles save */
.turbo-native [data-controller="bridge--form-submit"] {
  display: none;
}

/* ── Segmented tab bar ───────────────────────────────────────────────── */
.tab-segment-bar {
  display: flex;
  gap: 0.25rem;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.625rem;
  padding: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-width: 0;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}
.tab-segment-bar.tab-bar-fade-right {
  -webkit-mask-image: linear-gradient(to right, black 70%, transparent 100%);
  mask-image: linear-gradient(to right, black 70%, transparent 100%);
}
.tab-segment-bar::-webkit-scrollbar {
  display: none;
}
.tab-segment {
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--bs-secondary-color);
  touch-action: pan-x;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.tab-segment:hover {
  color: var(--bs-body-color);
  background: var(--bs-secondary-bg);
}
.tab-segment.active {
  background: var(--bs-body-bg);
  color: var(--bs-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 1px var(--bs-border-color);
}
[data-bs-theme="dark"] .tab-segment.active {
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px var(--bs-border-color);
}
.tab-segment .tab-count {
  display: inline-block;
  margin-left: 0.4rem;
  min-width: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--bs-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}
.inbox-row-button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.inbox-row-button:hover { background: var(--bs-secondary-bg); }

/* Toggle-green checkbox */
.toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.75rem;
  height: 1.5rem;
  background: var(--bs-border-color);
  border-radius: 0.75rem;
  flex-shrink: 0;
  transition: background 0.18s;
  cursor: pointer;
}
.toggle-thumb {
  position: absolute;
  left: 0.15rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.18s;
}
.toggle-checkbox:checked + .toggle-track {
  background: #16a34a;
}
.toggle-checkbox:checked + .toggle-track .toggle-thumb {
  transform: translateX(1.25rem);
}

/* Fix form-actions button alignment */
.form-actions {
  align-items: flex-end;
}

/* section-card-muted: internal padding */
.section-card-muted {
  padding: 1.25rem;
}

/* Base schedule day toggles: hide checkbox, green when checked */
.section-card-muted label:has(> input[type="checkbox"]) {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.section-card-muted label > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.section-card-muted label:has(> input[type="checkbox"]:checked) {
  background-color: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #15803d !important;
  font-weight: 600;
}

.file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.file-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.file-input-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
