:root {
  --app-primary: #7a2e5a;
  --app-primary-dark: #5e2245;
  --app-bg: #f6f2f4;
  --bs-primary: var(--app-primary);
  --bs-primary-rgb: 122, 46, 90;
  --bs-link-color: var(--app-primary);
  --bs-link-hover-color: var(--app-primary-dark);
}

html, body {
  min-height: 100%;
  background: var(--app-bg);
  /* Native-app feel: no tap flash, no rubber-band text selection on UI */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-dark);
  --bs-btn-hover-border-color: var(--app-primary-dark);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
}

/* ---------- Login ---------- */
.login-page {
  background: linear-gradient(160deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);
}

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 1.25rem;
}

.captcha-img {
  height: 48px;
  width: auto;
  user-select: none;
}

.captcha-input {
  min-width: 0;
}

/* ---------- Backoffice layout ---------- */
.app-navbar {
  background: var(--app-primary);
  padding-top: env(safe-area-inset-top);
}

/* The page's name in the bar while the menu is folded (templates/layout.html); then the page's own heading
   (h1.page-title) is not shown */
.navbar-page-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 13rem);  /* clear of the brand and the menu button */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  pointer-events: none;
}

@media (max-width: 991.98px) {
  .app-main h1.page-title {
    display: none;
  }
}

