:root {
  /* macOS-inspired palette with frosted surfaces */
  --bg: transparent;
  --panel: rgba(255,255,255,0.60); /* frosted glass surface */
  --panel-solid: #ffffff;          /* solid fallback */
  --text: #1c1c1e;
  --muted: #6e6e73;
  --subtle: #6e6e73;
  --primary: #0a84ff;
  --primary-weak: rgba(10,132,255,0.18);
  --danger: #ff3b30;
  --danger-weak: rgba(255,59,48,0.16);
  --warning: #ff9f0a;
  --success: #34c759;
  --border: rgba(255,255,255,0.35); /* glass border */
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 40px rgba(16,24,40,0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: linear-gradient(135deg, #0f3d2e 0%, #1a4d3d 100%);
    --panel: rgba(28,28,30,0.55);
    --panel-solid: #2c2c2e;
    --text: #f2f2f7;
    --muted: #98989d;
    --subtle: rgba(242,242,247,0.6);
    --primary: #0a84ff;
    --primary-weak: rgba(10,132,255,0.25);
    --danger: #ff453a;
    --danger-weak: rgba(255,69,58,0.22);
    --warning: #ffd60a;
    --success: #30d158;
    --info-bg-dark: rgba(10,132,255,0.25);
    --info-fg-dark: #64d2ff;
    --success-bg-dark: rgba(48,209,88,0.25);
    --success-fg-dark: #30d158;
    --danger-bg-dark: rgba(255,69,58,0.25);
    --danger-fg-dark: #ff6961;
    --warning-bg-dark: rgba(255,214,10,0.25);
    --warning-fg-dark: #ffd60a;
    --border: rgba(255,255,255,0.2);
    --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 20px 40px rgba(0,0,0,0.35);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  /* Background image only */
  background: url('background.avif');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* page never scrolls; inner panes scroll */
}

/* Accessibility focus */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 20px; }
.brand .title { font-weight: 600; }

.top-nav { display: inline-flex; gap: 0; background: rgba(0,0,0,0.04); border: 1px solid var(--border); border-radius: 10px; padding: 2px; }
.top-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
}
.top-nav a.active { background: var(--primary-weak); color: var(--text); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
}
.icon-btn .badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  height: 18px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--text);
  background: var(--primary-weak);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  position: absolute;
  top: -6px;
  right: -6px;
}

.app-root { height: 100%; min-height: 0; padding: 16px; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: saturate(180%) blur(18px); }

.layout { display: grid; grid-template-columns: 1fr 4fr; gap: 28px; align-items: stretch; width: 100%; padding: 24px; height: 100vh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 10px; backdrop-filter: saturate(180%) blur(18px); height: 100%; min-height: 0; overflow: hidden; }
.sidebar .section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 8px; }
.sidebar .nav { display: grid; gap: 4px; margin-bottom: 8px; }
.sidebar .nav a { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:8px; color: var(--text); text-decoration:none; }
.sidebar .nav a.active { background: var(--primary-weak); }
/* Sidebar student list removed - keeping styles commented for potential reuse
.sidebar .search { padding: 6px 8px; }
.sidebar .search input { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:8px; background: var(--panel-solid); }
.sidebar .list { margin-top:8px; flex: 1; min-height: 0; overflow:auto; scrollbar-gutter: stable both-edges; }
.sidebar .student { display:flex; align-items:center; justify-content:flex-start; gap:6px; padding:6px 10px; border-radius:8px; cursor:pointer; min-height: 32px; }
.sidebar .student:hover { background: rgba(0,0,0,0.04); }
.sidebar .student .name { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; min-width: 0; flex: 0 1 auto; }
.sidebar .student .meta { font-size: 12px; color: var(--muted); margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 0 auto; }
*/

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: saturate(180%) blur(18px); }
.card .card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center; justify-content: space-between;
}
.card .card-body { padding: 12px 16px; }

.grid-2 {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px;
}

