/* Fjends Friskole app — design system
   Inspired by docendo.dk: light, clean, functional admin UI with a dark sidebar. */

:root {
  --sidebar-bg: #1b2233;
  --sidebar-bg-hover: #262f45;
  --sidebar-text: #aab2c5;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #4c5fee;

  --bg-app: #f4f6fb;
  --bg-panel: #ffffff;
  --border-color: #e4e8f1;
  --border-color-strong: #d3d9e6;

  --text-primary: #1b2233;
  --text-secondary: #6b7488;
  --text-muted: #9aa2b5;

  --brand-blue: #4c5fee;
  --brand-cyan: #10cafb;
  --brand-purple: #9b5de5;
  --brand-orange: #ff9b3a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(27, 34, 51, 0.06);
  --shadow-md: 0 4px 16px rgba(27, 34, 51, 0.08);
  --shadow-lg: 0 12px 32px rgba(27, 34, 51, 0.12);

  /* Fag / event colors */
  --fag-dansk: #c65b4e;
  --fag-geografi: #4e9e6e;
  --fag-matematik: #e0ad2e;
  --fag-engelsk: #3f6fd6;
  --fag-fysik: #2c3550;
  --fag-historie: #c99a5b;
  --fag-idraet: #3fa8a0;
  --fag-kristendom: #6a6fd8;
  --fag-biologi: #8fa8bd;
  --fag-tysk: #2c3550;
  --fag-valgfag: #9aa2b5;
  --fag-natur: #6bab54;
  --fag-musik: #d67ab1;
  --fag-billedkunst: #d98a4a;
  --fag-uu: #b0b6c4;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 84px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  flex-shrink: 0;
}

.sidebar__logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.sidebar__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
  flex: 1;
}

.sidebar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 68px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.sidebar__item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.sidebar__item:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}

.sidebar__item.is-active {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
  position: relative;
}

.sidebar__item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 3px;
  background: var(--brand-cyan);
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  width: 100%;
}

button.sidebar__item {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Role-based restrictions (prototype demo only) ---------- */

.sidebar__item[hidden] {
  display: none;
}

.role-parent #newEventBtn,
.role-parent #createFagBtn {
  display: none;
}

.role-parent .event,
.role-parent .monthgrid__event {
  cursor: pointer;
}

/* ---------- Main column ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Top tab bar ---------- */

.tabbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.tabbar__tab {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13.5px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.tabbar__tab svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.tabbar__tab.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--brand-blue);
}

.tabbar__spacer {
  flex: 1;
}

.tabbar__icons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tabbar__icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tabbar__icon-btn:hover {
  background: var(--bg-app);
}

.tabbar__icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

/* ---------- Week ruler ---------- */

.weekruler {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
}

.weekruler__cell {
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
}

.weekruler__cell:hover {
  background: var(--bg-app);
  color: var(--text-primary);
}

.weekruler__cell.is-active {
  background: var(--brand-blue);
  color: #fff;
  font-weight: 600;
}

/* ---------- Toolbar (class selector + date nav) ---------- */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.toolbar__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-wrap {
  position: relative;
}

.select {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
  background: var(--bg-panel);
}

.select:hover {
  border-color: var(--brand-blue);
}

.select svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-secondary);
  fill: none;
  transition: transform 0.15s ease;
}

.select-wrap.is-open .select svg {
  transform: rotate(180deg);
}

.select-wrap.is-open .select {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(76, 95, 238, 0.12);
}

.select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 20;
}

.select-wrap.is-open .select-dropdown {
  display: block;
}

.select-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.select-dropdown__item:hover {
  background: var(--bg-app);
}

.select-dropdown__item.is-selected {
  color: var(--brand-blue);
  background: rgba(76, 95, 238, 0.08);
}

.select-dropdown__item.is-selected::after {
  content: "✓";
  font-weight: 700;
}

.datenav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.datenav__btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color-strong);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.datenav__btn:hover {
  background: var(--bg-app);
}

.datenav__today {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color-strong);
  background: var(--bg-panel);
  padding: 0 10px;
  height: 26px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
}

.toolbar__range-wrap {
  position: relative;
}

.toolbar__range {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  cursor: pointer;
}

.toolbar__range:hover {
  border-color: var(--border-color-strong);
  background: var(--bg-app);
}