.app-main {
  padding-top: calc(56px + env(safe-area-inset-top) + 1rem);
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* The agreement (templates/agreement.html): the text scrolls inside its card, the approval form stays below */
.agreement-main {
  max-width: 52rem;
}

.agreement-scroll {
  max-height: 55vh;
  overflow-y: auto;
}

.agreement-text h3 {
  font-size: 1.05rem;
  margin-top: 1.25rem;
}

/* Rapporter (templates/reports.html) */
.report-sum {
  border-top: 2px solid var(--bs-border-color);
}

.report-day th {
  background: var(--app-bg);
  font-weight: 600;
}

.report-bar {
  display: inline-block;
  width: 4rem;
  height: 0.5rem;
  margin-right: 0.35rem;
  border-radius: 0.25rem;
  vertical-align: middle;
  background: linear-gradient(to right, var(--app-primary) var(--load), var(--bs-secondary-bg) var(--load));
}

.report-footer dt {
  font-weight: 600;
}

@media print {
  .app-main {
    padding: 0;
  }
  .app-navbar {
    display: none;
  }
  .report-sheet {
    box-shadow: none !important;
  }
  .report-sheet .card-body {
    padding: 0;
  }
  .report-bar {
    print-color-adjust: exact;
  }
  .agreement-scroll {
    max-height: none;
    overflow: visible;
  }
}

.dropdown-menu {
  --bs-dropdown-link-active-bg: var(--app-primary);
}

/* Anchored rows (#r12) must not end up under the fixed menu */
.range-row {
  scroll-margin-top: calc(56px + env(safe-area-inset-top) + 1rem);
}

.range-main {
  flex: 1 1 12rem;
  min-width: 0;
}

.prio-input {
  width: 4.5rem;
}

/* A linked add-on (Tilläggsbehandling) under its treatment */
.range-addon {
  padding-left: 1.75rem;
  background: var(--app-bg);
  border-left: 3px solid var(--app-primary);
}

.range-addon-arrow {
  color: var(--app-primary);
  font-size: 1.1rem;
  margin-left: -0.9rem;
}

.range-addon-label {
  color: var(--app-primary);
  font-weight: 600;
}

.btn-outline-primary {
  --bs-btn-color: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-bg: var(--app-primary-dark);
  --bs-btn-active-border-color: var(--app-primary-dark);
}

/* ---------- Start ---------- */
.stat-tile {
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 0.5rem;
  padding: 0.6rem 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------- Bokningar: the top (toolbar, search, klotterplank) ---------- */
/* Small screens: the toolbar, then search and klotterplank when unfolded. */
.cal-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0 1.5rem;
  margin-bottom: 1.25rem;  /* space down to the calendar */
}

.cal-top-side .notice-board {
  margin-top: 0.5rem;
}

/* Wider: toolbar and search on the left, the klotterplank on the right from the top */
@media (min-width: 768px) {
  .cal-top {
    grid-template-columns: minmax(0, 1fr) 17rem;
  }
  .cal-top-main {
    grid-column: 1;
    grid-row: 1;
  }
  .cal-top-side {
    grid-column: 2;
    grid-row: 1;
  }
  .cal-top-side .notice-board {
    margin-top: 0;
  }
}

@media (min-width: 1200px) {
  .cal-top {
    grid-template-columns: minmax(0, 1fr) 20rem;
  }
}

.cal-search {
  max-width: 44rem;
}

/* ---------- Bokningar: klotterplank ---------- */
.notice-board {
  background: #fff8d6;
  border: 1px solid #f0e2a0;
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem 0.5rem;
}

.notice-board-title {
  font-size: 0.8rem;
  font-weight: 600;
}

.notice-board-save {
  font-size: 0.8rem;
}

.notice-board-text {
  background: transparent;
  border-color: #eadb93;
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: pre-wrap;
  resize: vertical;
  min-height: 3.5rem;
  max-height: 12rem;
}

.notice-board-text:focus {
  background: #fffdf0;
}

/* ---------- Bokningar: calendar ---------- */
.cal-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.cal-grid th,
.cal-grid td {
  border-bottom: 1px solid #eee;
  border-left: 1px solid #eee;
  padding: 0;
}

.cal-grid thead th {
  position: sticky;
  top: calc(56px + env(safe-area-inset-top));
  z-index: 2;
  background: #fff;
  border-bottom: 2px solid #ddd;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.15;
  padding: 0.3rem 0.1rem;
  overflow-wrap: anywhere;
}

.cal-grid thead th small {
  display: block;
  font-weight: normal;
  color: inherit;
  opacity: 0.75;
}

/* Sundays and public holidays */
.cal-grid thead th.red {
  background: #f8d7da;
  color: #842029;
}

.cal-grid thead th.today {
  box-shadow: inset 0 -3px 0 var(--app-primary);
}

/* The user is a room */
.cal-grid thead th.room {
  box-shadow: inset 0 3px 0 #00897b;
  color: #00695c;
}

.cal-grid thead th.room.red {
  color: #842029;
}

.cal-room-badge {
  background: #00897b;
}

/* Week view: the day headers go to "Dag – alla" for that day (the whole cell is the link) */
.cal-head-link {
  display: block;
  margin: -0.3rem -0.1rem;
  padding: 0.3rem 0.1rem;
  color: inherit;
  text-decoration: none;
}

.cal-head-link:hover,
.cal-head-link:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  text-decoration: underline;
}

/* Week navigation: wide arrows; the week button opens the calendar (date input under it) */
.cal-week-arrow {
  min-width: 3.25rem;
  font-size: 1.25rem;
  line-height: 1.2;
}

.cal-week-pick {
  position: relative;
}

.cal-pick-icon {
  margin-left: 0.4rem;
  vertical-align: -0.1em;
  opacity: 0.75;
}

.cal-week-date {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;  /* browsers without showPicker(): turned on in calendar.js so a tap opens it */
  border: 0;
}

.cal-grid .cal-time {
  width: 3rem;
  border-left: 0;
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--bs-secondary-color);
  text-align: right;
  padding-right: 0.3rem;
  vertical-align: top;
}

.cal-grid tr.hour > * {
  border-top: 1px solid #c8c8c8;
}

.cal-grid tr.hour .cal-time {
  font-weight: 600;
  color: var(--bs-body-color);
}