.pupil-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; align-items: stretch; }
.pupil-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.6));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: saturate(180%) blur(18px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 380px;
  overflow: hidden;
}
.pupil-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.pupil-head { display: flex; align-items: flex-start; gap: 14px; }
.pupil-photo-wrap { width: 96px; height: 96px; border-radius: 16px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,0.12); flex-shrink: 0; }
.pupil-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.pupil-head-info { display: flex; flex-direction: column; gap: 6px; }
.pupil-name { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pupil-meta { color: var(--muted); font-size: 14px; }
.pupil-tags { display: flex; gap: 10px; flex-wrap: wrap; }
.tag { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.65); backdrop-filter: blur(6px); transition: background 0.15s ease, border-color 0.15s ease; }
.tag:hover { background: rgba(255,255,255,0.82); border-color: var(--primary); }
  .pupil-tags .tag { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tag.status-warn, .tag.status-danger { font-weight: 700; }
  .pupil-actions { display: flex; gap: 8px; margin-top: auto; }
  .pupil-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 4px; }
  .metric { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,0.7); display: flex; flex-direction: column; gap: 4px; }
  .metric-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
  .metric-value { font-size: 15px; font-weight: 600; color: var(--text); }

.toolbar { display: flex; gap: 10px; align-items: center; }
.btn {
  background: var(--primary-weak);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.btn.secondary { background: #374151; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.warn { background: var(--warning); color: #111827; }
.btn.danger { background: var(--danger-weak); color: var(--text); border: 1px solid var(--border); }
.btn.danger:hover { border-color: var(--danger); filter: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:hover { filter: none; border-color: var(--primary); }
.btn:active { transform: translateY(0.5px); }

table { width: 100%; border-collapse: collapse; }
thead { background: #f3f4f6; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
th { font-weight: 600; color: #374151; }
tr:hover { background: #fafafa; }
.muted { color: var(--muted); }
.meetings-table th, .meetings-table td { vertical-align: middle; }
.meetings-table .actions-cell { text-align: right; white-space: nowrap; }
.meetings-table .table-actions { display: inline-flex; gap: 8px; align-items: center; }
.status-badge { padding: 2px 8px; border-radius: 9999px; font-size: 12px; }
.status-scheduled { background: #ffe9e6; color: #bf2a20; }
.status-confirmed { background: #d1f7db; color: #0a6c30; }
.status-request { background: #e6f0ff; color: #0a3b9e; }
.status-info { background: #e6f0ff; color: #0a3b9e; }
.status-ok { background: #d1f7db; color: #0a6c30; }
.status-warn { background: #fff3cd; color: #8a6d3b; }
.status-danger { background: #fde2e1; color: #b00020; }

.notifications-panel {
  position: fixed;
  top: 16px; right: 16px;
  width: 360px; max-height: 70vh; overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 10px;
  backdrop-filter: saturate(180%) blur(18px);
}
.notifications-panel::before {
  content: "";
  position: absolute; top: -8px; right: 32px; width: 16px; height: 16px; background: var(--panel); border-left:1px solid var(--border); border-top:1px solid var(--border); transform: rotate(45deg);
}
.notifications-panel .item {
  border-bottom: 1px solid var(--border);
  padding: 10px 6px;
}
.notifications-panel .item:last-child { border-bottom: none; }
.notifications-panel .title { font-weight: 600; }
.notifications-panel .due { font-size: 12px; color: var(--muted); }
.notifications-panel .actions { margin-top: 6px; display: flex; gap: 8px; }

.hidden { display: none; }

/* Dashboard filters */
.filters { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); backdrop-filter: saturate(180%) blur(18px); margin-bottom: 12px; }
.filters input[type="search"], .filters select { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.filters .chk { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--text); }

.student-toolbar { flex-wrap: wrap; gap: 16px; }
.student-header { display: flex; flex-direction: column; gap: 6px; }
.student-header-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.student-header-meta { font-size: 13px; color: var(--muted); }
/* Section color-coding for student profile cards:
   Documents (blue #0ea5e9), Digital Forms (purple #8b5cf6),
   Professionals (green #22c55e), Checklist (orange #f97316) */
.card[data-section="documents"] .card-header { border-left: 4px solid #0ea5e9; }
.card[data-section="forms"] .card-header { border-left: 4px solid #8b5cf6; }
.card[data-section="professionals"] .card-header { border-left: 4px solid #22c55e; }
.card[data-section="checklist"] .card-header { border-left: 4px solid #f97316; }
.card-highlight { animation: cardHighlight 1.2s ease; box-shadow: 0 0 0 2px var(--primary-weak), var(--shadow); }
@keyframes cardHighlight { from { box-shadow: 0 0 0 2px var(--primary); } to { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }

.dashboard { display: flex; flex-direction: column; gap: 16px; }
.dashboard-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.dashboard-head h1 { margin: 0; }
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-card { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.6)); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-height: 110px; }
.stat-card.warn { border-color: var(--warning); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat-value { font-size: 32px; font-weight: 700; line-height: 1.1; }
.stat-meta { font-size: 13px; color: var(--muted); }
.dashboard-panels, .dashboard-bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: stretch; }
.review-list { display: grid; gap: 10px; }
.review-row { display: flex; gap: 12px; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-solid); cursor: pointer; }
.review-row:hover { box-shadow: inset 0 0 0 1px var(--primary-weak); }
.review-row.overdue { border-color: var(--danger-weak); }
.review-info { flex: 1; min-width: 0; }
.review-name { font-weight: 600; }
.review-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.review-actions { display: flex; align-items: center; gap: 6px; }
.needs-flex { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.needs-legend { flex: 1; display: grid; gap: 8px; min-width: 220px; }
.needs-legend-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-solid); }
/* Modern interactive pie chart */
.needs-pie {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 0 0 2px rgba(255,255,255,0.2);
  transition: transform 0.3s ease;
}

.needs-pie svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Start at top */
}

.needs-pie-segment {
  cursor: pointer;
  transition: opacity 0.2s ease, filter 0.3s ease;
  stroke: var(--bg);
  stroke-width: 2;
}

.needs-pie-segment:hover {
  opacity: 0.85;
  filter: brightness(1.1);
}

.needs-pie-segment.active {
  filter: drop-shadow(0 0 8px currentColor) brightness(1.2);
  stroke-width: 3;
}

.needs-pie-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
}

/* Legend interactivity */
.needs-legend-item {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.needs-legend-item:hover {
  background: var(--panel-hover);
  transform: translateX(4px);
}

.needs-legend-item.active {
  border-color: var(--primary);
  background: var(--primary-weak);
  box-shadow: 0 0 0 2px var(--primary-weak);
}

/* Pupil list display */
.needs-pupils-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.pupil-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-solid);
  transition: background 0.2s ease;
}

.pupil-item:hover {
  background: var(--panel-hover);
}

.pupil-photo-small {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.pupil-info {
  flex: 1;
}

.pupil-name {
  font-weight: 600;
  font-size: 14px;
}

.pupil-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.legend-left { display: flex; gap: 10px; align-items: center; }
.legend-label { font-weight: 600; font-size: 14px; }
.legend-meta { font-size: 12px; color: var(--muted); }
.legend-pct { font-weight: 600; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-notif-list { display: grid; gap: 10px; }
.dash-notif { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-solid); }
.dash-notif.overdue { border-color: var(--danger); }
.dash-notif .notif-icon { color: var(--primary); }
.dash-notif .notif-content { flex: 1; min-width: 0; }
.dash-notif .notif-title { font-weight: 600; }
.dash-notif .notif-meta { font-size: 12px; color: var(--muted); }
.dash-notif .notif-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* SVG icons */
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }
.sidebar .nav a .icon { margin-right: 8px; }
.btn .icon, .icon-btn .icon, .btn svg, .icon-btn svg { color: inherit; }

/* Calendar */
.calendar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: saturate(180%) blur(18px);
}
.calendar .cal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.calendar .cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.calendar .cell.heat-0 { background: transparent; }
.calendar .cell.heat-1 { background: rgba(10,132,255,0.05); }
.calendar .cell.heat-2 { background: rgba(10,132,255,0.08); }
.calendar .cell.heat-3 { background: rgba(10,132,255,0.12); }
.calendar .cell.heat-4, .calendar .cell.heat-5 { background: rgba(10,132,255,0.16); }
.calendar .dow { background: #f9fafb; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); }
.calendar .cell { min-height: 110px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 6px; }
.calendar .cell:nth-child(7n) { border-right: none; }
.calendar .date { font-size: 12px; color: var(--muted); }
.calendar .event { margin-top: 6px; background: #e6f0ff; color: #0a3b9e; padding: 4px 8px; border-radius: 10px; font-size: 12px; }
.calendar .event.confirmed { background: #d1f7db; color: #0a6c30; }

/* Modal */
.modal-root { position: fixed; inset: 0; display: grid; align-items: center; justify-items: center; background: rgba(0,0,0,0.25); backdrop-filter: blur(6px); opacity: 0; pointer-events:none; transition: opacity .15s ease; }
.modal-root:not(.hidden) { opacity: 1; pointer-events:auto; }
.modal { width: 520px; max-width: 92vw; background: var(--panel); border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: saturate(180%) blur(18px); }
.modal { transform: translateY(6px); opacity: 0; transition: all .18s ease; }
.modal-root:not(.hidden) .modal { transform: translateY(0); opacity: 1; }
.modal .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal .modal-body { padding: 14px 16px; overflow: auto; max-height: 70vh; }
.modal-notifs { width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }

/* Notifications modal polish */
.notif-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255,255,255,0.6); cursor: pointer; }
.chip.active { background: var(--primary-weak); border-color: var(--primary); }
.notif-list { display: grid; gap: 8px; }
.notif-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(180deg, var(--accent-grad-1), var(--accent-grad-2)); backdrop-filter: saturate(180%) blur(12px); transition: all 0.2s ease; }
.notif-item:hover { filter: brightness(1.05); transform: translateY(-1px); }
.notif-item.overdue { box-shadow: inset 0 0 0 1px var(--primary); }
.notif-item.today { outline: 1px solid var(--primary); }
.notif-item.soon { border-left: 3px solid var(--primary); }
.notif-title { font-weight: 600; }
.notif-meta { font-size: 12px; color: var(--muted); }
.notif-actions { display: inline-flex; gap: 6px; }
.btn.icon { padding: 6px; width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; }
.notif-icon .icon { color: var(--primary); }
.notif-hint {
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  margin-bottom: 10px;
}
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; color: #374151; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,0.6); color: var(--text); }
.field textarea { min-height: 100px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-weak); outline-offset: 1px; }
.automation-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-weak);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0;
  font-weight: 500;
}
.automation-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Professional invite header */
.pro-invite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--primary-weak);
  border-radius: 8px;
}

.pro-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* Enhanced professional item */
.pro-invite-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-solid);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.pro-invite-item.selected,
.pro-invite-item:has(input:checked) {
  background: var(--primary-weak);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(10,132,255,0.15);
}

.pro-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--primary-weak);
  border-radius: 8px;
  color: var(--primary);
}

.pro-icon svg {
  width: 18px;
  height: 18px;
}

.pro-info {
  flex: 1;
}

.pro-name {
  font-weight: 600;
  font-size: 14px;
}

.pro-role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.pro-status {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Automation flow */
.automation-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-weak) 0%, rgba(10,132,255,0.08) 100%);
  border-radius: 10px;
  border: 1px solid var(--primary);
  margin-bottom: 16px;
  overflow-x: auto;
}