.toolbar__date-input {
  position: absolute;
  top: 100%;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toolbar__spacer {
  flex: 1;
}

.btn {
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: #3f50d9;
}

.btn--ghost {
  background: var(--bg-panel);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}

.btn--ghost:hover {
  background: var(--bg-app);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Body layout: filter panel + calendar ---------- */

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

.filterpanel {
  width: 240px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: width 0.2s ease;
}

.filterpanel.is-collapsed {
  width: 56px;
  padding: 16px 8px;
}

.filterpanel__top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filterpanel.is-collapsed .filterpanel__top {
  flex-direction: column;
}

.filterpanel__create {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.filterpanel__create:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.filterpanel.is-collapsed .filterpanel__create {
  padding: 8px 0;
  width: 100%;
}

.filterpanel.is-collapsed .filterpanel__create-label {
  display: none;
}

.filterpanel__collapse {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color-strong);
  background: var(--bg-panel);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.filterpanel__collapse:hover {
  background: var(--bg-app);
}

.filterpanel__collapse svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.filterpanel.is-collapsed .filterpanel__collapse svg {
  transform: rotate(180deg);
}

.filterpanel__section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
  white-space: nowrap;
}

.filterpanel.is-collapsed .filterpanel__section-title {
  display: none;
}

.faglist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fagchip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
}

.fagchip:hover {
  background: var(--bg-app);
}

.filterpanel.is-collapsed .fagchip {
  justify-content: center;
  padding: 8px 0;
}

.fagchip__dot {
  width: 10px;
  height: 26px;
  border-radius: 4px;
  flex-shrink: 0;
}

.fagchip__label {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fagchip__meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filterpanel.is-collapsed .fagchip__label,
.filterpanel.is-collapsed .fagchip__meta {
  display: none;
}

/* ---------- Calendar grid ---------- */

.calendar {
  flex: 1;
  overflow: auto;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

.calendar__grid {
  display: grid;
  grid-template-columns: 56px repeat(5, minmax(150px, 1fr));
}

.calendar__grid[hidden],
.monthgrid[hidden] {
  display: none;
}

.calendar__daycol-header {
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  z-index: 2;
}

.calendar__daycol-header span {
  display: block;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.calendar__daycol-header.is-today {
  color: var(--brand-blue);
}

.calendar__corner {
  position: sticky;
  top: 0;
  left: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  z-index: 3;
}

.calendar__hour-rail {
  position: relative;
}

.calendar__hour-label {
  position: absolute;
  left: 0;
  right: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  transform: translateY(-6px);
}

.calendar__daycol {
  border-left: 1px solid var(--border-color);
  position: relative;
  /* one line per hour, matches HOUR_HEIGHT (84px) in js/main.js */
  background-image: repeating-linear-gradient(
    to bottom,
    var(--border-color) 0,
    var(--border-color) 1px,
    transparent 1px,
    transparent 84px
  );
}

.calendar__daycol.is-today {
  background-color: rgba(76, 95, 238, 0.04);
}

.event {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.event * {
  -webkit-user-select: none;
  user-select: none;
}

.event.is-dragging {
  cursor: grabbing;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  opacity: 0.92;
}

.event__handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 7px;
  cursor: ns-resize;
  touch-action: none;
}

.event__handle--top {
  top: 0;
}

.event__handle--bottom {
  bottom: 0;
}

.event__meta {
  display: block;
  font-weight: 500;
  opacity: 0.85;
  font-size: 10.5px;
}

.event__desc {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-style: italic;
  opacity: 0.85;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event--dansk { background: var(--fag-dansk); }
.event--geografi { background: var(--fag-geografi); }
.event--matematik { background: var(--fag-matematik); }
.event--engelsk { background: var(--fag-engelsk); }
.event--fysik { background: var(--fag-fysik); }
.event--historie { background: var(--fag-historie); }
.event--idraet { background: var(--fag-idraet); }
.event--kristendom { background: var(--fag-kristendom); }
.event--biologi { background: var(--fag-biologi); color: var(--text-primary); }
.event--tysk { background: var(--fag-tysk); }
.event--valgfag { background: var(--fag-valgfag); }
.event--natur { background: var(--fag-natur); }
.event--musik { background: var(--fag-musik); }
.event--billedkunst { background: var(--fag-billedkunst); }
.event--uu { background: var(--fag-uu); color: var(--text-primary); }

/* ---------- Month view ---------- */

.monthgrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-width: 900px;
}

.monthgrid__weekday {
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 2;
}

.monthgrid__cell {
  min-height: 112px;
  border-left: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-panel);
}

.monthgrid__cell.is-outside {
  background: var(--bg-app);
}

.monthgrid__cell.is-outside .monthgrid__date {
  color: var(--text-muted);
}

.monthgrid__cell.is-today {
  background: rgba(76, 95, 238, 0.05);
}

.monthgrid__date {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.monthgrid__cell.is-today .monthgrid__date {
  color: var(--brand-blue);
}

.monthgrid__event {
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.monthgrid__more {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==================================================================
   SFO parent portal
   ================================================================== */

.sfo-main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 60px;
}

.sfo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.sfo-header h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

.sfo-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.childswitcher {
  display: flex;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px;
}

.childswitcher__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.childswitcher__item:hover {
  color: var(--text-primary);
}

.childswitcher__item.is-active {
  background: var(--bg-app);
  color: var(--text-primary);
}

.childswitcher__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sfo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

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

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card--action {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
}

.card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.card__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.card__icon--red { background: linear-gradient(135deg, #e2685c, #c6473b); }
.card__icon--orange { background: linear-gradient(135deg, #ffb057, #ff9b3a); }
.card__icon--blue { background: linear-gradient(135deg, var(--brand-cyan), var(--brand-blue)); }

.card h3 {
  margin: 0;
  font-size: 15px;
}

.card p.card__desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.card__cta {
  margin-top: auto;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--bg-app);
  border: 1px solid var(--border-color-strong);
  color: var(--text-primary);
  cursor: pointer;
}

.card--action:hover .card__cta {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}

.sfo-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.sfo-panel__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sfo-panel__header h2 {
  margin: 0;
  font-size: 15px;
}

.sfo-panel__header span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.weekstatus {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.weekstatus__day {
  padding: 16px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weekstatus__day:last-child {
  border-right: none;
}

/* ==================================================================
   Mobil — Ugestatus (SFO) stacker alle 5 dage lodret i stedet for
   at klemme dem ind i et 5-kolonners grid under 700px
   ================================================================== */

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

  .weekstatus__day {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .weekstatus__day:last-child {
    border-bottom: none;
  }
}

.weekstatus__day.is-today {
  background: rgba(76, 95, 238, 0.05);
}

.weekstatus__date {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  width: fit-content;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill--ok { background: rgba(78, 158, 110, 0.12); color: #3d7f57; }
.status-pill--sick { background: rgba(198, 91, 78, 0.12); color: #a8453a; }
.status-pill--holiday { background: rgba(224, 173, 46, 0.15); color: #8a6a1c; }
.status-pill--pending { background: rgba(154, 162, 181, 0.15); color: var(--text-secondary); }

.weekstatus__detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.weekstatus__edit {
  margin-top: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-blue);
  align-self: flex-start;
}

.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field select,
.field input,
.field textarea {
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-app);
  resize: vertical;
}

.field--full {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-blue);
  cursor: pointer;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 2px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s ease;
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.is-selected {
  border-color: var(--bg-panel);
  box-shadow: 0 0 0 2px var(--brand-blue);
}

.pickup-options {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
}

.pickup-option {
  flex: 1;
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.pickup-option svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.pickup-option.is-selected {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: rgba(76, 95, 238, 0.06);
}

.formactions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.holiday-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.holiday-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.holiday-entry__text {
  font-size: 13px;
  color: var(--text-primary);
}

.holiday-entry__text span {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.holiday-entry__remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #a8453a;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.holiday-entry__remove:hover {
  background: rgba(198, 91, 78, 0.12);
}

.event-view {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-view__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.event-view__row--notes {
  flex-direction: column;
  gap: 6px;
}

.event-view__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.event-view__value {
  font-size: 13.5px;
  color: var(--text-primary);
  text-align: right;
}

.event-view__row--notes .event-view__value {
  text-align: left;
  line-height: 1.5;
}

/* ==================================================================
   Event modal (lesson detail / description)
   ================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 34, 51, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 420px;
  max-width: 100%;
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal--wide {
  width: 560px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal__header h3 {
  margin: 0;
  font-size: 16px;
}

.modal__close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.modal__close:hover {
  background: var(--bg-app);
}

.modal__error {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #a8453a;
}

.modal__error[hidden] {
  display: none;
}

.modal__body textarea {
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-app);
  resize: vertical;
  min-height: 90px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
}

/* ==================================================================
   Elever + Personale (person list + detail) — shared row/list pattern
   ================================================================== */

.studentlist,
.stafflist {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.studentrow,
.staffrow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.studentrow:last-child,
.staffrow:last-child {
  border-bottom: none;
}

.studentrow:hover,
.staffrow:hover {
  background: var(--bg-app);
}

.studentrow__avatar,
.staffrow__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-app);
}

.studentrow__name,
.staffrow__name {
  flex: 1;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.studentrow__age {
  display: block;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.studentrow__class,
.staffrow__role {
  width: 150px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.studentrow__chevron,
.staffrow__chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

.studentrow__chevron svg,
.staffrow__chevron svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.studentlist__empty,
.stafflist__empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.student-photo {
  position: relative;
  width: 88px;
  height: 88px;
  align-self: center;
}

.student-photo img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
}

.student-photo__edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--bg-panel);
  background: var(--brand-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-photo__edit:hover {
  background: #3f50d9;
}

.student-photo__edit svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* ==================================================================
   Beskeder (messaging — Instagram DM-inspired layout)
   ================================================================== */

.msg-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.msg-sidebar {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
}

.msg-sidebar__header {
  padding: 18px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.msg-sidebar__header h2 {
  margin: 0;
  font-size: 16px;
}

.msg-compose-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.msg-compose-btn:hover {
  background: var(--bg-app);
  color: var(--text-primary);
}

.msg-compose-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.msg-search {
  margin: 0 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
}

.msg-search svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.msg-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  width: 100%;
}

.msg-conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
}

.msg-conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.msg-conversation:hover {
  background: var(--bg-app);
}

.msg-conversation.is-active {
  background: rgba(76, 95, 238, 0.08);
}

.msg-conversation__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-conversation__body {
  min-width: 0;
  flex: 1;
}

.msg-conversation__name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.msg-conversation__preview {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-conversation__time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.msg-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.msg-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
}

.msg-empty__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.msg-empty__icon svg {
  width: 34px;
  height: 34px;
  stroke: var(--text-primary);
  fill: none;
  stroke-width: 1.6;
}

.msg-empty h3 {
  margin: 0;
  font-size: 20px;
}

.msg-empty p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13.5px;
  max-width: 280px;
}

.msg-empty .btn {
  margin-top: 8px;
}

.msg-thread__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.msg-thread__back {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.msg-thread__back:hover {
  background: var(--bg-app);
}

.msg-thread__back svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.msg-thread__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-thread__name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.msg-thread__subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.msg-thread__messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}

.msg-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
}

.msg-bubble--them {
  align-self: flex-start;
  background: var(--bg-app);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-bubble--own {
  align-self: flex-end;
  background: var(--brand-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bubble__time {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  opacity: 0.75;
}

.msg-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.msg-composer input {
  flex: 1;
  border: 1px solid var(--border-color-strong);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-app);
}

.msg-composer button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  background: var(--brand-blue);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.msg-composer button:hover {
  background: #3f50d9;
}

.msg-composer button:disabled {
  opacity: 0.5;
  cursor: default;
}

.msg-recipient-search {
  margin: 16px 20px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
}

.msg-recipient-search svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.msg-recipient-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  width: 100%;
}

.msg-recipient-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 12px 18px;
}

.msg-recipient {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.msg-recipient:hover {
  background: var(--bg-app);
}

.msg-recipient__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-recipient__body {
  min-width: 0;
  flex: 1;
}

.msg-recipient__name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.msg-recipient__subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.msg-recipient__existing {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-blue);
  flex-shrink: 0;
}

/* ==================================================================
   Mobil — Skema-toolbar (klassetrin, dato-navigation, visning) stacker
   lodret i stedet for side om side under 700px
   ================================================================== */

@media (max-width: 700px) {
  .toolbar {
    padding: 10px 16px;
  }

  .toolbar__row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar__spacer {
    display: none;
  }

  .toolbar .select-wrap .select {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar .datenav {
    justify-content: center;
  }

  .toolbar__range-wrap {
    display: flex;
    justify-content: center;
  }
}

/* ==================================================================
   Mobil — SFO-hurtighandlinger (Afhentningstid/Sygemeld/Meld ferie)
   stacker lodret under 700px
   ================================================================== */

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

/* ==================================================================
   Mobil — Beskeder: samtaleliste og tråd vises én ad gangen,
   ikke side om side, under 700px
   ================================================================== */

@media (max-width: 700px) {
  .msg-sidebar {
    width: 100%;
    border-right: none;
  }

  .msg-thread {
    display: none;
  }

  .msg-thread__back {
    display: flex;
  }

  .msg-layout.is-thread-open .msg-sidebar {
    display: none;
  }

  .msg-layout.is-thread-open .msg-thread {
    display: flex;
    width: 100%;
  }
}