/* The schema colour as a stripe on the left 10% of the slot; the rest is white */
.cal-slot {
  height: 1.5rem;
  background: linear-gradient(to right, var(--scheme-color, transparent) 10%, #fff 10%);
}

.cal-slot a {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 1.5rem;
}

@media (hover: hover) {
  .cal-slot:hover {
    box-shadow: inset 0 0 0 2px var(--app-primary);
  }
}

/* "Ej bokningsbar" and "Lunch" can't be clicked */
.cal-slot.blocked {
  cursor: not-allowed;
}

/* Free time in "Rabatterad tid" (Schema -> Rabatterad tid): the type's bar stays on the left */
.cal-slot[data-discount] {
  background: linear-gradient(to right, var(--scheme-color, transparent) 10%, var(--discount-color) 10%);
}

@media (hover: hover) {
  .cal-slot.blocked:hover {
    box-shadow: none;
  }
}

/* Each booking is a framed box, 1px inside its cells, so adjacent bookings stay apart */
.cal-booking {
  position: relative;
  vertical-align: top;
}

.cal-booking-box {
  position: absolute;
  inset: 1px;
  overflow: hidden;
  background: var(--booking-color, #f3d9e7);
  color: var(--booking-text, #000);
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}

.jump-menu {
  max-height: 20rem;
  overflow-y: auto;
}

/* A column from the top: browsers centre a button's content vertically otherwise */
.cal-booking-btn {
  all: unset;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0.15rem 0.3rem;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.2;
}

.cal-booking-btn:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: -2px;
}

/* Name and treatment wrap onto more lines (long words too, in narrow columns: a few letters per line)
   instead of being cut to "Ma…"; what doesn't fit in the booking's height is hidden by .cal-booking-box. */
.cal-booking-name,
.cal-booking-info {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}

.cal-booking-name {
  font-weight: 600;
}

/* Number of bookings for the customer and the web icon, above the name */
.cal-booking-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  line-height: 1.1;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
}

.web-icon,
.message-icon,
.confirmed-icon {
  vertical-align: -0.1em;
}

/* "Bekräfta köp": a confirmed (paid, locked) booking has a green frame in the calendar */
.cal-booking-box.confirmed {
  border: 2px solid #198754;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* ... and a notice in the booking window */
.booking-modal-confirmed {
  color: var(--bs-success-text-emphasis);
}

/* Booking window */
.booking-modal-time {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.booking-modal-web {
  color: var(--app-primary);
}

.booking-modal-details dt {
  font-weight: normal;
  color: var(--bs-secondary-color);
}

.cal-booking-info {
  opacity: 0.85;
}

/* Day view: one column per user, scrolls sideways on small screens */
.cal-scroll {
  overflow-x: auto;
}

.cal-day {
  min-width: var(--cal-min-width);  /* one column per user, from bookings_calendar.html */
}

.cal-day thead th {
  position: static;
}

/* ---------- Bokningar: the calendar's Läge (static/js/calendar.js) ---------- */
/* The button in the empty top left cell */
.cal-grid thead th.cal-mode-cell {
  padding: 0.15rem;
  text-align: center;
  vertical-align: middle;
}

.cal-mode-btn {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0.15rem 0;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.35rem;
  background: var(--app-bg, #f6f6f6);
  color: var(--app-primary);
  cursor: pointer;
  line-height: 1.05;
}

.cal-mode-btn:hover {
  border-color: var(--app-primary);
}

.cal-mode-btn:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: 1px;
}

.cal-mode-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cal-mode-number {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Läge 2, Överblick: the whole calendar on the screen. The row height is set by calendar.js
   (--cal-row: what fits under the header); only the bookings' names, on one line. */
.cal-mode-2 .cal-day {
  min-width: 0;
}

.cal-mode-2 .cal-grid thead th {
  font-size: 0.72rem;
  padding: 0.15rem 0.05rem;
}

.cal-mode-2 .cal-slot,
.cal-mode-2 .cal-slot a {
  height: var(--cal-row, 0.5rem);
  min-height: 0;
}

.cal-mode-2 .cal-grid tbody tr {
  height: var(--cal-row, 0.5rem);  /* also rows where every column is a booking */
}

/* The time's line is the row's height, the text may stick out of it */
.cal-mode-2 .cal-grid tbody .cal-time {
  font-size: 0.6rem;
  line-height: var(--cal-row, 0.5rem);
  vertical-align: top;
}

/* Only the whole hours' times (the others would overlap) */
.cal-mode-2 .cal-grid tbody tr:not(.hour) .cal-time {
  font-size: 0;
}

.cal-mode-2 .cal-booking-info,
.cal-mode-2 .cal-booking-count {
  display: none;
}

/* The icons (bekräftad, hemsidan, meddelande) on the name's line */
.cal-mode-2 .cal-booking-btn {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0 0.2rem;
  font-size: 0.65rem;
  line-height: 1.1;
}

.cal-mode-2 .cal-booking-meta {
  flex-shrink: 0;
  gap: 0.1rem;
  font-size: inherit;
  line-height: inherit;
}

.cal-mode-2 .cal-booking-meta svg {
  width: 10px;
  height: 10px;
}

.cal-mode-2 .cal-booking-name {
  min-width: 0;
}

.cal-mode-2 .cal-booking-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Läge 3, Bred: wider bookings, rows 25 % lower. The calendar is a box as high as the screen under the menu bar
   that scrolls both ways: in it the header (day and date) stays at the top and the times on the left.
   (A box that only scrolls sideways would stop the header sticking to the page.) */
.cal-mode-3 {
  overflow: auto;
  max-height: calc(100vh - 56px - env(safe-area-inset-top));
  max-height: calc(100dvh - 56px - env(safe-area-inset-top));
  overscroll-behavior: contain;
}

.cal-mode-3 .cal-grid {
  min-width: calc(3rem + var(--cal-columns, 7) * 7rem);
}

.cal-mode-3 .cal-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* The times stay on the left while scrolling sideways; the top left cell (Läge) above both */
.cal-mode-3 .cal-grid tbody .cal-time {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}

.cal-mode-3 .cal-grid thead .cal-time {
  left: 0;
  z-index: 3;
}

.cal-mode-3 .cal-grid tbody tr,
.cal-mode-3 .cal-slot,
.cal-mode-3 .cal-slot a {
  height: 1.125rem;  /* 1.5rem - 25 % */
  min-height: 0;
}

.cal-mode-3 .cal-booking-btn {
  padding: 0.05rem 0.3rem;
  line-height: 1.1;
}

.cal-mode-3 .cal-grid tbody .cal-time {
  font-size: 0.65rem;
  line-height: 1.1;
}

.cal-day thead th a {
  color: inherit;
}

/* ---------- Bokningar: form and print ---------- */
.booking-summary dt {
  font-weight: normal;
  color: var(--bs-secondary-color);
}

.booking-summary dd {
  font-weight: 600;
}

.booking-swatch {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 0.2em;
  border: 1px solid rgba(0, 0, 0, 0.15);
  vertical-align: -0.05em;
}

#customer-matches {
  max-height: 16rem;
  overflow-y: auto;
}

.print-page {
  background: #fff;
}

/* ---------- Kundregister ---------- */
.letter-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.letter-filter .btn {
  min-width: 2.1rem;
}

.history-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Mail/sms to customers: the message as it will look, and the recipients */
.message-preview {
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #222;
  overflow-wrap: anywhere;
}

.sms-preview {
  display: inline-block;
  max-width: 22rem;
  background: #e9e9eb;
  border-radius: 1rem;
  padding: 0.6rem 0.85rem;
}

.recipient-list {
  max-height: 24rem;
  overflow-y: auto;
}

/* ---------- Schema grid ---------- */
.scheme [data-type="1"] { --scheme-color: #8fd19e; } /* Bokningsbar */
.scheme [data-type="2"] { --scheme-color: #ffe08a; } /* Ej bokningsbar från hemsidan */
.scheme [data-type="3"] { --scheme-color: #c4c4c4; } /* Ej bokningsbar */
.scheme [data-type="4"] { --scheme-color: #9ec5fe; } /* Lunch */
.scheme [data-type="5"] { --scheme-color: #7fd6c2; } /* Angiven bokningsbar */
.scheme [data-type="6"] { --scheme-color: #d3aef5; } /* Drop-In */
:root { --discount-color: #ffb877; } /* Rabatterad tid: also marked on Schema and the Bokningar calendars */
.scheme-discount [data-type="1"] { --scheme-color: var(--discount-color); }

.discount-swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border-radius: 0.2em;
  vertical-align: -0.05em;
  background: var(--discount-color);
}

.scheme-swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border-radius: 0.2em;
  vertical-align: -0.05em;
  background: var(--scheme-color);
}

.scheme-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
}

.scheme-grid th,
.scheme-grid td {
  border-bottom: 1px solid #eee;
  border-left: 1px solid #eee;
}

.scheme-grid thead th {
  position: sticky;
  top: calc(56px + env(safe-area-inset-top));
  z-index: 1;
  background: #fff;
  border-bottom: 2px solid #ddd;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.15;
  padding: 0.3rem 0;
}

.scheme-grid thead th small {
  display: block;
  font-weight: normal;
  color: var(--bs-secondary-color);
}

.scheme-grid thead th.today {
  color: var(--app-primary);
}

/* Sundays and public holidays, as in Bokningar (.cal-grid) */
.scheme-grid thead th.red {
  background: #f8d7da;
  color: #842029;
}

.scheme-grid thead th.red small {
  color: inherit;
  opacity: 0.75;
}

.scheme-grid .scheme-time {
  width: 3rem;
  border-left: 0;
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--bs-secondary-color);
  text-align: right;
  padding-right: 0.3rem;
  vertical-align: top;
}

.scheme-grid tr.hour > * {
  border-top: 1px solid #c8c8c8;
}

.scheme-grid tr.hour .scheme-time {
  font-weight: 600;
  color: var(--bs-body-color);
}

.scheme-grid td {
  height: 1.5rem;
  cursor: pointer;
  background: var(--scheme-color, transparent);
}

.scheme-grid td[data-booked] {
  cursor: not-allowed;
  background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.28) 0 3px, transparent 3px 7px);
}

/* Open (bookable) time in "Rabatterad tid": its colour on the right part, the type's colour stays on the left */
.scheme-grid td[data-discount]:not([data-type="0"]):not([data-type="3"]):not([data-type="4"]):not([data-booked]) {
  background-image: linear-gradient(to right, transparent 55%, var(--discount-color) 55%);
}

@media (hover: hover) {
  .scheme-grid td:not([data-booked]):hover {
    box-shadow: inset 0 0 0 2px var(--app-primary);
  }
}

.logout-form .nav-link {
  background: none;
  border: 0;
  width: 100%;
  text-align: start;
}

/* Mobile: full-height slide-in menu with large touch targets */
@media (max-width: 991.98px) {
  .app-navbar .offcanvas {
    padding-top: env(safe-area-inset-top);
  }
  .app-navbar .offcanvas .nav-link {
    color: var(--bs-body-color);
    padding: 0.85rem 0.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
  }
  .app-navbar .offcanvas .nav-link.active {
    color: var(--app-primary);
    font-weight: 600;
  }
  .app-navbar .offcanvas .dropdown-menu {
    border: 0;
    padding: 0;
  }
  .app-navbar .offcanvas .dropdown-item {
    padding: 0.75rem 1.25rem;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
  }
  .logout-form {
    margin-top: 1rem;
  }
  .logout-form .nav-link {
    color: var(--bs-danger) !important;
  }
}

/* Desktop: inline menu */
@media (min-width: 992px) {
  .logout-form .nav-link {
    color: rgba(255, 255, 255, 0.75);
  }
  .logout-form .nav-link:hover {
    color: #fff;
  }
  /* The salong logged in to (layout.html), before "Logga ut" */
  .app-navbar .salong-current,
  .app-navbar .salong-switch > .nav-link {
    color: #fff;
  }
  .app-navbar .salong-current {
    cursor: default;
  }
}

/* ---------- Schema -> Semester (app/absence.py): the day's colour ---------- */
/* Only the background of the day's heading in Bokningar and Schema, and the day in the week picker. */
:root {
  --absence-1: #ffd966;  /* Semester */
  --absence-2: #a8dca8;  /* Ledig */
  --absence-3: #b9c4f2;  /* Jobbar på annan salong */
}
.absence-1 { --absence-color: var(--absence-1); }
.absence-2 { --absence-color: var(--absence-2); }
.absence-3 { --absence-color: var(--absence-3); }
.cal-grid thead th.absence-1, .cal-grid thead th.absence-2, .cal-grid thead th.absence-3,
.scheme-grid thead th.absence-1, .scheme-grid thead th.absence-2, .scheme-grid thead th.absence-3 {
  background: var(--absence-color);
}

.absence-swatch,
.date-pop-swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border-radius: 0.2em;
  vertical-align: -0.05em;
  background: var(--absence-color);
}

/* The Semester page: months side by side */
.absence-months {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem 1.5rem;
  user-select: none;
  -webkit-user-select: none;
}

.absence-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 2px;
}

.absence-grid th {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--bs-secondary-color);
  text-align: center;
}

.absence-grid .absence-weeknr {
  width: 1.6rem;
  font-size: 0.65rem;
}

.absence-grid td {
  height: 2.1rem;
  text-align: center;
  font-size: 0.85rem;
  border-radius: 0.3rem;
  background: #fff;
  border: 1px solid #e6e6e6;
  cursor: pointer;
}

.absence-grid td.empty {
  background: transparent;
  border: 0;
  cursor: default;
}

.absence-grid td.red { color: #b02a37; }
.absence-grid td.today { box-shadow: inset 0 -3px 0 var(--app-primary); font-weight: 600; }
.absence-grid td[data-type="1"] { background: var(--absence-1); border-color: var(--absence-1); }
.absence-grid td[data-type="2"] { background: var(--absence-2); border-color: var(--absence-2); }
.absence-grid td[data-type="3"] { background: var(--absence-3); border-color: var(--absence-3); }

@media (hover: hover) {
  .absence-grid td[data-date]:hover {
    outline: 2px solid var(--app-primary);
    outline-offset: -2px;
  }
}

/* ---------- The week/day picker (static/js/datepicker.js) ---------- */
.date-pop {
  position: absolute;
  z-index: 1070;
  width: 17.5rem;
  max-width: calc(100vw - 16px);
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
}

.date-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.date-pop-title {
  font-weight: 600;
}

.date-pop-nav {
  border: 0;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.1rem 0.7rem;
  border-radius: 0.3rem;
  color: var(--app-primary);
}

.date-pop-nav:hover {
  background: rgba(0, 0, 0, 0.06);
}

.date-pop-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 2px;
}

.date-pop-grid th {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--bs-secondary-color);
  text-align: center;
}

.date-pop-grid thead th:first-child {
  width: 1.8rem;
}

.date-pop-day,
.date-pop-week {
  width: 100%;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.3rem;
  background: var(--absence-color, transparent);
  font-size: 0.85rem;
  color: var(--bs-body-color);
}

.date-pop-week {
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  background: none;
}

.date-pop-day.other { opacity: 0.45; }
/* Sundays and public holidays, as the calendar headings; a Semester colour wins (set by .absence-N) */
.date-pop-day.red { background: var(--absence-color, #f8d7da); color: #842029; }
.date-pop-day.today { box-shadow: inset 0 0 0 1px var(--app-primary); font-weight: 600; }
.date-pop-day.selected,
.date-pop-selected-week .date-pop-day { box-shadow: inset 0 0 0 2px var(--app-primary); }
.date-pop-selected-week .date-pop-week { color: var(--app-primary); font-weight: 600; }

.date-pop-day:hover,
.date-pop-week:hover,
.date-pop-day:focus-visible,
.date-pop-week:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: -2px;
}

.date-pop-weeknr {
  font-size: 0.7rem;
}

.date-pop-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

.date-pop-legend .date-pop-swatch {
  margin-right: 0.3rem;
}