.automation-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.step-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: white;
  border-radius: 50%;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.step-icon svg {
  width: 18px;
  height: 18px;
}

.step-text {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  line-height: 1.3;
}

.step-arrow {
  font-size: 18px;
  color: var(--primary);
  font-weight: 700;
  margin: 0 4px;
}

/* Empty state */
.pro-empty-state {
  padding: 24px;
  text-align: center;
  background: rgba(0,0,0,0.02);
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.pro-empty-state .icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.3;
}

.pro-empty-state p {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0;
}

.pro-empty-state .btn {
  margin-top: 12px;
}

.list { display: grid; gap: 8px; }
.doc-row { display: grid; grid-template-columns: 1fr 140px 160px auto; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.doc-row .meta { color: var(--muted); font-size: 12px; }
.doc-row .actions { display: flex; gap: 8px; justify-content: flex-end; }

.section-title { margin: 14px 0 8px; font-weight: 700; }
.subtle { font-size: 12px; color: var(--subtle, var(--muted)); }

/* PDF preview modal */
.pdf-modal { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; }
.pdf-thumbs { display: grid; gap: 10px; }
.pdf-thumb { cursor: pointer; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.pdf-thumb iframe { width: 100%; height: 120px; border: 0; background: #fff; display: block; }
.pdf-thumb-label { font-size: 12px; color: var(--muted); padding: 6px; border-top: 1px solid var(--border); }
.pdf-view iframe { width: 100%; height: 70vh; border: 0; background: #fff; border-radius: 8px; box-shadow: var(--shadow); }

.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.link { color: var(--primary); cursor: pointer; text-decoration: underline; }

/* Context menu */
.context-menu { position: fixed; min-width: 220px; background: var(--panel-solid); border:1px solid var(--border); border-radius:10px; box-shadow: var(--shadow); padding:6px; z-index: 9999; }
.context-menu .mi { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:8px; cursor:pointer; }
.context-menu .mi:hover { background: rgba(0,0,0,0.06); }
.context-menu .sep { height:1px; background: var(--border); margin:6px 0; }

.comm-automated { background: var(--primary-weak); border-left: 2px solid var(--primary); }
.comm-message { display: flex; align-items: center; gap: 6px; }
.comm-auto-icon { color: var(--primary); }
.comm-group-row td { padding-top: 14px; border: 0; }
.comm-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.04);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.comm-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.info-banner { display: flex; gap: 12px; padding: 12px; background: var(--primary-weak); border-radius: 8px; border: 1px solid var(--border); margin-bottom: 12px; }
.info-banner .info-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,0.08); color: var(--primary); font-weight: 700; }
.automation-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary-weak) 0%, rgba(10,132,255,0.05) 100%);
  border: 2px solid var(--primary);
  border-radius: 12px;
  margin-bottom: 16px;
}

