:root {
  /* Typography */
  --font-primary: 'Nunito Sans', system-ui, -apple-system, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Backgrounds: warm, luminous */
  --color-bg: #FBF9F5;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F7F2EA;

  /* Text */
  --color-text: #2A2522;
  --color-text-secondary: #6D6560;
  --color-text-light: #A09890;

  /* Accent: richer sage green with life */
  --color-accent: #4A8E6F;
  --color-accent-hover: #3D7A5E;
  --color-accent-light: #DFF0E7;

  /* Warm accent: golden peach for joy */
  --color-warm: #E8985C;
  --color-warm-hover: #D4864A;
  --color-warm-light: #FEF0E5;

  /* Status */
  --color-satisfied: #4A8E6F;
  --color-violated: #C4705E;
  --color-warning: #D4A060;
  --color-violated-light: #F9EEEB;
  --color-warning-light: #F9F2E8;

  /* Borders */
  --color-border: #E5DED4;
  --color-border-focus: #5B9279;

  /* Shadows: warm cast, more presence */
  --shadow-sm: 0 1px 4px rgba(120, 100, 70, 0.08), 0 1px 2px rgba(120, 100, 70, 0.04);
  --shadow-md: 0 4px 16px rgba(120, 100, 70, 0.10), 0 2px 4px rgba(120, 100, 70, 0.06);
  --shadow-lg: 0 8px 32px rgba(120, 100, 70, 0.12), 0 4px 8px rgba(120, 100, 70, 0.06);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Layout */
  --container-max: 1100px;
  /* Header spans nearly full viewport width; cap on ultra-wide screens */
  --header-max: 1600px;
  --content-max: 720px;
  /* Full-width birthday strip above fixed header (sync with .birthday-banner padding and type) */
  --birthday-banner-height: 3.35rem;

  /* Radii: rounder, friendlier */
  --card-radius: 12px;
  --input-radius: 10px;
  --button-radius: 10px;
  --pill-radius: 20px;
  --card-padding: var(--space-6);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background-color: #faf8f5;
  background-image: radial-gradient(ellipse 120% 65% at 50% 0%, #fdf2eb 0%, transparent 52%);
  font-family: var(--font-primary);
  color: var(--color-text);
  line-height: var(--leading-normal);
  margin: 0;
  padding: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h2.heading-section {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.heading-subsection {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.text-meta {
  font-size: var(--text-sm);
  color: #6b6b6b;
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
}

.text-body {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
}

h3 {
  font-size: var(--text-xl);
}

p {
  margin: 0;
}

button, input, textarea, select {
  font-family: var(--font-primary);
  font-size: var(--text-base);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
}

/* Screen reader only utility */
.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;
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: var(--space-4);
  background-color: var(--color-accent);
  color: var(--color-surface);
  text-decoration: none;
  border-radius: var(--card-radius);
  font-weight: var(--weight-medium);
}

.skip-to-content:focus {
  left: var(--space-4);
  top: var(--space-4);
}

/* Navigation bar */
header {
  position: fixed;
  top: var(--birthday-banner-height);
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  box-shadow: 0 1px 8px rgba(120, 100, 70, 0.06);
  z-index: 100;
  border-bottom: 1px solid rgba(229, 222, 212, 0.5);
}

.header-container {
  width: 100%;
  max-width: var(--header-max);
  margin: 0 auto;
  padding: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.brand {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  white-space: nowrap;
}

.app-title {
  font-weight: var(--weight-bold);
  font-size: var(--text-2xl);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.app-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--color-warm);
  border-radius: 2px;
  margin-top: 2px;
}

.header-container > nav {
  display: flex;
  gap: var(--space-8);
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

nav a {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  position: relative;
  padding: var(--space-2) 0;
}

nav a:hover {
  color: var(--color-accent);
}

nav a.active,
nav a[aria-current="page"] {
  background: var(--color-warm-light);
  border-radius: 8px;
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  padding: var(--space-2) var(--space-3);
}

.nav-link-chat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-link-chat .nav-chat-icon {
  flex-shrink: 0;
}

.mobile-nav .nav-link.active,
.mobile-nav a.active {
  background: var(--color-warm-light);
  border-radius: 8px;
  color: var(--color-text);
  font-weight: var(--weight-semibold);
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}

.hamburger-btn span {
  width: 24px;
  height: 2px;
  background-color: var(--color-text);
  transition: all 0.3s ease;
}

.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translateY(10px);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-10px);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: calc(60px + var(--birthday-banner-height));
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-surface);
  flex-direction: column;
  padding: var(--space-6);
  gap: var(--space-4);
  z-index: 99;
}

.mobile-nav.active {
  display: flex;
}

.mobile-nav a {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
}

/* Main content (vertical offset lives on .app-layout; fixed header + banner are out of flow) */
main {
  margin-top: 0;
  padding: var(--space-6);
}

.main-container > .section.active {
  margin-bottom: var(--space-8);
}

.main-container > .section.active:last-child {
  margin-bottom: 0;
}

#main-content:focus {
  outline: none;
}