.banner-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: white;
  border-radius: 12px;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.banner-icon svg {
  width: 24px;
  height: 24px;
}

.banner-content strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--text);
}

.banner-content p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.banner-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 8px 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.notif-help { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); color: var(--muted); font-size: 12px; cursor: help; }
@media (prefers-color-scheme: dark) {
  /* Component surfaces using darker glass */
  .pupil-card { background: linear-gradient(180deg, rgba(44,44,46,0.92), rgba(28,28,30,0.9)); }
  .pupil-photo-wrap { box-shadow: 0 10px 28px rgba(0,0,0,0.45); }
  .metric { background: rgba(44,44,46,0.78); border-color: rgba(255,255,255,0.16); }
  .tag { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.24); }
  .tag:hover { background: rgba(255,255,255,0.35); border-color: var(--primary); }

  /* Interactive states - buttons & icons */
  .btn:hover { border-color: var(--primary); }
  .btn.ghost:hover { background: rgba(255,255,255,0.12); color: var(--text); border-color: var(--primary); }
  .btn.danger:hover { border-color: var(--danger); background: var(--danger-weak); color: var(--text); }
  .icon-btn:hover { background: rgba(255,255,255,0.08); }
  .btn.ghost:hover .icon, .btn.danger:hover .icon, .icon-btn:hover .icon { color: var(--text); }

  /* Navigation */
  .top-nav { background: rgba(255,255,255,0.06); }
  .top-nav a:hover { background: rgba(255,255,255,0.15); color: var(--text); font-weight: 500; }
  .top-nav a.active { background: var(--primary-weak); color: var(--text); }

  /* Tables and list rows */
  .card-body > table thead { background: rgba(44,44,46,0.9); }
  .card-body > table th { color: var(--text); }
  .card-body > table tr:hover { background: rgba(255,255,255,0.10); }
  .review-row:hover { background: rgba(255,255,255,0.10); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
  /* Sidebar student list removed - dark mode styles retained for potential reuse
  .sidebar .student:hover { background: rgba(255,255,255,0.12); }
  */
  .context-menu { background: var(--panel-solid); }
  .context-menu .mi:hover { background: rgba(255,255,255,0.1); }

  /* Dashboard components */
  .stat-card {
    background: rgba(0,0,0,0.9);
    border-color: rgba(255,255,255,0.25);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), var(--shadow);
  }
  .automation-banner {
    background: linear-gradient(135deg, rgba(10,132,255,0.2) 0%, rgba(10,132,255,0.08) 100%);
    border-color: rgba(10,132,255,0.6);
  }
  .banner-icon {
    background: rgba(44,44,46,0.95);
    border: 1px solid rgba(255,255,255,0.2);
  }
  .stat-item {
    background: rgba(44,44,46,0.9);
    border: 1px solid rgba(255,255,255,0.15);
  }
  .dash-notif { background: rgba(44,44,46,0.8); }
  .chip { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
  .chip:hover { background: rgba(255,255,255,0.15); }
  .chip.active { background: var(--primary-weak); border-color: var(--primary); }

  /* Calendar components */
  .calendar .dow { background: rgba(0,0,0,0.9); color: var(--text); border-bottom: 1px solid rgba(255,255,255,0.15); }
  .calendar .cell { border-color: rgba(255,255,255,0.15); }
  .calendar .date { color: var(--muted); }
  .calendar .event { background: var(--info-bg-dark); color: var(--info-fg-dark); }
  .calendar .event.confirmed { background: var(--success-bg-dark); color: var(--success-fg-dark); }

  /* Notifications, modal, and forms */
  .notifications-panel {
    background: rgba(16,16,18,0.96);
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 16px 42px rgba(0,0,0,0.6);
  }
  .notifications-panel::before {
    background: rgba(16,16,18,0.96);
    border-left-color: rgba(255,255,255,0.18);
    border-top-color: rgba(255,255,255,0.18);
  }
  .notifications-panel .card {
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .notifications-panel .card-body { padding: 8px; }
  .notifications-panel .item {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px;
    padding: 10px 12px;
  }
  .notifications-panel .item + .item { margin-top: 8px; }
  .notif-item:hover { background: rgba(255,255,255,0.08); filter: none; }
  .notif-hint { background: rgba(255,255,255,0.06); }
  .modal {
    background: rgba(16,16,18,0.96);
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 18px 46px rgba(0,0,0,0.55);
  }
  .modal .modal-header { border-color: rgba(255,255,255,0.16); }
  .field label { color: rgba(255,255,255,0.95); font-weight: 500; }
  .field input,
  .field textarea {
    background: rgba(28,28,30,0.95);
    color: rgba(255,255,255,0.95);
    border-color: rgba(255,255,255,0.2);
  }
  .field input::placeholder,
  .field textarea::placeholder {
    color: rgba(255,255,255,0.4);
  }
  .field select {
    background: rgba(60,60,62,0.95);
    color: #ffffff;
    border-color: rgba(255,255,255,0.25);
  }
  .field select option {
    background: rgba(60,60,62,1);
    color: #ffffff;
  }
  /* Notifications modal contrast */
  .chip { color: var(--text); }
  .chip.active { color: var(--text); }
  .notif-item {
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border-color: rgba(255,255,255,0.16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  }
  .notif-item:hover { background: rgba(255,255,255,0.12); }
  .notif-meta { color: rgba(242,242,247,0.7); }

  /* Status badges */
  .status-scheduled { background: var(--danger-bg-dark); color: var(--danger-fg-dark); }
  .status-confirmed, .status-ok { background: var(--success-bg-dark); color: var(--success-fg-dark); }
  .status-request { background: var(--info-bg-dark); color: var(--info-fg-dark); }
  .status-info { background: var(--info-bg-dark); color: var(--info-fg-dark); }
  .status-warn { background: var(--warning-bg-dark); color: var(--warning-fg-dark); }
  .status-danger { background: var(--danger-bg-dark); color: var(--danger-fg-dark); }

  /* Needs legend and pie visualization */
  .needs-legend-item { background: rgba(44,44,46,0.8); border-color: rgba(255,255,255,0.16); }
  .needs-pie-center { background: radial-gradient(circle, rgba(44,44,46,0.95) 0%, rgba(28,28,30,0) 65%); }
  .needs-pie {
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 0 0 2px rgba(255,255,255,0.12);
  }
  
  .needs-pie-center {
    background: radial-gradient(circle, rgba(44,44,46,0.98) 0%, rgba(28,28,30,0) 60%);
  }
  
  .pupil-item {
    background: rgba(44,44,46,0.8);
    border-color: rgba(255,255,255,0.16);
  }
  
  .pupil-item:hover {
    background: rgba(58,58,60,0.9);
  }

  /* Focus cues and muted text */
  :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
  .subtle { color: var(--subtle); }
  .muted { color: var(--muted); }

  .comm-group { background: rgba(255,255,255,0.08); }

  /* Professionals list and automation hint */
  .pro-invite-item { background: rgba(44,44,46,0.8); }
  .pro-invite-item.selected,
  .pro-invite-item:has(input:checked) {
    background: rgba(10,132,255,0.2);
    border-color: var(--primary);
  }
  .pro-icon {
    background: rgba(10,132,255,0.2);
  }
  .step-icon {
    background: rgba(44,44,46,0.95);
    border: 1px solid rgba(255,255,255,0.2);
  }
  .automation-flow {
    background: linear-gradient(135deg, rgba(10,132,255,0.15) 0%, rgba(10,132,255,0.05) 100%);
    border-color: rgba(10,132,255,0.4);
  }
  .pro-empty-state {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.1);
  }
  .automation-hint {
    background: rgba(10,132,255,0.15);
    color: #64b5f6;
  }
}