.main-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Sections */
.section {
  display: none;
}

.section.active {
  display: block;
}

/* Cards */
.card,
.constraint-card,
.student-card,
.log-entry,
.log-entry-card,
.lesson-card {
  background-color: var(--color-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  padding: var(--card-padding);
  border: 1px solid rgba(229, 222, 212, 0.6);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.lesson-unit {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover,
.constraint-card:hover,
.student-card:hover,
.log-entry-card:hover,
.lesson-unit:hover,
.lesson-card:hover,
.log-entry:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

/* Dashboard: left column = stacked compact cards, right = lessons (no row-height stretch) */
.card-grid--dashboard {
  /* minmax(0, 1fr) lets tracks shrink when main column is narrow (chat panel open) */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.dashboard-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.card-grid--dashboard .card {
  min-width: 0;
  max-width: 100%;
}

.card--dashboard-compact {
  padding: var(--space-5) var(--space-6);
}

.card--dashboard-compact .dashboard-inline-body + .btn {
  margin-top: var(--space-4);
}

/* Tighter body than .empty-state (avoids tall seating card with little content) */
.dashboard-inline-body {
  text-align: center;
  padding: var(--space-2) 0 var(--space-4);
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.dashboard-inline-body p {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.dashboard-inline-body p:last-child {
  margin-bottom: 0;
}

.card--dashboard-lessons .dashboard-inline-body {
  text-align: left;
  padding-top: var(--space-1);
}

.card--dashboard-lessons .dashboard-inline-body ul {
  margin: 0;
}

.card--dashboard-compact > h2:first-of-type,
.card--dashboard-lessons > h2:first-of-type {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-4);
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.lesson-summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lesson-summary-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
}

.lesson-summary-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.lesson-summary-item:first-child {
  padding-top: 0;
}

.lesson-summary-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.lesson-summary-subject {
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.lesson-summary-unit-name {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.lesson-summary-progress-track {
  height: 4px;
  border-radius: 3px;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.lesson-summary-progress-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
  transition: width 0.25s ease;
}

.lesson-summary-progress-label {
  flex-shrink: 0;
}

/* Recent log on dashboard: same column width as quick note; list reads left */
.dashboard-recent-log-entries {
  text-align: left;
  padding: var(--space-2) 0 var(--space-4);
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.dashboard-recent-log-entries p {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.dashboard-recent-log-entries p:last-child {
  margin-bottom: 0;
}

.dashboard-recent-log-entries ul {
  margin: 0;
}

.dashboard-recent-log-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dashboard-recent-log-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.dashboard-recent-log-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dashboard-recent-log-item:first-child {
  padding-top: 0;
}

.dashboard-recent-log-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.dashboard-recent-log-item__date {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

.dashboard-recent-log-item__badge {
  flex-shrink: 0;
}

.dashboard-recent-log-item__students {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-1);
  line-height: var(--leading-tight);
}

.dashboard-recent-log-item__snip {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dashboard-mini-seating-lead {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

/* Card heading to body: global h2 reset leaves no gap; align with .form-group rhythm */
.card > h2:first-child,
.constraint-card > h2:first-child,
.student-card > h2:first-child,
.lesson-card > h2:first-child {
  margin-bottom: var(--space-6);
}

/* Same vertical rhythm between stacked cards (and after toolbars that use .section-toolbar) */
.section > .card + .card {
  margin-top: var(--space-6);
}

.section > .card-grid + .card {
  margin-top: 0;
}

.section > .inline-form + .card {
  margin-top: var(--space-6);
}

/* Toolbars at top of section: one spacing token to the next block (avoid doubling with .card margins) */
.section-toolbar {
  margin-bottom: var(--space-6);
}

.section-toolbar--flex {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.section-toolbar--grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.section-toolbar + .card {
  margin-top: 0;
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--button-radius);
  padding: 10px 22px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.btn:focus {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(91, 146, 121, 0.2);
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
  box-shadow: 0 3px 10px rgba(91, 146, 121, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.98) translateY(0);
  box-shadow: 0 1px 4px rgba(91, 146, 121, 0.2);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover {
  background-color: var(--color-surface-alt);
}

.btn-small {
  padding: 6px 12px;
  font-size: var(--text-sm);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Form elements */
.form-group {
  margin-bottom: var(--space-6);
}

label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  font-size: var(--text-sm);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--input-radius);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: var(--font-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.form-section,
.constraint-form,
.student-form {
  background: var(--color-surface-alt);
  border-radius: var(--card-radius);
  padding: var(--space-6);
  border: 1px solid rgba(229, 222, 212, 0.6);
  box-shadow: inset 0 1px 3px rgba(120, 100, 70, 0.04);
}

/* Radio buttons */
.radio-group {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

input[type="radio"] + label {
  margin: 0;
  cursor: pointer;
}

/* Student pills */
.student-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--pill-radius);
  padding: 6px 14px;
  font-size: var(--text-sm);
  cursor: grab;
  user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  margin: var(--space-2);
}

.student-pill:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--color-accent);
}

.student-pill:active {
  cursor: grabbing;
}

.student-pill.violation,
.student-pill.violated {
  border-color: var(--color-violated);
  background-color: var(--color-violated-light);
}

.student-pill.selected {
  background-color: var(--color-accent-light);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

.student-pill.dragging {
  opacity: 0.5;
}

/* Status indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.satisfied {
  background-color: var(--color-satisfied);
}

.status-dot.violated {
  background-color: var(--color-violated);
}

.status-dot.warning {
  background-color: var(--color-warning);
}

/* Severity badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.badge-minor {
  background-color: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.badge-moderate {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
}

.badge-serious {
  background-color: var(--color-violated-light);
  color: var(--color-violated);
  border: 1px solid var(--color-violated);
}

/* Constraint score bar (warm track, green fill) */
.score-bar-container {
  margin: var(--space-4) 0;
}

.score-bar {
  display: flex;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-warm-light);
}

.score-bar-satisfied {
  background-color: var(--color-satisfied);
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}

.score-bar-violated {
  background: transparent;
  flex: 1;
  min-width: 0;
}

.score-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
}

thead {
  background-color: var(--color-surface-alt);
  border-bottom: 2px solid var(--color-border);
}

th {
  padding: var(--space-4);
  text-align: left;
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  font-size: var(--text-sm);
}

td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

tbody tr:nth-child(even) {
  background-color: var(--color-surface-alt);
}

tbody tr:hover {
  background-color: var(--color-accent-light);
}

/* Seating grid classroom layout */
.classroom-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--space-4);
  margin: var(--space-6) 0;
  min-height: 400px;
  padding: var(--space-4);
  background-color: var(--color-surface-alt);
  border-radius: var(--card-radius);
  border: 1px solid var(--color-border);
}

.classroom-table {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.classroom-table:hover {
  box-shadow: var(--shadow-md);
}

.classroom-table.drag-over {
  border: 2px solid var(--color-accent);
  background-color: var(--color-accent-light);
}

.classroom-table-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}

.classroom-table-seats {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
}

.position-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  background-color: var(--color-surface);
}

.position-marker.teacher {
  background-color: var(--color-text);
  color: var(--color-surface);
}

.position-marker.aide {
  background-color: var(--color-accent);
  color: var(--color-surface);
}

/* Responsive design */
@media (max-width: 1040px) {
  .card-grid--dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .card-grid--dashboard {
    grid-template-columns: 1fr;
  }

  .classroom-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }

  table {
    font-size: var(--text-xs);
  }

  th, td {
    padding: var(--space-2);
  }
}

@media (max-width: 480px) {
  .hamburger-btn {
    display: flex;
  }

  nav {
    display: none;
  }

  .header-container {
    padding: var(--space-4);
  }

  main {
    padding: var(--space-4);
  }

  .app-layout {
    margin-top: calc(60px + var(--birthday-banner-height));
    height: calc(100vh - 60px - var(--birthday-banner-height));
    max-height: calc(100vh - 60px - var(--birthday-banner-height));
  }

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

  .btn {
    padding: 8px 16px;
    font-size: var(--text-sm);
  }

  .classroom-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    min-height: 250px;
  }
}

/* Empty state: warm, inviting, not cold */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.empty-state p {
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
  color: var(--color-text-secondary);
}

.empty-state-sub {
  font-size: var(--text-sm) !important;
  color: var(--color-text-light) !important;
  font-style: italic;
}

/* Loading state */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Flash animation */
@keyframes flash {
  0% {
    background-color: var(--color-accent-light);
  }
  100% {
    background-color: transparent;
  }
}

.flash {
  animation: flash 0.6s ease-out;
}

/* Inline forms */
.inline-form {
  background-color: var(--color-surface-alt);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  margin: var(--space-6) 0;
  border: 1px solid rgba(229, 222, 212, 0.6);
  box-shadow: inset 0 1px 3px rgba(120, 100, 70, 0.04);
}

.inline-form.hidden {
  display: none;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.form-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: flex-end;
  margin-top: var(--space-6);
}

/* ARIA live region */
[role="status"] {
  position: sr-only;
}

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

/* Constraint visualization */
.constraint-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.constraint-item {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.constraint-info {
  flex: 1;
}

.constraint-students {
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.constraint-arrow {
  margin: 0 var(--space-3);
  color: var(--color-text-secondary);
  font-weight: var(--weight-semibold);
}

.constraint-type {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

.constraint-actions {
  display: flex;
  gap: var(--space-2);
}

/* Expandable sections */
.expandable {
  cursor: pointer;
}

.expandable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  font-weight: var(--weight-semibold);
  user-select: none;
  transition: all 0.2s ease;
}

.expandable-header:hover {
  background-color: var(--color-accent-light);
}

.expandable-toggle {
  display: inline-block;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  font-weight: var(--weight-bold);
  transition: transform 0.2s ease;
}

.expandable.active .expandable-toggle {
  transform: rotate(90deg);
}

.expandable-content {
  display: none;
  padding: var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.expandable.active .expandable-content {
  display: block;
}

/* Multi-select area for students */
.student-select-area {
  min-height: 60px;
  padding: var(--space-4);
  border: 2px dashed rgba(229, 222, 212, 0.8);
  border-radius: var(--card-radius);
  background-color: var(--color-surface-alt);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.student-select-area.active {
  border-color: var(--color-accent);
  background-color: var(--color-accent-light);
}

/* Seating: layout card header + preview grid */
.card-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.card-heading-row .heading-section {
  margin-bottom: 0;
}

.layout-preview-grid {
  min-height: 140px;
  margin-bottom: var(--space-4);
}

.layout-preview-empty {
  margin: 0;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.layout-table-furniture {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4);
  background: linear-gradient(180deg, #f3ebe2 0%, #e8dfd4 100%);
  border: 1px solid rgba(180, 160, 140, 0.45);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 4px 12px rgba(120, 100, 70, 0.12);
  min-height: 88px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.layout-table-furniture:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 6px 16px rgba(120, 100, 70, 0.14);
  transform: translateY(-1px);
}

.layout-table-furniture-label {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.layout-table-furniture-cap {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.layout-editor-panel.hidden {
  display: none;
}

/* Student roster: compact rows, overflow menu */
.student-roster {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  background-color: var(--color-surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}

.student-roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.student-roster-row:last-child {
  border-bottom: none;
}

.student-roster-row:hover {
  background-color: var(--color-surface-alt);
}

.student-roster-row:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: -2px;
}

.student-roster-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.student-roster-name {
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.student-roster-iep-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--color-warm-light);
  color: var(--color-warm-hover);
  border: 1px solid rgba(232, 152, 92, 0.35);
}

.student-roster-meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.student-roster-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.student-roster-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--button-radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.student-roster-menu-btn:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

.student-roster-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 140px;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.student-roster-dropdown.is-open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.student-roster-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  color: var(--color-text);
}

.student-roster-dropdown-item:hover {
  background: var(--color-surface-alt);
}

.student-roster-dropdown-item--danger {
  color: var(--color-violated);
}

/* Log: compact filters and entry cards */
.log-filters-compact label {
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.log-filters-compact {
  margin-bottom: var(--space-5);
}

.input-compact {
  padding: 6px 10px;
  font-size: var(--text-sm);
  min-height: 38px;
}

.log-entries-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.log-entry-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: 0;
}

.log-entry-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.log-entry-card__date {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

.log-entry-card__students {
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  font-size: var(--text-base);
}

.log-entry-card__desc {
  margin: 0;
}

.log-entry-followup.expandable {
  cursor: default;
}

.log-entry-followup {
  margin-top: var(--space-2);
}

.log-entry-followup .log-entry-followup-header {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--input-radius);
}

.log-entry-followup-label {
  color: var(--color-text-secondary);
}

.log-entry-followup-body {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-relaxed);
}

.log-entry-followup-line {
  margin: 0 0 var(--space-3);
}

.log-entry-followup-line:last-child {
  margin-bottom: 0;
}

/* Lesson arc: subject tabs and expandable units */
.lesson-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.lesson-toolbar .lesson-subject-tabs {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.btn-lesson-add {
  flex-shrink: 0;
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--button-radius);
}

.btn-lesson-add:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.lesson-subject-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.lesson-subject-tab {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.lesson-subject-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.lesson-subject-tab.is-active {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
  font-weight: var(--weight-semibold);
}

.lessons-subject-panel {
  margin-bottom: var(--space-6);
}

.lesson-group {
  margin-bottom: var(--space-8);
}

.lesson-group h2 {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-border);
}

.lesson-unit {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: 0;
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.lesson-unit--in_progress {
  border-left: 4px solid var(--color-accent);
}

.lesson-unit--completed {
  opacity: 0.78;
}

.lesson-unit--completed .lesson-unit-title-line {
  color: var(--color-text-secondary);
}

.lesson-unit-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
  transition: background-color 0.15s ease;
}

.lesson-unit-header:hover {
  background-color: var(--color-surface-alt);
}

.lesson-unit-status-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-accent);
}

.lesson-unit--completed .lesson-unit-status-icon {
  color: var(--color-satisfied);
}

.lesson-unit-title-line {
  flex: 1;
  min-width: 0;
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.lesson-unit-dates {
  flex-shrink: 0;
}

.lesson-unit-chevron {
  flex-shrink: 0;
  display: inline-block;
  transition: transform 0.2s ease;
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.lesson-unit--expanded .lesson-unit-chevron {
  transform: rotate(90deg);
}

.lesson-unit-body {
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.lesson-standards,
.lesson-notes-block {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.lesson-standards strong,
.lesson-notes-block strong {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

/* ============================================
   Chat Panel and App Layout (resizable)
   ============================================ */

.app-layout {
  display: flex;
  margin-top: calc(80px + var(--birthday-banner-height));
  height: calc(100vh - 80px - var(--birthday-banner-height));
  max-height: calc(100vh - 80px - var(--birthday-banner-height));
  min-height: 0;
  overflow: hidden;
}

.main-content {
  flex: 1;
  /* Shrink with chat open: avoid forcing horizontal overflow below ~820px total width */
  min-width: min(400px, 100%);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 0;
  overscroll-behavior: contain;
}

/* Drag handle between main and chat */
.chat-resize-handle {
  width: 6px;
  cursor: col-resize;
  background: var(--color-border);
  transition: background 0.15s ease;
  flex-shrink: 0;
  position: relative;
}

.chat-resize-handle:hover,
.chat-resize-handle.dragging {
  background: var(--color-accent);
}

.chat-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 1px;
  width: 4px;
  height: 32px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: rgba(0,0,0,0.12);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  width: 420px;
  min-width: 300px;
  max-width: 700px;
  min-height: 0;
  background: linear-gradient(180deg, var(--color-surface) 0%, #FAF7F3 100%);
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.app-layout.chat-collapsed .chat-resize-handle {
  display: none;
}

.app-layout.chat-collapsed .chat-panel {
  display: none;
}

/* Full-screen chat route (#chat): main hidden, single column chat */
.app-layout.view-chat-only .main-content {
  display: none !important;
}

.app-layout.view-chat-only .chat-resize-handle {
  display: none !important;
}

.app-layout.view-chat-only .chat-panel {
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto;
}

.app-layout.view-chat-only .chat-reopen-tab {
  display: none !important;
}

/* Desktop: when sidebar chat is hidden, edge tab restores it (‹ pairs with › on panel header) */
.chat-reopen-tab {
  display: none;
  position: fixed;
  z-index: 105;
  right: 0;
  top: calc(80px + var(--birthday-banner-height) + 18vh);
  width: 40px;
  min-height: 88px;
  padding: var(--space-3) 0;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: var(--color-surface);
  box-shadow: -2px 4px 16px rgba(120, 100, 70, 0.12);
  cursor: pointer;
  color: var(--color-accent);
  font-size: 1.35rem;
  font-weight: var(--weight-bold);
  line-height: 1;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-reopen-tab:hover {
  background: var(--color-accent-light);
  color: var(--color-accent-hover);
}

.chat-reopen-glyph {
  display: block;
  transform: translateX(1px);
}

@media (min-width: 768px) {
  .app-layout.chat-collapsed:not(.view-chat-only) .chat-reopen-tab {
    display: flex;
  }
}

.chat-fab-icon {
  display: block;
}

/* Chat header: warm presence */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.chat-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.01em;
}

.chat-title::after {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  background: var(--color-warm);
  border-radius: 2px;
  margin-top: 3px;
}

.chat-collapse-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  transition: all 0.15s ease;
}

.chat-collapse-btn:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Birthday banner: emojis specifically allowed for this birthday celebration */
.birthday-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
  box-sizing: border-box;
  min-height: var(--birthday-banner-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FCEABB 0%, #F8B500 50%, #FCEABB 100%);
  color: #5C3D00;
  text-align: center;
  padding: 12px var(--space-4);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(248, 181, 0, 0.3);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* Chat messages: generous spacing */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overscroll-behavior: contain;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

/* Welcome greeting: warm card with breathing room */
.chat-greeting {
  align-self: stretch;
  max-width: 100%;
  background: linear-gradient(135deg, var(--color-warm-light) 0%, #FEF6F0 100%);
  border-left: 3px solid var(--color-warm);
  border-radius: var(--card-radius);
  padding: var(--space-6) var(--space-6);
  margin-bottom: var(--space-2);
  box-shadow: 0 2px 8px rgba(232, 168, 124, 0.1);
}

.chat-greeting p {
  margin: 0 0 var(--space-4) 0;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text);
}

.chat-greeting p:first-child {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.chat-greeting p:last-child {
  margin-bottom: 0;
  font-weight: var(--weight-semibold);
  color: var(--color-warm);
}

/* Chat bubbles: rounder, more polished */
.chat-message {
  max-width: 88%;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.65;
  word-wrap: break-word;
}

.chat-message p {
  margin: 0;
}

.chat-message p + p {
  margin-top: var(--space-2);
}

.chat-message-user {
  align-self: flex-end;
  background: var(--color-accent);
  color: #FFFFFF;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 8px rgba(91, 146, 121, 0.2);
}

.chat-message-assistant {
  align-self: flex-start;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 16px 16px 16px 4px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.chat-typing p {
  opacity: 0.5;
}

/* Chat input: clean, inviting */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 10px 18px;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  background: var(--color-bg);
  color: var(--color-text);
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-input::placeholder {
  color: var(--color-text-light);
}

.chat-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(91, 146, 121, 0.25);
}

.chat-send-btn:hover {
  background: var(--color-accent-hover);
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* Chat FAB */
.chat-fab {
  display: none;
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  border: none;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 4px 16px rgba(91, 146, 121, 0.3);
  font-size: var(--text-xl);
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-fab:hover {
  background: var(--color-accent-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(91, 146, 121, 0.35);
}

.chat-fab-unread::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-violated);
  border: 2px solid white;
}

@media (max-width: 767px) {
  .chat-resize-handle {
    display: none;
  }

  .chat-panel {
    position: fixed;
    top: calc(80px + var(--birthday-banner-height));
    right: 0;
    width: 88vw;
    max-width: 400px;
    height: calc(100vh - 80px - var(--birthday-banner-height));
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 100;
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.15);
  }

  .chat-panel.open {
    transform: translateX(0);
  }

  .chat-fab {
    display: flex;
  }

  .app-layout.view-chat-only .chat-panel {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    z-index: 1;
    box-shadow: none;
  }

  .app-layout.view-chat-only .chat-fab {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .chat-panel {
    top: calc(60px + var(--birthday-banner-height));
    height: calc(100vh - 60px - var(--birthday-banner-height));
  }

  .chat-reopen-tab {
    top: calc(60px + var(--birthday-banner-height) + 18vh);
  }
}

@media (min-width: 768px) {
  .chat-fab {
    display: none;
  }
}
