/* #region Reset & Variables */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 268px;
  --header-h: 60px;
  --hour-h: 64px;
  --time-col-w: 48px;
  --day-start: 8;
  --day-end: 19;
  --col-bg: #fff;
  --border: #e2e8f0;
  --muted: #94a3b8;
  --text: #0f172a;
  --text-2: #475569;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --hover: #f8fafc;
  --sidebar-bg: #fff;
  --app-bg: #f1f5f9;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --today-bg: #eff6ff;
  --font: 'Inter', system-ui, sans-serif;
}

:root.dark-mode {
  color-scheme: dark;
  --col-bg: #121212;
  --border: #27272a;
  --muted: #a1a1aa;
  --text: #fafafa;
  --text-2: #d4d4d8;
  --accent: #3b82f6;
  --accent-light: #1e3a8a;
  --hover: #27272a;
  --sidebar-bg: #09090b;
  --app-bg: #000000;
  --today-bg: #1f2937;
  --shadow: 0 1px 3px rgba(0,0,0,.8), 0 1px 2px rgba(0,0,0,.6);
  --shadow-md: 0 4px 16px rgba(0,0,0,.8);
}
/* #endregion */

/* ── Theme Transition (Smooth Dark / Light Mode Animation) ── */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.28s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
  transition: background-color 0.28s ease, border-color 0.28s ease, color 0.28s ease, box-shadow 0.28s ease, fill 0.28s ease, stroke 0.28s ease !important;
  transition-delay: 0s !important;
}

html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--app-bg);
  color: var(--text);
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* #region Sidebar */
/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  z-index: 10;
  position: relative;
  transition: width .22s ease, min-width .22s ease, border-color .22s ease;
}
#sidebar.desktop-collapsed {
  width: 0;
  min-width: 0;
  border-right-color: transparent;
}

#logo {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
#logo svg { flex-shrink: 0; }
#logo .logo-branch { display: none; }

#search-wrap {
  padding: 12px 12px 8px;
}
#search {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--hover);
  outline: none;
  transition: border-color .15s, background .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px 50%;
}
#search:focus { border-color: var(--accent); background: var(--col-bg); }

#resource-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}
#resource-list::-webkit-scrollbar { width: 4px; }
#resource-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.section-header {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  z-index: 1;
}
.section-header--with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-header--with-action .section-toggle {
  flex: 1;
}
.section-header-action {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 7px;
  margin-right: 12px;
  font-weight: 600;
  transition: all .15s ease;
}
.section-header-action:hover {
  background: var(--hover);
  color: var(--accent);
  border-color: var(--accent);
}
.group-subhdr {
  margin: 4px 8px 2px;
  padding: 5px 10px 5px 12px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2);
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--sidebar-bg);
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
}
.group-subhdr:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.group-subhdr:hover .group-all-badge { opacity: 1; }
.group-all-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
  background: var(--accent-light); color: var(--accent);
  opacity: 0; transition: opacity .15s;
}
.group-subhdr.all-active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.group-subhdr.all-active .group-all-badge {
  opacity: 1; background: rgba(255,255,255,.25); color: #fff;
}

.group-subhdr-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.group-subhdr-left .chevron {
  font-size: 8px;
  color: var(--muted);
  transition: transform .15s ease, color .15s ease;
}
.group-subhdr:hover .group-subhdr-left .chevron {
  color: var(--accent);
}
.group-subhdr.all-active .group-subhdr-left .chevron {
  color: rgba(255, 255, 255, 0.8);
}
.group-subitems {
  overflow: hidden;
}
.group-subitems.collapsed {
  display: none !important;
}

.section-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 4px;
  user-select: none;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.section-toggle .chevron {
  margin-left: 5px;
}
.section-toggle:hover { color: var(--text-2); }

.group-section-note {
  padding: 0 16px 5px 31px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  letter-spacing: .01em;
}

.section-items {
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.section-items.collapsed { max-height: 0 !important; }

.chevron {
  transition: transform 0.2s;
  font-size: 9px;
  color: var(--muted);
  display: inline-block;
}
.chevron.open { transform: rotate(90deg); }

.resource-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 8px;
  transition: background .1s;
  user-select: none;
  min-width: 0;
}
.resource-item:hover { background: var(--hover); }
.resource-item.active { background: var(--accent-light); }
.resource-item.active .ri-name { color: var(--accent); font-weight: 600; }

.resource-item.favorite-item {
  position: relative;
}
.resource-item.favorite-item .fav-delete-btn {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
  margin-left: auto;
  flex-shrink: 0;
}
.resource-item.favorite-item:hover .fav-delete-btn,
.resource-item.favorite-item:focus-within .fav-delete-btn {
  opacity: 0.7;
}
.resource-item.favorite-item .fav-delete-btn:hover {
  opacity: 1;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.favorite-empty-item {
  opacity: 0.8;
  border: 1px dashed var(--border);
}
.favorite-empty-item:hover {
  opacity: 1;
  border-color: var(--accent);
}

.favorite-add-row {
  padding: 2px 8px 6px;
}
.favorite-bottom-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s ease;
}
.favorite-bottom-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--hover);
}
.favorite-bottom-add-btn span {
  font-size: 13px;
  font-weight: 600;
}

.ri-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.ri-icon.groupe { background: #ede9fe; color: #7c3aed; }
.ri-icon.enseignant { background: #dcfce7; color: #16a34a; }
.ri-icon.salle { background: #fff7ed; color: #ea580c; }
.ri-icon.favori { background: #fef3c7; color: #d97706; }
html.dark-mode .ri-icon.favori { background: #78350f; color: #fbbf24; }

.ri-labels {
  flex: 1;
  min-width: 0;
}
.ri-name {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ri-source {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ri-badge {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.no-results {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* #endregion */

/* #region Main & Calendar Header */
/* ── Main area ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
  background: var(--app-bg);
}

/* ── Calendar header ── */
#cal-header {
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 20px 0;
  background: var(--col-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
#resource-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.willow-sync-status {
  flex: 0 0 auto;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.willow-sync-status[data-state="offline"],
.willow-sync-status[data-state="error"] { color: #a45b25; }
.willow-sync-status[data-state="ok"] { color: #23734b; }
:root.dark-mode .willow-sync-status[data-state="ok"] { color: #4ade80; }
:root.dark-mode .willow-sync-status[data-state="offline"],
:root.dark-mode .willow-sync-status[data-state="error"] { color: #fb923c; }
#willow-update-status { color: var(--muted); font-size: 11px; line-height: 1.35; }
#willow-update-status[hidden], #willow-update-reload[hidden], #willow-update-retry[hidden] { display: none; }
#willow-update-reload, #willow-update-retry {
  display: block; margin: 6px auto 0; padding: 5px 9px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--col-bg); color: var(--text); font: inherit; cursor: pointer;
}
#willow-update-reload:hover { background: var(--hover); }
#willow-update-retry:hover { background: var(--hover); }
.willow-update-details { color: var(--muted); font-size: 11px; max-width: 100%; }
.willow-update-details summary { cursor: pointer; }
.willow-update-details pre { overflow: auto; max-height: 180px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; }
.week-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
@media (min-width: 769px) {
  #resource-title {
    flex: 1 1 auto;
    min-width: 0;
  }
  .week-nav,
  .theme-new .week-nav {
    margin-left: auto;
    justify-content: flex-end;
    flex: 0 0 auto;
  }
  .week-nav > * {
    flex-shrink: 0;
  }
  .week-label,
  .theme-new .week-label {
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    flex: 0 0 220px !important;
    text-align: center;
    box-sizing: border-box;
  }
}
.week-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  min-width: 200px;
  text-align: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--col-bg);
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.week-label:hover { background: var(--hover); }
.week-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--col-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background .1s, border-color .1s;
  font-size: 14px;
}
.nav-btn:hover { background: var(--hover); border-color: #cbd5e1; }
.today-btn {
  padding: 0 12px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--col-bg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-2);
  transition: background .1s;
}
.today-btn:hover { background: var(--hover); }

/* ── Empty/welcome state ── */
#welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}
#welcome svg { opacity: .3; }
#welcome h2 { font-size: 17px; font-weight: 600; color: var(--text-2); }
#welcome p { font-size: 14px; }

/* #endregion */

/* #region Calendar Grid */
/* ── Calendar grid ── */
#calendar {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--app-bg);
}

#days-header {
  display: grid;
  background: var(--col-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.day-head {
  padding: 10px 8px;
  text-align: center;
  border-left: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}
.day-head:first-child { border-left: none; }
.day-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.day-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-top: 2px;
}
.day-head.today .day-num {
  color: var(--accent);
}
.day-head.today .day-name {
  color: var(--accent);
}
.day-head-arrow {
  display: none;
}
.day-head-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#grid-scroll {
  flex: 1;
  overflow: hidden;
}
#grid-scroll::-webkit-scrollbar { width: 6px; }
#grid-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#grid {
  display: grid;
  position: relative;
}
.time-col {
  position: sticky;
  left: 0;
  background: var(--col-bg);
  z-index: 2;
  border-right: 1px solid var(--border);
}
.time-slot {
  height: var(--hour-h);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  position: relative;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.day-col {
  position: relative;
  border-left: 1px solid var(--border);
  background: var(--col-bg);
  overflow: hidden;
  min-width: 0;
}
.day-col.today { background: var(--today-bg); }
.hour-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}
.half-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed #f0f4f8;
  pointer-events: none;
}
:root.dark-mode .hour-line {
  border-top-color: #1e1e22;
}
:root.dark-mode .half-line {
  border-top-color: #161619;
}
:root.dark-mode .day-col {
  border-left-color: #1e1e22;
}

/* ── Empty-week Aperture invitation ── */
.empty-week-aperture {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  pointer-events: none;
}
.empty-week-aperture-card {
  position: relative;
  display: flex;
  width: min(1080px, 100%);
  min-height: auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px clamp(24px, 4vw, 46px);
  border: 1px solid rgba(37, 99, 235, .2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(239, 246, 255, .97), rgba(236, 253, 245, .97));
  box-shadow: 0 20px 50px rgba(15, 23, 42, .14);
  color: #0f2f52;
  text-align: center;
  pointer-events: auto;
}
:root.dark-mode .empty-week-aperture-card {
  border-color: rgba(96, 165, 250, .34);
  background: linear-gradient(135deg, rgba(20, 42, 76, .97), rgba(14, 62, 51, .97));
  color: #eff6ff;
}
.empty-week-aperture-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(100, 116, 139, .25);
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  color: #64748b;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}
:root.dark-mode .empty-week-aperture-close { background: rgba(15, 23, 42, .7); color: #cbd5e1; }
.empty-week-aperture-close:hover { color: var(--text); background: var(--col-bg); }
.empty-week-aperture-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: #2563eb;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
  color: #fff;
}
.empty-week-aperture-mark svg {
  width: 26px;
  height: 26px;
}
.empty-week-aperture-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 16px;
}
.empty-week-aperture-brand-name {
  margin: 0;
  color: #163e6d;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1;
}
:root.dark-mode .empty-week-aperture-brand-name { color: #eff6ff; }
.empty-week-aperture-eyebrow {
  margin-bottom: 2px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.empty-week-aperture-empty-title {
  width: 100%;
  flex: 0 0 auto;
  margin: 0 0 12px;
  color: #0f2f52;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: .98;
  text-align: center;
}
:root.dark-mode .empty-week-aperture-empty-title { color: #f8fafc; }
.empty-week-aperture-layout { display: grid; width: 100%; grid-template-columns: minmax(340px, 1.05fr) minmax(300px, .95fr); align-items: stretch; gap: clamp(28px, 5vw, 72px); }
.empty-week-aperture-copy { display: flex; height: 100%; min-height: 0; flex-direction: column; align-items: stretch; text-align: left; }
.empty-week-aperture-copy-content { display: flex; width: 100%; min-height: 0; flex: 1 1 auto; flex-direction: column; justify-content: center; }
.empty-week-aperture-copy h2 { max-width: 500px; font-size: clamp(22px, 2.6vw, 34px); letter-spacing: -.03em; }
.empty-week-aperture-copy > p:not(.empty-week-aperture-eyebrow) { max-width: 480px; margin-top: 10px; color: #47627f; font-size: 14px; line-height: 1.55; }
:root.dark-mode .empty-week-aperture-copy > p:not(.empty-week-aperture-eyebrow) { color: #cbd5e1; }
.empty-week-aperture-question-note { margin-top: 24px !important; color: #2563eb !important; font-size: 12px !important; font-weight: 700; }
.empty-week-aperture-visuals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: end; }
.empty-week-aperture-mini-choice { display: flex; flex-direction: column; gap: 9px; border: 1px solid rgba(37, 99, 235, .23); border-radius: 14px; background: rgba(255, 255, 255, .68); color: #183d65; cursor: pointer; font-family: var(--font); padding: 11px; text-align: left; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, opacity .2s ease; }
:root.dark-mode .empty-week-aperture-mini-choice { background: rgba(15, 23, 42, .56); color: #eff6ff; }
.empty-week-aperture-mini-choice:hover:not(:disabled) { border-color: #2563eb; box-shadow: 0 10px 22px rgba(37, 99, 235, .18); transform: translateY(-3px); }
.empty-week-aperture-mini-label { color: #2563eb; font-size: 13px; font-weight: 800; }
.empty-week-aperture-mini-grid { display: grid; grid-template-columns: 28px 1fr; height: clamp(250px, 40vh, 370px); }
.empty-week-aperture-mini-axis { position: relative; color: #7890a9; font-size: 9px; }
.empty-week-aperture-mini-axis span { position: absolute; right: 6px; transform: translateY(-50%); }
.empty-week-aperture-mini-track { position: relative; overflow: hidden; border: 1px solid #d8e5f1; border-radius: 8px; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(18.18% - 1px), #e7eef6 calc(18.18% - 1px), #e7eef6 18.18%); }
:root.dark-mode .empty-week-aperture-mini-track { border-color: #3a506b; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(18.18% - 1px), #2d4056 calc(18.18% - 1px), #2d4056 18.18%); }
.empty-week-aperture-event { position: absolute; left: 4px; right: 4px; display: flex; min-height: 20px; flex-direction: column; justify-content: center; overflow: hidden; padding: 3px 4px; border-left: 3px solid #2563eb; border-radius: 4px; background: #e7f0ff; color: #184b91; line-height: 1.1; }
.empty-week-aperture-event b { font-size: 8px; letter-spacing: .03em; text-transform: uppercase; }.empty-week-aperture-event em { overflow: hidden; font-size: 9px; font-style: normal; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.empty-week-aperture-card.is-voting .empty-week-aperture-mini-choice:not(.is-selected) { opacity: .38; }
.empty-week-aperture-card.is-voting .empty-week-aperture-mini-choice.is-selected { border-color: #078661; background: #e8f8ef; animation: emptyWeekVote .26s ease both; }
.empty-week-aperture-agreement { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: #e8f8ef; color: #087050 !important; font-weight: 700; }
.empty-week-aperture-agreement strong { flex: 0 0 auto; font-size: 30px; letter-spacing: -.05em; line-height: 1; }
.empty-week-aperture-agreement > span { display: flex; min-width: 0; flex-direction: column; font-size: 15px; line-height: 1.2; }
.empty-week-aperture-card.is-confirmed { animation: emptyWeekConfirmation .3s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes emptyWeekVote { from { transform: scale(.96); } to { transform: scale(1.03); } }
@keyframes emptyWeekConfirmation { from { opacity: .4; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.empty-week-aperture-cta {
  display: inline-flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 8px;
  margin-top: 21px;
  justify-content: center;
  padding: 16px 22px;
  border-radius: 9px;
  background: #2563eb;
  box-shadow: 0 7px 15px rgba(37, 99, 235, .25);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
}
.empty-week-aperture-cta:hover { background: #1d4ed8; transform: translateY(-1px); }
.empty-week-aperture-copy .empty-week-aperture-cta { flex: 0 0 auto; margin-top: auto; }
.empty-week-aperture-copy.is-confirmation-copy { align-items: stretch; text-align: center; }
.empty-week-aperture-copy.is-confirmation-copy .empty-week-aperture-agreement { text-align: left; }
.empty-week-aperture-copy.is-confirmation-copy > p:not(.empty-week-aperture-eyebrow) { max-width: 430px; }
.empty-week-aperture-copy.is-confirmation-copy .empty-week-aperture-copy-content { align-items: center; }
.empty-week-aperture-copy.is-completed-copy { align-items: center; justify-content: center; text-align: center; }
.empty-week-aperture-copy.is-completed-copy .empty-week-aperture-copy-content { flex: 0 0 auto; align-items: center; }
.empty-week-aperture-copy.is-completed-copy .empty-week-aperture-cta { margin-top: 21px; }

/* ── Events ── */
.cal-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 4px 7px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .12s ease, opacity .1s;
  border-left: 3px solid transparent;
  z-index: 1;
  min-height: 20px;
}
.cal-event::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
}
.cal-event:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-md);
  z-index: 5;
  overflow: visible;
}
.cal-event:hover::after {
  pointer-events: auto;
  top: -2px;
  bottom: -3px;
  left: -2px;
  right: -2px;
  z-index: 1;
}
.ev-type {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  opacity: .8;
  line-height: 1;
  margin-bottom: 2px;
}
.ev-title {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
  overflow: hidden;
}
.ev-loc {
  font-size: 10.5px;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.ev-prof {
  font-size: 10px;
  opacity: .75;
  word-break: break-word;
  overflow: hidden;
  margin-top: 1px;
}
.ev-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex-wrap: wrap;
  width: 100%;
}
.ev-group-badge {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  padding: 1.5px 4px;
  border-radius: 3px;
  white-space: nowrap;
}
.cal-event.ev-micro {
  padding: 0 4px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}
.cal-event.ev-micro .ev-footer {
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  flex-shrink: 0 !important;
  width: auto !important;
}
.cal-event.ev-micro .ev-title {
  font-size: 10.5px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
  flex-shrink: 1 !important;
  margin: 0 !important;
}
.cal-event.ev-micro .ev-loc {
  font-size: 9.5px !important;
  line-height: 1 !important;
  margin: 0 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
.cal-event.ev-micro .ev-prof,
.cal-event.ev-compact .ev-prof {
  display: none !important;
}
.cal-event.ev-compact {
  padding: 2px 5px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  overflow: hidden !important;
}
.cal-event.ev-compact .ev-title {
  font-size: 11px !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 0 2px 0 !important;
}
.cal-event.ev-standard .ev-meta {
  margin-top: auto !important;
}


/* Current time line */
#now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  z-index: 4;
  pointer-events: none;
}
#now-line::before {
  content: '';
  position: absolute;
  left: -4px; top: -4px;
  width: 10px; height: 10px;
  background: #ef4444;
  border-radius: 50%;
}
#now-line::after {
  content: '';
  position: absolute;
  left: 6px; top: -1px;
  right: 0; height: 2px;
  background: #ef4444;
}

/* #endregion */

/* #region Modals */
/* ── Modal ── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 100;
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}
#modal-overlay.open { display: flex; }
#modal {
  background: var(--col-bg);
  border-radius: 12px;
  width: 440px;
  max-width: calc(100vw - 40px);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modalIn .15s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
#modal-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
#modal-type-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
  margin-top: 2px;
}
#modal-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  flex: 1;
}
#modal-close {
  width: 28px; height: 28px;
  border: none;
  background: var(--hover);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .1s;
}
#modal-close:hover { background: var(--border); }
#modal-body { padding: 16px 20px 20px; }
.modal-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.modal-icon {
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.modal-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 2px;
}
.modal-val {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}
.modal-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.modal-link:hover { opacity: .7; }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.score-pill {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: transform .1s ease, box-shadow .1s ease;
}

.score-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* #endregion */

/* #region Controls */
/* ── Export dropdown ── */
.export-dropdown {
  position: relative;
  display: inline-flex;
}
.export-btn {
  padding: 0 10px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--col-bg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-2);
  transition: background .1s;
}
.export-btn:hover { background: var(--hover); }
.export-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--col-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 50;
  overflow: hidden;
}
.export-menu.open { display: block; }
.export-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.export-menu a:hover { background: var(--hover); }
.export-menu a small { font-size: 11px; color: var(--muted); display: block; }

/* ── Filter dropdown ── */
.filter-dropdown {
  position: relative;
  display: inline-flex;
}
.filter-btn {
  padding: 0 10px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--col-bg);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-2);
  transition: background .1s;
}
.filter-btn.has-filters { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.filter-btn:hover { background: var(--hover); }
.filter-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--col-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  width: 240px;
  z-index: 50;
  padding: 10px;
}
.filter-menu.open { display: block; }
.filter-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  margin-bottom: 8px;
}
.filter-search:focus { border-color: var(--accent); }
.filter-list {
  max-height: 220px;
  overflow-y: auto;
}
.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}
.filter-item:hover { background: var(--hover); }
.filter-item input { accent-color: var(--accent); cursor: pointer; }
.filter-clear {
  margin-top: 8px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-align: right;
  display: none;
}
.filter-clear.visible { display: block; }
.filter-presets-sep { border: none; border-top: 1px solid var(--border); margin: 6px 0 8px; }
.filter-preset-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}
.filter-preset-item:hover { background: var(--hover); }
.filter-preset-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.filter-preset-item .preset-name { flex: 1; }
.filter-preset-item .preset-del-btn {
  border: 1px solid #fca5a5;
  border-radius: 5px;
  padding: 1px 7px;
  background: var(--col-bg);
  color: #b91c1c;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
  font-family: var(--font);
}
.filter-preset-item .preset-del-btn:hover { background: #fee2e2; }
.filter-preset-item .preset-del-btn.confirm-armed {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
.filter-preset-item .preset-del-btn.confirm-armed:hover { background: #b91c1c; }
.filter-browse-btn {
  margin-top: 5px;
  width: 100%;
  padding: 5px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font);
  transition: background .1s, border-color .1s, color .1s;
}
.filter-browse-btn:hover { background: var(--hover); color: var(--text); }
/* Vote buttons inside filter preset list */
.preset-vote {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.preset-vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 4px;
  font-size: 9px;
  line-height: 1;
  color: var(--muted);
  font-family: var(--font);
}
.preset-vote-btn.voted-up   { color: #16a34a; }
.preset-vote-btn.voted-down { color: #dc2626; }
.preset-vote-btn:hover { color: var(--accent); }
.preset-vote-score {
  font-size: 10px;
  min-width: 16px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}
.preset-vote-score.pos { color: #16a34a; }
.preset-vote-score.neg { color: #dc2626; }
/* Public presets right panel — pushes #main */
#pub-panel-overlay { display: none; }
#pub-panel {
  width: 0;
  min-width: 0;
  height: 100%;
  height: 100dvh;
  background: var(--col-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid transparent;
  transition: width .25s ease, min-width .25s ease, border-color .25s ease;
  position: relative;
}
#pub-panel.open { width: 300px; min-width: 300px; border-left-color: var(--border); }
.pub-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.pub-panel-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 0 4px;
}
.pub-panel-search { padding: 10px 16px 6px; flex-shrink: 0; }
.pub-panel-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  box-sizing: border-box;
}
.pub-panel-search input:focus { border-color: var(--accent); }
#pub-presets-list { flex: 1; overflow-y: auto; }
.pub-preset-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.pub-preset-item:hover { background: var(--hover); }
.pub-preset-item.active { background: var(--accent-light); }
.pub-preset-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.pub-preset-name { font-size: 13px; font-weight: 500; color: var(--text); }
.pub-preset-clear { color: var(--accent); font-size: 12px; font-style: italic; }
.pub-preset-clear:hover { background: var(--accent-light); }
.pub-preset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}
.pub-preset-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--hover);
  color: var(--muted);
  border: 1px solid var(--border);
}
.pub-preset-tag.group { background: #ede9fe; color: #7c3aed; border-color: #c4b5fd; }
#admin-secret-zone { position: absolute; bottom: 0; right: 0; width: 20px; height: 20px; cursor: default; z-index: 10; }
.admin-btns { display: flex; gap: 4px; justify-content: flex-end; margin-top: 5px; }
.admin-btn { border: none; border-radius: 5px; padding: 2px 7px; font-size: 11px; cursor: pointer; line-height: 1.6; }
.admin-btn-edit { background: #e0e7ff; color: #3730a3; }
.admin-btn-edit:hover { background: #c7d2fe; }
.admin-btn-del  { background: #fee2e2; color: #b91c1c; }
.admin-btn-del:hover  { background: #fecaca; }
.admin-btn-del.confirm-armed { background: #dc2626; color: #fff; }
.admin-btn-del.confirm-armed:hover { background: #b91c1c; }
.admin-modal-overlay { display: none; position: fixed; inset: 0; background: #0006; z-index: 1000; align-items: center; justify-content: center; }
.admin-modal-overlay.open { display: flex; }
.admin-modal { background: var(--col-bg); border-radius: 12px; padding: 24px; width: 300px; box-shadow: 0 8px 32px #0003; display: flex; flex-direction: column; gap: 12px; }
.admin-modal h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.admin-modal input { border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font-size: 13px; width: 100%; }
.admin-modal input:focus { outline: none; border-color: var(--accent); }
.admin-modal-row { display: flex; gap: 8px; }
.admin-modal-row button { flex: 1; padding: 8px; border: none; border-radius: 7px; font-size: 13px; cursor: pointer; font-weight: 500; }
.admin-modal-confirm { background: var(--accent); color: #fff; }
.admin-modal-confirm:hover { opacity: .9; }
.admin-modal-cancel { background: var(--hover); color: var(--text); }
.admin-badge { font-size: 10px; background: #fef3c7; color: #92400e; border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
.filter-save-btn {
  margin-top: 8px;
  width: 100%;
  padding: 5px 0;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font);
  transition: background .1s, border-color .1s, color .1s;
}
.filter-save-btn:hover { background: var(--hover); border-color: var(--accent); color: var(--accent); }
.filter-save-btn.is-preset { border-style: solid; border-color: var(--accent); color: var(--accent); }
#preset-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preset-modal-card {
  background: var(--col-bg);
  border-radius: 14px;
  width: 320px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.preset-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.preset-modal-header h3 { font-size: 14px; font-weight: 600; margin: 0; }
.preset-modal-header .preset-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.preset-modal-name { padding: 10px 16px 4px; }
.preset-modal-section-label {
  padding: 8px 16px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.preset-group-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
}
.preset-group-row-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-2);
  min-width: 44px;
}
.preset-group-btns { display: flex; gap: 4px; flex-wrap: nowrap; }
.preset-group-btn {
  padding: 3px 9px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  font-family: var(--font);
  transition: background .1s, border-color .1s, color .1s;
}
.preset-group-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.preset-group-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.preset-modal-name input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  box-sizing: border-box;
}
.preset-modal-name input:focus { border-color: var(--accent); }
.preset-modal-subjects { flex: 1; overflow-y: auto; padding: 6px 16px 6px; }
.preset-modal-subject-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.preset-modal-subject-item input { accent-color: var(--accent); cursor: pointer; }
.preset-modal-footer {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.preset-modal-footer button {
  flex: 1;
  padding: 7px 0;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  border: 1px solid var(--border);
  background: none;
  color: var(--text);
}
.preset-modal-footer button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.preset-modal-footer button:hover { opacity: .85; }

/* ── Favorite header button ── */
#btn-fav {
  transition: color .15s, background .15s, border-color .15s;
}
#btn-fav.is-favorite {
  color: #d97706 !important;
  border-color: #f59e0b !important;
  background: #fef3c7 !important;
}
html.dark-mode #btn-fav.is-favorite {
  color: #fbbf24 !important;
  border-color: #d97706 !important;
  background: #78350f !important;
}

/* ── Favorite Modal ── */
#favorite-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.favorite-modal-card {
  background: var(--col-bg);
  border-radius: 14px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.favorite-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.favorite-modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.favorite-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.favorite-modal-close:hover {
  color: var(--text);
}
#favorite-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fav-modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fav-modal-subtitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.fav-modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 4px;
  line-height: 1.35;
}
.fav-modal-meta {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.35;
}
.fav-modal-input-wrap input,
#fav-person-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.fav-modal-input-wrap input:focus,
#fav-person-search:focus {
  border-color: var(--accent);
}
.fav-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.fav-modal-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: all .15s ease;
  white-space: nowrap;
}
.fav-modal-btn:hover {
  background: var(--hover);
}
.fav-modal-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.fav-modal-btn.primary:hover {
  opacity: .9;
}
.fav-modal-btn.danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}
.fav-modal-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}
.fav-modal-sep {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 4px 0;
}
.fav-modal-sep::before,
.fav-modal-sep::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.fav-modal-sep span {
  padding: 0 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fav-person-results {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.fav-person-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px;
  font-style: italic;
}
.fav-person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--hover);
  gap: 8px;
}
.fav-person-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.fav-person-name {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-person-meta {
  font-size: 11px;
  color: var(--muted);
}
.fav-person-add-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--col-bg);
  color: var(--accent);
  border-color: var(--accent);
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.fav-person-add-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.fav-person-add-btn.is-added,
.fav-person-add-btn:disabled {
  border-color: var(--border);
  color: var(--muted);
  background: none;
  cursor: default;
}

/* ── Warmup progress bar ── */
#warmup-bar {
  pointer-events: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--col-bg);
  border-top: 1px solid var(--border);
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.07);
  transition: opacity 0.4s, transform 0.4s;
}
#warmup-bar.hidden { opacity: 0; pointer-events: none; transform: translateY(100%); }
#warmup-label { font-size: 12px; color: var(--muted); }
#warmup-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
#warmup-fill  { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width 0.3s ease; }

/* #endregion */

/* #region Mobile & Responsive */
/* ── Mobile ────────────────────────────────────────────────────────────────── */
#sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: none; border-radius: 8px;
  background: none; cursor: pointer;
  color: var(--text); flex-shrink: 0;
}
#sidebar-toggle:hover { background: var(--hover); }

#sidebar-close {
  display: none;
  margin-left: auto;
  align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  background: none; cursor: pointer;
  color: var(--muted); font-size: 16px;
}
#sidebar-close:hover { background: var(--hover); color: var(--text); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 99;
}

/* ── Multi-select banner ── */
#multiselect-banner {
  display: none;
  margin: 0 8px 6px;
  padding: 6px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 11px;
  color: #1d4ed8;
  text-align: center;
  cursor: default;
  user-select: none;
}
#multiselect-banner.visible { display: flex; align-items: center; justify-content: space-between; }
#multiselect-exit {
  background: none; border: none; cursor: pointer;
  color: #1d4ed8; font-size: 13px; line-height: 1; padding: 0 2px;
}
#multiselect-exit:hover { color: #1e3a8a; }
#resource-list.multiselect-active .resource-item:not(.active) {
  background: rgba(37, 99, 235, 0.05);
}

/* ── Settings panel ── */
#settings-btn {
  margin-top: auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--hover);
  user-select: none;
  transition: background .15s, color .15s;
  position: relative;
}
#settings-btn:hover {
  background: #e2e8f0;
  color: var(--text);
}
#settings-panel {
  display: none;
  position: absolute;
  bottom: 56px;
  left: 12px;
  right: 12px;
  background: var(--col-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 14px;
  z-index: 20;
}
#settings-panel.open { display: block; }
.profile-name-hint { color: #b45f5f; font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.dark-mode .profile-name-hint { color: #e69a9a; }
#settings-last-update {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.settings-footer-meta {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.settings-footer-meta .willow-sync-status {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  font-size: 11px;
  line-height: 1.35;
}
.settings-footer-meta .willow-sync-status[hidden] {
  display: none;
}
.settings-build-number {
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}
.settings-footer-meta .settings-build-number {
  margin-top: 0;
}
/* Settings tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--hover);
  border-radius: 8px;
  padding: 3px;
}
.settings-tab {
  flex: 1;
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--muted);
  transition: background .15s, color .15s;
}
.settings-tab.active {
  background: var(--col-bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.settings-tab:not(.active):hover { color: var(--text-2); }

/* Beta tab content */
.beta-desc {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}
.beta-optimizer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  transition: opacity .15s;
  box-sizing: border-box;
}
.beta-optimizer-btn:hover { opacity: .88; }
#refresh-status-msg {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  min-height: 16px;
}

@media (max-width: 768px) {
  #sidebar-close  { display: flex; }

  #sidebar {
    position: fixed; top: 0; left: -280px; height: 100%;
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: none;
  }
  #sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .sidebar-overlay.open { display: block; }

  #cal-header { padding: env(safe-area-inset-top, 0px) 10px 0; gap: 6px; }
  #resource-title { display: none; }
  .week-label { font-size: 12px; }
  #btn-score { padding: 4px 8px; font-size: 11px; }
  .day-head { cursor: pointer; }
  .day-head.focused,
  .day-head.focused.today {
    background: var(--accent-light);
  }
  .day-head.focused .day-name,
  .day-head.focused.today .day-name,
  .day-head.focused .day-num,
  .day-head.focused.today .day-num {
    color: var(--accent);
  }
}

@media (max-width: 768px) {

  #btn-today  { display: none; }
  #btn-prev   { display: none; }
  #btn-next   { display: none; }
  #btn-score  { display: none !important; }
  .week-label { min-width: 0; flex: 1; text-align: left; }
  #week-nav   { flex: 1; min-width: 0; }

  #grid:not(.has-focus) .ev-type  { font-size: 8px; padding: 0; }
  #grid:not(.has-focus) .ev-title { font-size: 9px; line-height: 1.2; }
  #grid:not(.has-focus) .ev-loc   { font-size: 8.5px; }
  #grid:not(.has-focus) .ev-prof  { display: none !important; }
  #grid:not(.has-focus) .cal-event { padding: 2px 3px; }
  .empty-week-aperture { padding: 8px; }
  .empty-week-aperture-card { width: 100%; min-height: auto; padding: 20px 14px; border-radius: 14px; }
  .empty-week-aperture-close { top: 8px; right: 8px; width: 28px; height: 28px; font-size: 19px; }
  .empty-week-aperture-empty-title { margin-bottom: 8px; font-size: 19px; }
  .empty-week-aperture-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .empty-week-aperture-visuals { width: 100%; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .empty-week-aperture-mini-choice { min-width: 0; padding: 7px; border-radius: 10px; }
  .empty-week-aperture-mini-label { margin-bottom: 5px; font-size: 10px; letter-spacing: .06em; }
  .empty-week-aperture-mini-grid { display: grid !important; width: 100%; min-width: 0; grid-template-columns: 27px minmax(0, 1fr); height: min(300px, 42vh); min-height: 220px; }
  .empty-week-aperture-mini-axis { display: block; width: 27px; }
  .empty-week-aperture-mini-track { display: block; width: 100%; min-width: 0; min-height: 220px; height: 100%; border: 2px solid #aac4df; background-color: #f8fbff; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(18.18% - 1px), #cbd9e8 calc(18.18% - 1px), #cbd9e8 18.18%); }
  .empty-week-aperture-event { display: flex !important; visibility: visible !important; z-index: 1; left: 5px; right: 5px; min-height: 30px; padding: 4px 5px; border: 1px solid #93bdf1; border-left: 4px solid #2563eb; background: #dbeafe; box-shadow: 0 1px 2px rgba(37, 99, 235, .18); }
  .empty-week-aperture-event b { font-size: 9px; }
  .empty-week-aperture-event em { font-size: 9px; }
  .empty-week-aperture-mini-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: #7890a9; font-size: 11px; font-style: italic; text-align: center; }
  .empty-week-aperture-copy { width: 100%; height: auto; min-width: 0; min-height: 0; align-items: center; text-align: center; }
  .empty-week-aperture-copy-content { flex: 0 0 auto; align-items: center; }
  .empty-week-aperture-brand { gap: 8px; margin-bottom: 10px; }
  .empty-week-aperture-mark { width: 34px; height: 34px; border-radius: 10px; }
  .empty-week-aperture-mark svg { width: 19px; height: 19px; }
  .empty-week-aperture-brand-name { font-size: 23px; }
  .empty-week-aperture-copy h2 { max-width: 100%; margin: 0; font-size: 19px; line-height: 1.12; }
  .empty-week-aperture-copy > p:not(.empty-week-aperture-eyebrow) { max-width: 100%; margin-top: 8px; font-size: 12px; line-height: 1.4; }
  .empty-week-aperture-question-note { margin-top: 12px; }
  .empty-week-aperture-copy .empty-week-aperture-cta, .empty-week-aperture-copy.is-confirmation-copy .empty-week-aperture-cta { margin-top: 14px; }
  .empty-week-aperture-cta { min-height: 46px; padding: 10px 14px; font-size: 14px; }
  .empty-week-aperture-copy.is-confirmation-copy .empty-week-aperture-agreement { text-align: center; }
}

/* #endregion */

/* #region Room Finder */
/* ── Sidebar Actions ── */
.sidebar-action-btn {
  margin: 4px 8px 8px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .1s, border-color .1s, color .1s;
  width: calc(100% - 16px);
}

.sidebar-action-btn.green {
  border: 1.5px solid #16a34a;
  background: #f0fdf4;
  color: #16a34a;
}
.sidebar-action-btn.green:hover {
  background: #dcfce7;
}

#room-finder-btn {
  margin: 4px 8px 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-light);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .1s;
  width: calc(100% - 16px);
}
#room-finder-btn:hover { background: #dbeafe; }
#group-change-btn {
  margin: 4px 8px 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-light);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .1s;
  width: calc(100% - 16px);
}
#group-change-btn:hover { background: #dbeafe; }
#room-finder-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 300;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#room-finder-overlay.open { display: flex; }
#room-finder {
  background: var(--col-bg);
  border-radius: 16px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  animation: modalIn .2s ease;
}
#room-finder-head {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
#room-finder-head h2 { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
#rf-close {
  width: 28px; height: 28px;
  border: none; background: var(--hover); border-radius: 6px;
  cursor: pointer; font-size: 16px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
#rf-close:hover { background: var(--border); }
#room-finder-body { padding: 20px 24px; }

/* Mode switch */
.rf-mode-switch {
  display: flex;
  background: var(--hover);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 22px;
  gap: 2px;
}
.rf-mode-btn {
  flex: 1; padding: 8px 0;
  border: none; border-radius: 8px;
  background: transparent;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  color: var(--muted); cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}
.rf-mode-btn.active {
  background: var(--col-bg); color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* Date/time section */
.rf-datetime {
  display: flex; gap: 12px;
  overflow: hidden;
  max-height: 0; opacity: 0;
  margin-bottom: 0;
  transition: max-height .25s ease, opacity .2s ease, margin-bottom .25s ease;
}
.rf-datetime.visible {
  max-height: 90px; opacity: 1;
  margin-bottom: 22px;
}
.rf-dt-field { flex: 1; }
.rf-dt-field label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
  display: block; margin-bottom: 6px;
}
.rf-dt-field input {
  width: 100%; padding: 9px 11px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13.5px; font-family: var(--font); color: var(--text);
  background: var(--col-bg); outline: none;
  transition: border-color .15s;
}
.rf-dt-field input:focus { border-color: var(--accent); }

.rf-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 10px;
}
.rf-toggles { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 24px; }
.rf-toggle {
  padding: 6px 13px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--col-bg);
  cursor: pointer;
  font-size: 12.5px; font-weight: 500; font-family: var(--font);
  color: var(--text-2);
  transition: border-color .12s, background .12s, color .12s;
  user-select: none;
}
.rf-toggle:hover { border-color: var(--accent); color: var(--accent); }
.rf-toggle.active { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border);
  transition: .2s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--col-bg);
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
input:checked + .toggle-slider {
  background-color: var(--accent);
}
input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Slider Styling */
.slider-wrap {
  margin: 12px 0 24px;
}
.slider-value { font-size: 26px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
#rf-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border-radius: 3px; background: var(--border);
  outline: none; cursor: pointer;
}
#rf-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 1px 5px rgba(37,99,235,.35);
}
#rf-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
}
#rf-search-btn {
  width: 100%; padding: 11px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  transition: opacity .15s; margin-top: 20px; margin-bottom: 18px;
}
#rf-search-btn:hover { opacity: .9; }
#rf-search-btn:disabled { opacity: .5; cursor: not-allowed; }
.rf-results-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 8px;
}
.rf-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; transition: background .1s; margin-bottom: 2px;
}
.rf-result-item:hover { background: var(--hover); }
.rf-result-labels { flex: 1; min-width: 0; }
.rf-result-name { font-size: 13px; color: var(--text); font-weight: 500; }
.rf-result-source {
  margin-top: 2px; color: var(--muted); font-size: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rf-result-loc {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; flex-shrink: 0;
}
.rf-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 0; }

/* #endregion */

/* #region Notifications */
/* ── Group toast ── */
#group-toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(15,23,42,.82);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 500;
}
#group-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Next-course notification ── */
#next-course-notif {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 36px));
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #0f172a;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.07);
  overflow: hidden;
  z-index: 550;
  opacity: 0;
  cursor: pointer;
  transition: transform .4s cubic-bezier(0.34,1.4,0.64,1), opacity .25s ease;
  font-family: var(--font);
}
#next-course-notif.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#next-course-notif.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(calc(100% + 36px));
  transition: transform .3s ease, opacity .25s ease;
}
.ncn-body {
  padding: 18px 20px 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.ncn-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: #22c55e22;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ncn-content { flex: 1; min-width: 0; }
.ncn-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #22c55e; margin-bottom: 5px;
}
.ncn-title {
  font-size: 17px; font-weight: 700; color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 5px;
}
.ncn-room {
  font-size: 16px; font-weight: 700; color: #e2e8f0;
  display: flex; align-items: center; gap: 5px;
}
.ncn-room svg { flex-shrink: 0; opacity: .6; }
.ncn-bar {
  height: 3px; background: #1e293b; position: relative;
}
.ncn-bar-fill {
  position: absolute; inset: 0; right: auto;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  animation: ncnDrain 6s linear forwards;
}
@keyframes ncnDrain { from { width: 100%; } to { width: 0%; } }


/* #endregion */

/* #region Group Picker */
/* ── Modals (Generic) ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  z-index: 300;
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.triple-modal-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  max-width: 100%;
}

.dual-modal-row {
  display: flex;
  gap: 24px;
  align-items: center;
}

@media (max-width: 1100px) {
  .dual-modal-row {
    flex-direction: column;
  }
}

#submit-modal {
  width: auto;
  height: auto;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

.send-constraints-btn {
  background: #16a34a !important;
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform .1s, background .1s;
}
.send-constraints-btn:hover {
  background: #15803d !important;
  transform: translateY(-1px);
}
.send-constraints-btn:active { transform: translateY(0); }

/* Slider Styling */
.constraint-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
#constraints-max-days {
  flex: 1;
  accent-color: #16a34a;
  cursor: pointer;
}
.slider-value {
  font-size: 18px;
  font-weight: 800;
  color: #16a34a;
  min-width: 20px;
}

.modal-content {
  background: var(--col-bg);
  border-radius: 16px;
  width: 500px;
  height: 600px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  animation: modalIn .2s ease;
}
.modal-head {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; font-size: 20px; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px; transition: background .1s;
}
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { 
  padding: 24px; 
  flex: 1;
  overflow-y: auto;
}

/* ── Availability Picker ── */
#secondary-modal .modal-body {
  padding: 0;
  overflow: hidden;
}
.availability-header {
  display: grid;
  grid-template-columns: 48px repeat(5, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 8px 0;
  flex-shrink: 0;
}
.availability-grid {
  display: grid;
  grid-template-columns: 48px repeat(5, 1fr);
  grid-template-rows: repeat(48, 1fr);
  flex: 1;
  overflow: hidden;
  position: relative;
  user-select: none;
  background: var(--col-bg);
}
.time-label {
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 8px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #f8fafc;
}
.availability-slot {
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  background: var(--col-bg);
}
.availability-slot:last-child { border-right: none; }
.availability-slot.forbidden {
  background: #fee2e2;
  border-color: #fecaca;
}
.availability-slot.hour-mark, .time-label.hour-mark {
  border-bottom: 1.5px solid #e2e8f0;
}

/* ── Group picker (première visite / paramètres) ── */
#group-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 300;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#group-picker-overlay.open { display: flex; }
#group-picker {
  background: var(--col-bg);
  border-radius: 16px;
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  animation: modalIn .2s ease;
}
#group-picker-head {
  padding: 28px 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
#group-picker-head h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  margin-top: 10px;
}
#group-picker-head p {
  font-size: 13px;
  color: var(--muted);
}
#group-picker-body { padding: 20px 24px 4px; }
.gp-section-lbl {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 16px 0 8px;
}
.gp-section-lbl:first-child { margin-top: 0; }
.gp-section-lbl span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.gp-other-lbl {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.gp-other-lbl:hover span {
  color: var(--accent);
}
.gp-other-lbl .chevron {
  font-size: 11px;
  color: var(--muted);
  transition: transform .2s ease;
  display: inline-block;
}
.gp-other-lbl:hover .chevron {
  color: var(--accent);
}
.gp-other-lbl .chevron.open {
  transform: rotate(90deg);
}
.gp-other-container {
  margin-bottom: 12px;
}
.gp-other-container.collapsed {
  display: none !important;
}
.gp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.gp-btn {
  padding: 10px 4px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--col-bg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-2);
  transition: border-color .12s, background .12s, color .12s;
  text-align: center;
}
.gp-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.gp-btn.selected { border-color: var(--accent); background: var(--accent); color: #fff; }
#group-picker-foot {
  padding: 20px 24px 24px;
  display: flex;
  gap: 10px;
}
#gp-confirm {
  flex: 1;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s;
}
#gp-confirm:disabled { opacity: .4; cursor: not-allowed; }
#gp-confirm:not(:disabled):hover { opacity: .88; }
#gp-skip {
  margin-left: auto;
  padding: 10px 16px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: background .1s;
}
#gp-skip:hover { background: var(--hover); }

.gp-back-btn {
  padding: 10px 16px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: background .1s, color .1s;
  margin-right: auto;
}
.gp-back-btn:hover { background: var(--hover); color: var(--text); }

.group-lang-subhdr,
.group-proj-subhdr,
.group-harm-subhdr {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 5px 10px 5px 14px;
  margin: 4px 6px 2px 14px;
  border-left: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  transition: color .12s, background .12s, border-color .12s;
}
.group-lang-subhdr:hover,
.group-proj-subhdr:hover,
.group-harm-subhdr:hover {
  color: var(--text);
  background: var(--hover);
  border-left-color: var(--accent);
}
.group-lang-subhdr .chevron,
.group-proj-subhdr .chevron,
.group-harm-subhdr .chevron {
  font-size: 7.5px;
  color: var(--muted);
  display: inline-block;
  transition: transform .15s ease, color .15s ease;
}
.group-lang-subhdr:hover .chevron,
.group-proj-subhdr:hover .chevron,
.group-harm-subhdr:hover .chevron {
  color: var(--accent);
}
.group-lang-subitems,
.group-proj-subitems,
.group-harm-subitems {
  overflow: hidden;
  padding-left: 10px;
}
.group-lang-subitems.collapsed,
.group-proj-subitems.collapsed,
.group-harm-subitems.collapsed {
  display: none !important;
}

.theme-new .group-lang-subhdr,
.theme-new .group-proj-subhdr,
.theme-new .group-harm-subhdr {
  font-size: 10.5px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  margin: 2px 6px 2px 12px !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  border-left: 2px solid var(--border) !important;
}
.theme-new .group-lang-subhdr:hover,
.theme-new .group-proj-subhdr:hover,
.theme-new .group-harm-subhdr:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
  border-left-color: var(--accent) !important;
}
.theme-new .group-lang-subitems,
.theme-new .group-proj-subitems,
.theme-new .group-harm-subitems {
  padding-left: 6px !important;
}

.gp-search-input {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.gp-search-input:focus {
  border-color: var(--accent);
}

/* #endregion */

/* #region Design Switcher */
.design-switcher {
  display: flex;
  gap: 6px;
}
.design-opt-btn {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--sidebar-bg);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-2);
  transition: all .15s ease;
  text-align: center;
}
.design-opt-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.design-opt-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
/* #endregion */

/* #region Theme New */
@font-face {
  font-family: 'WillowSerif';
  font-style: normal;
  font-weight: 100 900;
  src: local('Instrument Sans'), local('InstrumentSans-Regular'), local('Inter'), sans-serif;
  unicode-range: U+0030-0039; /* Chiffres 0-9 en Instrument Sans */
}
@font-face {
  font-family: 'WillowSerif';
  font-style: normal;
  font-weight: 100 900;
  src: local('Georgia'), local('Cambria'), local('Times New Roman'), serif;
  unicode-range: U+0000-002F, U+003A-10FFFF; /* Lettres et symboles en Georgia */
}

:root.theme-new {
  --font: 'Instrument Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'WillowSerif', 'Georgia', 'Cambria', 'Times New Roman', Times, serif;
  --font-mono: 'Geist Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar-w: 292px;
  --app-bg: #f8f7f4;
  --col-bg: #ffffff;
  --sidebar-bg: #faf9f6;
  --header-bg: #ffffff;
  --border: #e4e3dc;
  --border-strong: #d0cfc6;
  --muted: #73726c;
  --text: #181816;
  --text-2: #383834;
  
  /* Nuances de vert Willow franches & ciblées */
  --green-forest: #165b35;       /* Mon groupe, sélection active, jour courant */
  --green-pine: #1b683e;         /* Liseré gauche cours TD / standard / CM */
  --green-deep: #0f2316;         /* Titres des cours en vert-noir contrasté */
  --green-sage: #2d6140;         /* Labels type, métadonnées nettes */
  --green-muted: #3a684b;        /* Salles */
  --green-bg-card: #edf4ee;      /* Fond carte (vert sauge clair & lumineux) */
  --green-border-card: #c4dbc9;  /* Bordure délimitante carte */
  --green-pill-bg: #e2f0e5;      /* Fond pastille score */
  --green-pill-text: #135730;    /* Texte pastille score */
  --green-pill-border: #bcd9c2;  /* Bordure pastille score */
  --green-today-bg: #f2f7f3;     /* Fond colonne aujourd'hui */

  /* Accent secondaire : Marron noble / cuir chaud pour les sélections de groupes */
  --brown-accent: #7a461b;
  --brown-bg-selected: #f3ede6;
  --brown-border-selected: #dfd0c0;
  --brown-text: #593010;

  --accent: var(--green-forest);
  --accent-light: #edf5f0;
  --hover: #f1f0ea;
  --today-bg: var(--green-today-bg);

  /* ── 12 Palettes Course-Colors (Mode Clair - Teintes renforcées & plus visibles) ── */
  --cc-0-border: #165b35; --cc-0-bg: #dbeee1; --cc-0-border-card: #b3d8bf; --cc-0-title: #0f2316; --cc-0-meta: #204d30; /* Pin Willow */
  --cc-1-border: #4a7541; --cc-1-bg: #e3efdf; --cc-1-border-card: #b9d8b3; --cc-1-title: #182814; --cc-1-meta: #324c2b; /* Sauge Olive */
  --cc-2-border: #8c4e28; --cc-2-bg: #f6e4d5; --cc-2-border-card: #e5c1a7; --cc-2-title: #2b1709; --cc-2-meta: #623318; /* Cuir Terracotta */
  --cc-3-border: #2c4f82; --cc-3-bg: #dfeaf8; --cc-3-border-card: #b2cbed; --cc-3-title: #0d1a2e; --cc-3-meta: #1e385e; /* Saphir Nuit */
  --cc-4-border: #99691b; --cc-4-bg: #f7eccf; --cc-4-border-card: #e7cf9c; --cc-4-title: #261a04; --cc-4-meta: #66450e; /* Ambre Cuivré */
  --cc-5-border: #0e757d; --cc-5-bg: #d8edf0; --cc-5-border-card: #a7d3da; --cc-5-title: #042124; --cc-5-meta: #094e53; /* Lagune Cyan */
  --cc-6-border: #6d356c; --cc-6-bg: #f1dcf1; --cc-6-border-card: #d9b4d9; --cc-6-title: #260c25; --cc-6-meta: #4c214a; /* Prune Violette */
  --cc-7-border: #3f4491; --cc-7-bg: #e2e4f7; --cc-7-border-card: #bcc0ee; --cc-7-title: #141738; --cc-7-meta: #292d63; /* Indigo Cobalt */
  --cc-8-border: #7d6616; --cc-8-bg: #f4ecbe; --cc-8-border-card: #dcce8f; --cc-8-title: #261f03; --cc-8-meta: #53440c; /* Ocre Moutarde */
  --cc-9-border: #8a3d52; --cc-9-bg: #f6dbe6; --cc-9-border-card: #deb0c3; --cc-9-title: #280f16; --cc-9-meta: #612737; /* Bois de Rose */
  --cc-10-border: #4f5b66; --cc-10-bg: #dfe5ea; --cc-10-border-card: #b6c2cb; --cc-10-title: #12171b; --cc-10-meta: #303a42; /* Ardoise Neutre */
  --cc-11-border: #695240; --cc-11-bg: #eee2d7; --cc-11-border-card: #cfbbaa; --cc-11-title: #20170f; --cc-11-meta: #463528; /* Moka Écorce */
}

:root.theme-new.dark-mode {
  color-scheme: dark;
  --font: 'Instrument Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'WillowSerif', 'Georgia', 'Cambria', 'Times New Roman', Times, serif;
  --font-mono: 'Geist Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --app-bg: #14100d;
  --col-bg: #17130e;
  --sidebar-bg: #1a1510;
  --header-bg: #1a1510;
  --border: #2b221a;
  --border-strong: #3d3025;
  --muted: #9c8b7b;
  --text: #f7eee5;
  --text-2: #cbbbae;

  /* Couleur dominante en mode sombre : Orange & Ambre chaud */
  --green-forest: #f59e0b;
  --green-pine: #ea580c;
  --green-deep: #fff8f0;
  --green-sage: #fbbf24;
  --green-muted: #fed7aa;
  --green-bg-card: #201812;
  --green-border-card: #3e2d20;
  --green-pill-bg: #342216;
  --green-pill-text: #fbbf24;
  --green-pill-border: #563922;
  --green-today-bg: #291e14;

  /* Marron / Caramel chaud en mode sombre */
  --brown-accent: #f0a868;
  --brown-bg-selected: #342318;
  --brown-border-selected: #5a3c26;
  --brown-text: #f7d2b2;

  --accent: #f59e0b;
  --accent-light: #342216;
  --hover: #261f17;
  --today-bg: var(--green-today-bg);

  /* ── 12 Palettes Course-Colors (Mode Sombre) ── */
  --cc-0-border: #10b981; --cc-0-bg: #14241a; --cc-0-border-card: #20422d; --cc-0-title: #ecfdf5; --cc-0-meta: #6ee7b7;
  --cc-1-border: #84cc16; --cc-1-bg: #192414; --cc-1-border-card: #2b3e20; --cc-1-title: #f7fee7; --cc-1-meta: #bef264;
  --cc-2-border: #f97316; --cc-2-bg: #271911; --cc-2-border-card: #4b2b1b; --cc-2-title: #fff7ed; --cc-2-meta: #fdba74;
  --cc-3-border: #38bdf8; --cc-3-bg: #12212f; --cc-3-border-card: #1f3952; --cc-3-title: #f0f9ff; --cc-3-meta: #7dd3fc;
  --cc-4-border: #f59e0b; --cc-4-bg: #261e0f; --cc-4-border-card: #493618; --cc-4-title: #fffbeb; --cc-4-meta: #fcd34d;
  --cc-5-border: #2dd4bf; --cc-5-bg: #112626; --cc-5-border-card: #1d4646; --cc-5-title: #f0fdfa; --cc-5-meta: #5eead4;
  --cc-6-border: #c084fc; --cc-6-bg: #251427; --cc-6-border-card: #462349; --cc-6-title: #faf5ff; --cc-6-meta: #e9d5ff;
  --cc-7-border: #818cf8; --cc-7-bg: #17182b; --cc-7-border-card: #292c4f; --cc-7-title: #eef2ff; --cc-7-meta: #a5b4fc;
  --cc-8-border: #eab308; --cc-8-bg: #25210e; --cc-8-border-card: #493f18; --cc-8-title: #fefce8; --cc-8-meta: #fde047;
  --cc-9-border: #fb7185; --cc-9-bg: #27141b; --cc-9-border-card: #4d2331; --cc-9-title: #fff1f2; --cc-9-meta: #fda4af;
  --cc-10-border: #94a3b8; --cc-10-bg: #171e26; --cc-10-border-card: #2b3744; --cc-10-title: #f8fafc; --cc-10-meta: #cbd5e1;
  --cc-11-border: #d97706; --cc-11-bg: #241c14; --cc-11-border-card: #473423; --cc-11-title: #fffbeb; --cc-11-meta: #fbbf24;
}

/* ── Sidebar & Layout ── */
.theme-new #sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

/* ── Logo & Brand Switcher ── */
.theme-new #logo {
  position: relative !important;
  z-index: 50 !important;
  font-family: var(--font-serif) !important;
  font-size: 19px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: var(--green-forest) !important;
  min-height: 54px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  overflow: visible !important;
}
.theme-new #logo svg,
.theme-new #logo .logo-svg {
  display: none !important;
}
.theme-new #logo .logo-branch {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-48%) rotate(-4deg);
  width: 67px;
  height: 59px;
  object-fit: contain;
  opacity: 1;
  pointer-events: none;
  z-index: 1;
}
.theme-new #logo .logo-branch--light {
  display: block !important;
}
.theme-new #logo .logo-branch--dark {
  display: none !important;
}
.theme-new.dark-mode #logo .logo-branch--light {
  display: none !important;
}
.theme-new.dark-mode #logo .logo-branch--dark {
  display: block !important;
  opacity: 0.95;
}
.theme-new #logo .app-switcher {
  position: relative;
  z-index: 100;
  margin-left: 51px;
}
.theme-new #logo .app-switcher,
.theme-new #logo .app-switcher__brand,
.theme-new #logo .app-switcher__trigger,
.theme-new #logo .app-switcher__current {
  font-family: var(--font-serif) !important;
  font-size: 19px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}
.theme-new .app-switcher__menu {
  position: absolute !important;
  z-index: 99999 !important;
  border-radius: 6px;
  font-family: var(--font);
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  clip-path: inset(0 0 100% 0 round 6px);
}
.theme-new .app-switcher.is-open .app-switcher__menu {
  clip-path: inset(0 0 0% 0 round 6px);
}
.theme-new.dark-mode .app-switcher__menu {
  background: #1a1510;
  border-color: #33281e;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.7);
}
.theme-new .app-switcher__item {
  font-family: var(--font);
  font-size: 12.5px;
  border-radius: 4px;
  font-weight: 500;
  color: var(--text-2);
}
.theme-new .app-switcher__item:hover {
  background: var(--hover);
  color: var(--text);
}
.theme-new .app-switcher__item.is-active {
  background: var(--brown-bg-selected);
  color: var(--brown-text);
  font-weight: 600;
}

/* ── Search bar ── */
.theme-new #search-wrap {
  padding: 12px 14px 8px;
}
.theme-new #search {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 7px 10px 7px 32px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  box-shadow: none;
}
.theme-new #search:focus {
  border-color: var(--accent);
  outline: none;
}
.theme-new #search::placeholder {
  color: var(--muted);
  font-size: 12.5px;
}
.theme-new.dark-mode #search {
  background: #17130e;
  border-color: #33281e;
  color: var(--text);
}

/* ── Section Toggles & Headers ── */
.theme-new .section-header {
  margin-top: 6px;
}
.theme-new .section-toggle {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 7px 14px 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.theme-new .group-section-note {
  font-size: 11px;
  color: var(--muted);
  padding: 0 14px 6px 28px;
  font-weight: 400;
}

/* Chevrons */
.theme-new .chevron {
  font-size: 0 !important;
  width: 13px !important;
  height: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-right: 3px !important;
  transform: none !important;
  transition: none !important;
}
.theme-new .chevron::before {
  content: '›' !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  line-height: 1 !important;
}
.theme-new .chevron.open::before {
  content: '▾' !important;
  font-size: 12px !important;
  color: var(--text-2) !important;
  line-height: 1 !important;
}

/* Family subheaders (ÉLECTRONIQUE..., INFORMATIQUE 3A...) */
.theme-new .group-subhdr {
  border: none !important;
  background: transparent !important;
  margin: 1px 6px !important;
  padding: 4px 8px !important;
  border-radius: 3px !important;
  color: var(--text-2) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  box-shadow: none !important;
}
/* Family subheaders (ÉLECTRONIQUE..., INFORMATIQUE 3A...) */
.theme-new .group-subhdr {
  border: none !important;
  background: transparent !important;
  margin: 1px 6px !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  color: var(--text-2) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  box-shadow: none !important;
}
.theme-new .group-subhdr:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
}
.theme-new .group-subhdr.all-active {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
}
.theme-new .group-all-badge {
  opacity: 0;
  background: transparent !important;
  border: 1px solid var(--accent) !important;
  color: var(--accent) !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  padding: 1px 5px !important;
  border-radius: 3px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  transition: opacity .12s ease;
}
.theme-new .group-subhdr:hover .group-all-badge {
  opacity: 1;
}
.theme-new .group-subhdr.all-active .group-all-badge {
  opacity: 1 !important;
  border-color: var(--brown-accent) !important;
  color: var(--brown-text) !important;
}

/* ── Tree branches / ramifications ── */
.theme-new .group-subitems {
  position: relative;
  margin-left: 20px;
  padding-left: 10px;
  border-left: 1.5px solid #dcdcd6;
  margin-bottom: 4px;
}
.theme-new.dark-mode .group-subitems {
  border-left-color: #2e3530;
}
.theme-new .group-subitems .resource-item,
.theme-new .resource-item {
  position: relative;
  margin: 2px 0;
  padding: 3px 6px;
  border-radius: 4px;
  background: transparent !important;
  display: flex;
  align-items: center;
  border: none !important;
}
.theme-new .group-subitems .resource-item::before {
  content: '';
  position: absolute;
  left: -11.5px;
  top: 50%;
  width: 9px;
  height: 1.5px;
  background: #dcdcd6;
}
.theme-new.dark-mode .group-subitems .resource-item::before {
  background: #2e3530;
}
.theme-new .group-subitems .resource-item:hover,
.theme-new .resource-item:hover {
  background: var(--hover) !important;
}
.theme-new .group-subitems .resource-item.active,
.theme-new .resource-item.active {
  background: var(--brown-bg-selected) !important;
}
.theme-new .group-subitems .resource-item.active::before {
  background: var(--brown-accent) !important;
}
.theme-new .group-subitems .ri-icon {
  width: 14px;
  height: 14px;
  min-width: 14px;
  background: transparent !important;
  border: none !important;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
}
.theme-new .group-subitems .resource-item .ri-icon::before {
  content: '›';
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}
.theme-new .resource-item.active .ri-icon::before,
.theme-new .group-subitems .resource-item.active .ri-icon::before {
  content: '●';
  font-size: 8px;
  color: var(--brown-accent) !important;
  line-height: 1;
}
.theme-new .group-subitems .ri-name,
.theme-new .resource-item .ri-name {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 400;
}
.theme-new .resource-item.active .ri-name,
.theme-new .group-subitems .resource-item.active .ri-name {
  color: var(--brown-text) !important;
  font-weight: 600;
}

/* ── Mon groupe ── */
.theme-new .my-group-item {
  background: transparent !important;
  border-radius: 4px;
  margin: 1px 6px;
  padding: 4px 8px;
  border: none !important;
}
.theme-new .my-group-item:hover {
  background: var(--hover) !important;
}
.theme-new .my-group-item.active {
  background: var(--brown-bg-selected) !important;
}
.theme-new .my-group-item .ri-icon {
  width: 14px;
  height: 14px;
  min-width: 14px;
  border-radius: 0;
  background: transparent !important;
  border: none !important;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
}
.theme-new .my-group-item .ri-icon::before {
  content: '●';
  font-size: 8px;
  color: var(--accent);
  line-height: 1;
}
.theme-new .my-group-item.active .ri-icon::before {
  color: var(--brown-accent) !important;
}
.theme-new .my-group-item .ri-name {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}
.theme-new .my-group-item.active .ri-name {
  color: var(--brown-text) !important;
}

/* ── Multi-select banner in Theme New ── */
.theme-new #multiselect-banner {
  background: var(--brown-bg-selected) !important;
  border: 1px solid var(--brown-border-selected) !important;
  color: var(--brown-text) !important;
}
.theme-new #multiselect-exit {
  color: var(--brown-accent) !important;
}
.theme-new #multiselect-exit:hover {
  color: var(--brown-text) !important;
}
.theme-new #resource-list.multiselect-active .resource-item:not(.active) {
  background: rgba(122, 70, 27, 0.04) !important;
}

/* ── Badges in sidebar ── */
.theme-new .ri-badge {
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 1px 6px !important;
  border-radius: 3px !important;
  background: var(--green-pill-bg) !important;
  color: var(--green-pill-text) !important;
  margin-left: auto;
  border: 1px solid var(--green-pill-border);
}
.theme-new .ri-badge.bad-score {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
  border-color: var(--brown-border-selected) !important;
}
.theme-new.dark-mode .ri-badge {
  background: #342216 !important;
  color: #fbbf24 !important;
  border-color: #563922 !important;
}
.theme-new.dark-mode .ri-badge.bad-score {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
  border-color: var(--brown-border-selected) !important;
}

/* ── Actions & Settings ── */
.theme-new #room-finder-btn,
.theme-new #group-change-btn {
  background: var(--col-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 500;
  font-size: 12.5px;
  border-radius: 4px;
}
.theme-new #room-finder-btn:hover,
.theme-new #group-change-btn:hover {
  background: var(--hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-new #settings-btn {
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  border-top: 1px solid var(--border);
  transition: background .12s ease, color .12s ease;
}
.theme-new #settings-btn:hover {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
}
.theme-new #settings-btn:hover svg {
  stroke: var(--brown-accent) !important;
}
.theme-new.dark-mode #settings-btn:hover {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
}
.theme-new.dark-mode #settings-btn:hover svg {
  stroke: var(--brown-accent) !important;
}

.theme-new .design-opt-btn.active {
  background: var(--brown-accent) !important;
  border-color: var(--brown-accent) !important;
  color: #ffffff !important;
}
.theme-new .design-opt-btn:hover:not(.active) {
  background: var(--brown-bg-selected) !important;
  border-color: var(--brown-border-selected) !important;
  color: var(--brown-text) !important;
}

/* ── Calendar Header & Navigation ── */
.theme-new #cal-header {
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: var(--col-bg);
  border-bottom: 1px solid var(--border);
}
.theme-new .week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-new #btn-prev {
  border-radius: 4px 0 0 4px !important;
  border-right: none !important;
  margin-right: 0 !important;
  width: 28px !important;
  height: 28px !important;
}
.theme-new #btn-today {
  border-radius: 0 !important;
  border-right: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  height: 28px !important;
  padding: 0 10px !important;
}
.theme-new #btn-next {
  border-radius: 0 4px 4px 0 !important;
  margin-left: 0 !important;
  width: 28px !important;
  height: 28px !important;
}
.theme-new .nav-btn,
.theme-new .today-btn,
.theme-new .export-btn,
.theme-new .filter-btn {
  height: 28px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 0 10px;
  box-shadow: none;
  transition: background .1s, border-color .1s;
}
.theme-new .nav-btn:hover,
.theme-new .today-btn:hover,
.theme-new .export-btn:hover,
.theme-new .filter-btn:hover {
  background: var(--hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.theme-new.dark-mode .nav-btn,
.theme-new.dark-mode .today-btn,
.theme-new.dark-mode .export-btn,
.theme-new.dark-mode .filter-btn {
  background: #161b17;
  border-color: #262e28;
}
.theme-new .week-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  height: 28px;
}

/* Desktop week chooser shares the six-month layout used by the mobile picker. */
.desktop-week-picker-overlay[hidden] { display: none; }
.desktop-week-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .45);
}
.desktop-week-picker-card {
  width: min(600px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--col-bg);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.desktop-week-picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.desktop-week-picker-head h2 { margin: 0 0 4px; font-size: 21px; }
.desktop-week-picker-head p { margin: 0; color: var(--muted); font-size: 13px; }
.desktop-week-picker-head button {
  border: 0; border-radius: 6px; background: transparent; color: var(--text-2);
  font: inherit; font-size: 24px; line-height: 1; cursor: pointer;
}
.desktop-week-picker-nav {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center; gap: 10px; margin: 20px 0 15px;
}
.desktop-week-picker-nav strong { text-align: center; text-transform: capitalize; font-size: 14px; }
.desktop-week-picker-nav button {
  width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--app-bg); color: var(--text); font: inherit; font-size: 22px; cursor: pointer;
}
.desktop-week-picker-nav button:hover,
.desktop-week-picker-head button:hover { background: var(--hover); }
.desktop-week-picker-grid { display: grid; gap: 7px; }
.desktop-week-picker-row {
  display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 7px;
}
.desktop-week-picker-month {
  display: flex; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--app-bg);
  font-size: 13px; font-weight: 700; text-transform: capitalize;
}
.desktop-week-picker-weeks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.desktop-week-picker-week {
  position: relative; min-height: 44px; padding: 0; border: 1px dashed var(--border);
  border-radius: 8px; background: var(--col-bg); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.desktop-week-picker-week.available { border: 1px solid var(--accent); background: var(--accent); color: white; }
.desktop-week-picker-week:hover { filter: brightness(.92); }
.desktop-week-picker-week.current { outline: 2px solid var(--text); outline-offset: 1px; }
.desktop-week-picker-week:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.desktop-week-picker-week.today::after {
  content: ''; position: absolute; bottom: 4px; left: calc(50% - 2px);
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}
.desktop-week-picker-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--border);
}
.desktop-week-picker-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.desktop-week-picker-legend span { display: inline-flex; align-items: center; gap: 5px; }
.desktop-week-picker-legend i { width: 12px; height: 12px; border: 1px solid var(--border); border-radius: 3px; }
.desktop-week-picker-legend i.available { background: var(--accent); border-color: var(--accent); }
.desktop-week-picker-legend i.current { border: 2px solid var(--text); }
.desktop-week-picker-legend i.today { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--text); }
#desktop-week-picker-today {
  flex: 0 0 auto; min-height: 32px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--app-bg); color: var(--text); font: inherit; cursor: pointer;
}
#desktop-week-picker-today:hover { background: var(--hover); }
@media (max-width: 480px) {
  .desktop-week-picker-card { padding: 16px; }
  .desktop-week-picker-row { grid-template-columns: 75px minmax(0, 1fr); gap: 5px; }
  .desktop-week-picker-month { padding: 5px; font-size: 11px; }
  .desktop-week-picker-weeks { gap: 3px; }
  .desktop-week-picker-week { min-height: 40px; }
  .desktop-week-picker-footer { align-items: flex-start; flex-direction: column; }
}

/* ── Days Header ── */
.theme-new #days-header {
  background: var(--col-bg);
  border-bottom: 1px solid var(--border);
}
.theme-new .day-head {
  padding: 10px 8px 8px;
  border-left: 1px solid var(--border);
}
.theme-new .day-name {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.theme-new .day-name::after {
  content: '.';
}
.theme-new .day-num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  margin: 2px 0 4px;
}
.theme-new .day-head.today .day-num,
.theme-new .day-head.today .day-name {
  color: var(--green-forest);
}
.theme-new .day-head.today {
  background: var(--green-today-bg);
}
.theme-new .score-pill {
  font-family: var(--font-mono) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  padding: 1px 6px !important;
  border-radius: 3px !important;
  display: inline-block !important;
  background: var(--green-pill-bg) !important;
  color: var(--green-pill-text) !important;
  border: 1px solid var(--green-pill-border) !important;
}
.theme-new .score-pill.bad-score {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
  border-color: var(--brown-border-selected) !important;
}
.theme-new.dark-mode .score-pill {
  background: #342216 !important;
  color: #fbbf24 !important;
  border-color: #563922 !important;
}
.theme-new.dark-mode .score-pill.bad-score {
  background: var(--brown-bg-selected) !important;
  color: var(--brown-text) !important;
  border-color: var(--brown-border-selected) !important;
}

/* ── Time Gutter & Grid ── */
.theme-new .time-col {
  background: var(--col-bg);
  border-right: 1px solid var(--border);
}
.theme-new .time-slot {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 8px 0 0;
  text-align: right;
  line-height: 1;
  box-sizing: border-box;
}
.theme-new .hour-line {
  border-top: 1px solid #ebeae4;
}
.theme-new .half-line {
  border-top: 1px dashed #f2f1ec;
}
.theme-new.dark-mode .hour-line {
  border-top: 1px solid #3c2f24;
}
.theme-new.dark-mode .half-line {
  border-top: 1px dashed rgba(80, 62, 48, 0.75);
}
.theme-new.dark-mode .day-col {
  border-left: 1px solid #382c21;
}
.theme-new.dark-mode .time-col {
  border-right: 1px solid #382c21;
}

/* ── Event Cards ── */
.theme-new .cal-event {
  border-radius: 4px !important;
  padding: 5px 6px !important;
  border-left-width: 3.5px !important;
  border-left-style: solid !important;
  box-shadow: none !important;
  transition: border-color .1s, transform .12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .12s ease;
  overflow: hidden;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column !important;
}
.theme-new .cal-event.ev-compact {
  padding: 3px 5px !important;
  display: flex !important;
  flex-direction: column !important;
}
.theme-new .cal-event.ev-micro {
  padding: 0 5px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
}
.theme-new .cal-event.ev-standard {
  padding: 5px 7px !important;
  display: flex !important;
  flex-direction: column !important;
}


/* TD & CM (Vert sauge feutré doux + liseré vert pin) */
.theme-new .cal-event[data-ev-type="TD"],
.theme-new .cal-event[data-ev-type="CM"] {
  background: var(--green-bg-card) !important;
  border: 1px solid var(--green-border-card) !important;
  border-left: 3.5px solid var(--green-pine) !important;
}
.theme-new .cal-event[data-ev-type="TD"] .ev-title,
.theme-new .cal-event[data-ev-type="CM"] .ev-title {
  color: var(--green-deep) !important;
}
.theme-new .cal-event[data-ev-type="TD"] .ev-type,
.theme-new .cal-event[data-ev-type="CM"] .ev-type {
  color: var(--green-sage) !important;
}
.theme-new .cal-event[data-ev-type="TD"] .ev-loc,
.theme-new .cal-event[data-ev-type="CM"] .ev-loc,
.theme-new .cal-event[data-ev-type="TD"] .ev-prof,
.theme-new .cal-event[data-ev-type="CM"] .ev-prof {
  color: var(--green-muted) !important;
}

/* TP (Sable feutré doux + liseré terre/ambre) */
.theme-new .cal-event[data-ev-type="TP"] {
  background: #f7f4ed !important;
  border: 1px solid #e8decb !important;
  border-left: 3.5px solid #8c5d26 !important;
}
.theme-new .cal-event[data-ev-type="TP"] .ev-title {
  color: #24180c !important;
}
.theme-new .cal-event[data-ev-type="TP"] .ev-type {
  color: #69533b !important;
}
.theme-new .cal-event[data-ev-type="TP"] .ev-loc,
.theme-new .cal-event[data-ev-type="TP"] .ev-prof {
  color: #69533b !important;
}

/* DS / Examens (Rosé feutré doux + liseré bordeaux/rouge) */
.theme-new .cal-event[data-ev-type="DS"],
.theme-new .cal-event[data-ev-type="CC"] {
  background: #f9eeee !important;
  border: 1px solid #edd1d1 !important;
  border-left: 3.5px solid #a62a2a !important;
}
.theme-new .cal-event[data-ev-type="DS"] .ev-title,
.theme-new .cal-event[data-ev-type="CC"] .ev-title {
  color: #260b0b !important;
}
.theme-new .cal-event[data-ev-type="DS"] .ev-type,
.theme-new .cal-event[data-ev-type="CC"] .ev-type {
  color: #783636 !important;
}
.theme-new .cal-event[data-ev-type="DS"] .ev-loc,
.theme-new .cal-event[data-ev-type="CC"] .ev-loc,
.theme-new .cal-event[data-ev-type="DS"] .ev-prof,
.theme-new .cal-event[data-ev-type="CC"] .ev-prof {
  color: #783636 !important;
}

/* Cours spéciaux (non TD/CM/DS/TP) : #022f78 */
.theme-new .cal-event.ev-special,
.theme-new .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) {
  background: #edf3fa !important;
  border: 1px solid #d4e3f5 !important;
  border-left: 3.5px solid #022f78 !important;
}
.theme-new .cal-event.ev-special .ev-title,
.theme-new .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-title {
  color: #022f78 !important;
}
.theme-new .cal-event.ev-special .ev-type,
.theme-new .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-type,
.theme-new .cal-event.ev-special .ev-loc,
.theme-new .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-loc,
.theme-new .cal-event.ev-special .ev-prof,
.theme-new .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-prof {
  color: #2b508f !important;
}

/* Dark Mode Events */
.theme-new.dark-mode .cal-event[data-ev-type="TD"],
.theme-new.dark-mode .cal-event[data-ev-type="CM"] {
  background: #201812 !important;
  border: 1px solid #3e2d20 !important;
  border-left: 3.5px solid #ea580c !important;
}
.theme-new.dark-mode .cal-event[data-ev-type="TD"] .ev-title,
.theme-new.dark-mode .cal-event[data-ev-type="CM"] .ev-title {
  color: #fff8f0 !important;
}
.theme-new.dark-mode .cal-event[data-ev-type="TD"] .ev-type,
.theme-new.dark-mode .cal-event[data-ev-type="CM"] .ev-type {
  color: #fbbf24 !important;
}
.theme-new.dark-mode .cal-event[data-ev-type="TD"] .ev-loc,
.theme-new.dark-mode .cal-event[data-ev-type="CM"] .ev-loc,
.theme-new.dark-mode .cal-event[data-ev-type="TD"] .ev-prof,
.theme-new.dark-mode .cal-event[data-ev-type="CM"] .ev-prof {
  color: #fed7aa !important;
}

.theme-new.dark-mode .cal-event.ev-special,
.theme-new.dark-mode .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) {
  background: #121824 !important;
  border: 1px solid #1e2c44 !important;
  border-left: 3.5px solid #3b82f6 !important;
}
.theme-new.dark-mode .cal-event.ev-special .ev-title,
.theme-new.dark-mode .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-title {
  color: #eff6ff !important;
}
.theme-new.dark-mode .cal-event.ev-special .ev-type,
.theme-new.dark-mode .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-type,
.theme-new.dark-mode .cal-event.ev-special .ev-loc,
.theme-new.dark-mode .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-loc,
.theme-new.dark-mode .cal-event.ev-special .ev-prof,
.theme-new.dark-mode .cal-event:not([data-ev-type="TD"]):not([data-ev-type="CM"]):not([data-ev-type="TP"]):not([data-ev-type="DS"]):not([data-ev-type="CC"]) .ev-prof {
  color: #93c5fd !important;
}

.theme-new .cal-event:hover {
  border-color: var(--green-pine) !important;
  overflow: visible !important;
  z-index: 5;
}

.theme-new .ev-loc {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  margin: 2px 0 0 0 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex-shrink: 0 !important;
}

/* Score UI is opt-in; the settings toggle adds scores-enabled to <html>. */
html:not(.scores-enabled) .score-pill,
html:not(.scores-enabled) .ri-badge,
html:not(.scores-enabled) #btn-score {
  display: none !important;
}

.theme-new .ev-prof {
  font-family: var(--font-mono) !important;
  font-size: 9.5px !important;
  font-weight: 500 !important;
  margin: 2px 0 0 0 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex-shrink: 0 !important;
  opacity: 0.85 !important;
}

.theme-new .ev-footer {
  margin-top: auto !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 3px !important;
  width: 100% !important;
  flex-shrink: 0 !important;
  padding-top: 2px !important;
}

.theme-new .ev-group-badge {
  font-family: var(--font-mono) !important;
  font-size: 8.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 1.5px 4px !important;
  border-radius: 3px !important;
  white-space: nowrap !important;
  margin: 0 !important;
}

.theme-new #resource-title {
  font-family: var(--font-serif) !important;
  font-size: 21px !important;
  font-weight: 400 !important;
  opacity: 1 !important;
  color: var(--text) !important;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.theme-new .ev-title {
  font-family: var(--font-serif) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.22 !important;
  letter-spacing: -0.01em !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  margin: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.theme-new .cal-event.ev-micro .ev-title {
  font-size: 10.5px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
  flex-shrink: 1 !important;
  margin: 0 !important;
}

.theme-new .cal-event.ev-micro .ev-loc {
  font-size: 9.5px !important;
  line-height: 1 !important;
  margin: 0 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  opacity: 0.9 !important;
}

.theme-new .cal-event.ev-compact .ev-title {
  font-size: 11px !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
}

.theme-new .cal-event.ev-standard .ev-title {
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: unset !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin: 0 !important;
}

.theme-new .ev-type {
  font-family: var(--font-mono) !important;
  font-size: 8.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 1.5px 4px !important;
  border-radius: 3px !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  margin: 0 !important;
}

.theme-new.dark-mode .ev-type {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.theme-new .sans-num {
  font-family: var(--font) !important;
  font-variant-numeric: lining-nums tabular-nums !important;
  font-feature-settings: 'lnum' 1 !important;
  font-weight: 400 !important;
  letter-spacing: normal !important;
}

/* ── Mobile Layout & Word-Fitting Rules (max-width: 768px) ── */
@media (max-width: 768px) {
  /* Day headers */
  .theme-new .day-head.day-target {
    background: var(--green-today-bg) !important;
  }
  .theme-new .day-head.day-target .day-name,
  .theme-new .day-head.day-target .day-num {
    color: var(--green-forest) !important;
  }
  .theme-new.dark-mode .day-head.day-target {
    background: rgba(245, 158, 11, 0.12) !important;
  }
  .theme-new.dark-mode .day-head.day-target .day-name,
  .theme-new.dark-mode .day-head.day-target .day-num {
    color: var(--green-forest) !important;
  }

  /* Focused Day View (PC zoom parity on mobile & desktop) */
  #days-header.has-focus .day-head:not(.focused),
  #grid.has-focus .day-col:not(.focused) {
    border-left: none !important;
    border-right: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  #days-header.has-focus .day-head.focused {
    border-left: 1px solid var(--border) !important;
    cursor: pointer;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 6px 14px !important;
    user-select: none;
  }

  #days-header.has-focus .day-head.focused .day-head-arrow {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 24px;
    line-height: 1;
    font-weight: 300;
    color: var(--muted);
    user-select: none;
    pointer-events: auto;
    cursor: pointer;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0;
    font-family: inherit;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.15s, transform 0.15s, background-color 0.15s;
  }

  .theme-new #days-header.has-focus .day-head.focused .day-head-arrow {
    color: var(--green-forest) !important;
    opacity: 0.75;
  }

  .theme-new.dark-mode #days-header.has-focus .day-head.focused .day-head-arrow {
    color: var(--green-forest) !important;
    opacity: 0.85;
  }

  #days-header.has-focus .day-head.focused .day-head-arrow:hover,
  #days-header.has-focus .day-head.focused .day-head-arrow:active {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.06);
  }

  .theme-new.dark-mode #days-header.has-focus .day-head.focused .day-head-arrow:hover,
  .theme-new.dark-mode #days-header.has-focus .day-head.focused .day-head-arrow:active,
  :root.dark-mode #days-header.has-focus .day-head.focused .day-head-arrow:hover,
  :root.dark-mode #days-header.has-focus .day-head.focused .day-head-arrow:active {
    background: rgba(255, 255, 255, 0.1);
  }

  #days-header.has-focus .day-head.focused .day-head-center {
    flex: 1 1 auto;
    min-width: 0;
  }

  .theme-new .day-head.focused {
    background: var(--green-today-bg) !important;
  }
  .theme-new .day-head.focused .day-num,
  .theme-new .day-head.focused .day-name {
    color: var(--green-forest) !important;
  }
  .theme-new.dark-mode .day-head.focused {
    background: rgba(245, 158, 11, 0.12) !important;
  }
  .theme-new.dark-mode .day-head.focused .day-num,
  .theme-new.dark-mode .day-head.focused .day-name {
    color: var(--green-forest) !important;
  }

  #grid.has-focus .day-col.focused .cal-event,
  .day-col.focused .cal-event {
    padding: 5px 7px !important;
    border-radius: 4px !important;
    border-left-width: 3.5px !important;
  }

  #grid.has-focus .day-col.focused .cal-event.ev-compact,
  .day-col.focused .cal-event.ev-compact {
    padding: 3px 5px !important;
  }

  #grid.has-focus .day-col.focused .cal-event.ev-micro,
  .day-col.focused .cal-event.ev-micro {
    padding: 0 5px !important;
  }

  #grid.has-focus .day-col.focused .cal-event .ev-title,
  .day-col.focused .cal-event .ev-title {
    font-family: var(--font-serif) !important;
    font-size: 12px !important;
    line-height: 1.22 !important;
    font-weight: 700 !important;
  }

  #grid.has-focus .day-col.focused .cal-event.ev-compact .ev-title,
  .day-col.focused .cal-event.ev-compact .ev-title {
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  #grid.has-focus .day-col.focused .cal-event.ev-micro .ev-title,
  .day-col.focused .cal-event.ev-micro .ev-title {
    font-size: 10.5px !important;
    line-height: 1 !important;
  }

  #grid.has-focus .day-col.focused .cal-event .ev-loc,
  .day-col.focused .cal-event .ev-loc {
    font-size: 10.5px !important;
    opacity: 0.8 !important;
  }

  #grid.has-focus .day-col.focused .cal-event .ev-prof,
  .day-col.focused .cal-event .ev-prof {
    display: block !important;
    font-size: 10px !important;
    opacity: 0.8 !important;
  }

  #grid.has-focus .day-col.focused .cal-event .ev-type,
  .day-col.focused .cal-event .ev-type {
    font-family: var(--font-mono) !important;
    font-size: 8.5px !important;
    padding: 1.5px 4px !important;
  }
}

/* Keep course titles readable when several selected groups share a mobile card. */
@media (max-width: 768px) {
  #calendar .cal-event .ev-title {
    min-height: 1.22em;
  }
  #calendar .cal-event .ev-footer {
    flex-wrap: nowrap !important;
    min-width: 0;
    overflow: hidden;
  }
  #calendar .cal-event .ev-group-badge {
    display: block !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #calendar .cal-event .ev-type {
    flex-shrink: 0;
  }
  #calendar .cal-event.ev-compact .ev-footer {
    display: none !important;
  }
  #calendar .cal-event.ev-micro .ev-title {
    flex: 1 1 auto;
  }
  #calendar .cal-event.ev-micro .ev-loc {
    max-width: 25%;
  }
  #calendar .cal-event.ev-micro .ev-footer {
    max-width: 35%;
    flex-shrink: 1 !important;
  }
  #grid:not(.has-focus) .cal-event.ev-micro .ev-loc,
  #grid:not(.has-focus) .cal-event.ev-micro .ev-footer {
    display: none !important;
  }
}

/* ── Course-Colors Mode (Une couleur par cours / matière) ── */
.theme-new.course-colors .cal-event[data-course-color="0"] {
  background: var(--cc-0-bg) !important;
  border: 1px solid var(--cc-0-border-card) !important;
  border-left: 3.5px solid var(--cc-0-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="0"] .ev-title { color: var(--cc-0-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="0"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="0"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="0"] .ev-prof { color: var(--cc-0-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="0"]:hover { border-color: var(--cc-0-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="1"] {
  background: var(--cc-1-bg) !important;
  border: 1px solid var(--cc-1-border-card) !important;
  border-left: 3.5px solid var(--cc-1-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="1"] .ev-title { color: var(--cc-1-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="1"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="1"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="1"] .ev-prof { color: var(--cc-1-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="1"]:hover { border-color: var(--cc-1-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="2"] {
  background: var(--cc-2-bg) !important;
  border: 1px solid var(--cc-2-border-card) !important;
  border-left: 3.5px solid var(--cc-2-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="2"] .ev-title { color: var(--cc-2-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="2"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="2"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="2"] .ev-prof { color: var(--cc-2-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="2"]:hover { border-color: var(--cc-2-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="3"] {
  background: var(--cc-3-bg) !important;
  border: 1px solid var(--cc-3-border-card) !important;
  border-left: 3.5px solid var(--cc-3-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="3"] .ev-title { color: var(--cc-3-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="3"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="3"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="3"] .ev-prof { color: var(--cc-3-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="3"]:hover { border-color: var(--cc-3-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="4"] {
  background: var(--cc-4-bg) !important;
  border: 1px solid var(--cc-4-border-card) !important;
  border-left: 3.5px solid var(--cc-4-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="4"] .ev-title { color: var(--cc-4-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="4"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="4"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="4"] .ev-prof { color: var(--cc-4-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="4"]:hover { border-color: var(--cc-4-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="5"] {
  background: var(--cc-5-bg) !important;
  border: 1px solid var(--cc-5-border-card) !important;
  border-left: 3.5px solid var(--cc-5-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="5"] .ev-title { color: var(--cc-5-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="5"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="5"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="5"] .ev-prof { color: var(--cc-5-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="5"]:hover { border-color: var(--cc-5-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="6"] {
  background: var(--cc-6-bg) !important;
  border: 1px solid var(--cc-6-border-card) !important;
  border-left: 3.5px solid var(--cc-6-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="6"] .ev-title { color: var(--cc-6-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="6"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="6"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="6"] .ev-prof { color: var(--cc-6-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="6"]:hover { border-color: var(--cc-6-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="7"] {
  background: var(--cc-7-bg) !important;
  border: 1px solid var(--cc-7-border-card) !important;
  border-left: 3.5px solid var(--cc-7-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="7"] .ev-title { color: var(--cc-7-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="7"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="7"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="7"] .ev-prof { color: var(--cc-7-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="7"]:hover { border-color: var(--cc-7-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="8"] {
  background: var(--cc-8-bg) !important;
  border: 1px solid var(--cc-8-border-card) !important;
  border-left: 3.5px solid var(--cc-8-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="8"] .ev-title { color: var(--cc-8-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="8"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="8"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="8"] .ev-prof { color: var(--cc-8-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="8"]:hover { border-color: var(--cc-8-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="9"] {
  background: var(--cc-9-bg) !important;
  border: 1px solid var(--cc-9-border-card) !important;
  border-left: 3.5px solid var(--cc-9-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="9"] .ev-title { color: var(--cc-9-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="9"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="9"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="9"] .ev-prof { color: var(--cc-9-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="9"]:hover { border-color: var(--cc-9-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="10"] {
  background: var(--cc-10-bg) !important;
  border: 1px solid var(--cc-10-border-card) !important;
  border-left: 3.5px solid var(--cc-10-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="10"] .ev-title { color: var(--cc-10-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="10"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="10"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="10"] .ev-prof { color: var(--cc-10-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="10"]:hover { border-color: var(--cc-10-border) !important; }

.theme-new.course-colors .cal-event[data-course-color="11"] {
  background: var(--cc-11-bg) !important;
  border: 1px solid var(--cc-11-border-card) !important;
  border-left: 3.5px solid var(--cc-11-border) !important;
}
.theme-new.course-colors .cal-event[data-course-color="11"] .ev-title { color: var(--cc-11-title) !important; }
.theme-new.course-colors .cal-event[data-course-color="11"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="11"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="11"] .ev-prof { color: var(--cc-11-meta) !important; }
.theme-new.course-colors .cal-event[data-course-color="11"]:hover { border-color: var(--cc-11-border) !important; }

/* Examens / Contrôles (DS, CC) en mode course-colors */
.theme-new.course-colors .cal-event[data-course-color="ds"] {
  background: #f8dede !important;
  border: 1px solid #e7b5b5 !important;
  border-left: 3.5px solid #a62a2a !important;
}
.theme-new.course-colors .cal-event[data-course-color="ds"] .ev-title { color: #260b0b !important; }
.theme-new.course-colors .cal-event[data-course-color="ds"] .ev-type,
.theme-new.course-colors .cal-event[data-course-color="ds"] .ev-loc,
.theme-new.course-colors .cal-event[data-course-color="ds"] .ev-prof { color: #6d2323 !important; }
.theme-new.course-colors .cal-event[data-course-color="ds"]:hover { border-color: #a62a2a !important; }

.theme-new.dark-mode.course-colors .cal-event[data-course-color="ds"] {
  background: #291116 !important;
  border: 1px solid #4a1f28 !important;
  border-left: 3.5px solid #f43f5e !important;
}
.theme-new.dark-mode.course-colors .cal-event[data-course-color="ds"] .ev-title { color: #fff1f2 !important; }
.theme-new.dark-mode.course-colors .cal-event[data-course-color="ds"] .ev-type,
.theme-new.dark-mode.course-colors .cal-event[data-course-color="ds"] .ev-loc,
.theme-new.dark-mode.course-colors .cal-event[data-course-color="ds"] .ev-prof { color: #fda4af !important; }
.theme-new.dark-mode.course-colors .cal-event[data-course-color="ds"]:hover { border-color: #f43f5e !important; }

.theme-new.course-colors .cal-event:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}
.theme-new.dark-mode.course-colors .cal-event:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}
/* #endregion */

/* #region Problem Reporting Modal */
.problem-report-trigger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2, #374151);
  cursor: pointer;
  transition: all 0.15s ease;
}
.problem-report-trigger-btn:hover {
  background: var(--hover, #f3f4f6);
  border-color: var(--border-strong, #d1d5db);
  color: var(--text, #111827);
}
.dark-mode .problem-report-trigger-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}
.dark-mode .problem-report-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

#problem-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#problem-modal-overlay.open {
  display: flex;
}

.problem-modal {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
  padding: 22px 24px;
  animation: problemModalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes problemModalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.problem-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.problem-modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #111827);
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.problem-modal-sub {
  font-size: 12px;
  color: var(--muted, #6b7280);
  line-height: 1.4;
}
.problem-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
}
.problem-modal-close:hover {
  background: var(--hover, #f3f4f6);
  color: var(--text);
}

.problem-field {
  margin-bottom: 14px;
}
.problem-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2, #374151);
  margin-bottom: 6px;
}
.problem-field label .required {
  color: #dc2626;
}

.problem-category-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.problem-chip {
  cursor: pointer;
}
.problem-chip input {
  display: none;
}
.problem-chip span {
  display: inline-block;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--app-bg, #f9fafb);
  color: var(--text-2, #4b5563);
  transition: all 0.12s;
}
.problem-chip input:checked + span {
  background: var(--green-light, #e8f5ec);
  color: var(--green-forest, #165b35);
  border-color: rgba(22, 91, 53, 0.3);
  font-weight: 600;
}

.problem-field textarea,
.problem-field input[type="email"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface, #ffffff);
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.problem-field textarea:focus,
.problem-field input[type="email"]:focus {
  outline: none;
  border-color: var(--green-forest, #165b35);
  box-shadow: 0 0 0 2px rgba(22, 91, 53, 0.15);
}
.problem-field textarea {
  resize: vertical;
  min-height: 80px;
}
.problem-hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.problem-context-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--app-bg, #f9fafb);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.4;
}
.problem-context-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--green-forest, #165b35);
}

.problem-error {
  padding: 8px 10px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}
.problem-success {
  padding: 10px 12px;
  background: #ecfdf5;
  color: #065f46;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  text-align: center;
}

.problem-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.problem-modal-actions .btn-cancel {
  padding: 7px 14px;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-2);
  font-family: var(--font);
}
.problem-modal-actions .btn-submit {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--green-forest, #165b35);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s;
}
.problem-modal-actions .btn-submit:hover {
  opacity: 0.92;
}
.problem-modal-actions .btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Dark mode overrides */
.dark-mode .problem-modal {
  background: var(--sidebar-bg, #1a1510);
  border-color: var(--border, #2b221a);
}
.dark-mode .problem-modal-header h3 { color: var(--text, #f7eee5); }
.dark-mode .problem-field label { color: var(--text-2, #cbbbae); }
.dark-mode .problem-field textarea,
.dark-mode .problem-field input[type="email"] {
  background: var(--app-bg, #14100d);
  border-color: var(--border, #2b221a);
  color: var(--text, #f7eee5);
}
.dark-mode .problem-chip span {
  background: var(--app-bg, #14100d);
  border-color: var(--border, #2b221a);
  color: var(--muted, #9c8b7b);
}
.dark-mode .problem-chip input:checked + span {
  background: var(--green-pill-bg, #342216);
  color: var(--green-forest, #f59e0b);
  border-color: var(--green-pill-border, #563922);
}
.dark-mode .problem-context-note {
  background: var(--app-bg, #14100d);
  color: var(--muted, #9c8b7b);
}
/* #endregion */

/* #region Willow Local Mods */
.willow-mods-trigger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2, #374151);
  cursor: pointer;
  transition: all 0.15s ease;
}
.willow-mods-trigger-btn:hover {
  background: var(--hover, #f3f4f6);
  border-color: var(--border-strong, #d1d5db);
  color: var(--text, #111827);
}
.dark-mode .willow-mods-trigger-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}
.dark-mode .willow-mods-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.willow-mods-manager {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--font);
}

.willow-mods-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 16px;
  box-sizing: border-box;
}
.willow-mods-modal-overlay.open {
  opacity: 1;
}

.willow-mods-modal {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: problemModalIn 0.2s ease-out;
}

.willow-mods-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.willow-mods-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #111827);
  margin: 0 0 2px 0;
}
.willow-mods-modal-sub {
  font-size: 12px;
  color: var(--muted, #6b7280);
  margin: 0;
}
.willow-mods-modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.1s, color 0.1s;
}
.willow-mods-modal-close:hover {
  background: var(--hover, #f3f4f6);
  color: var(--text);
}

.willow-mods-modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.willow-mods-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
}
.willow-mods-banner-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
.dark-mode .willow-mods-banner-warning {
  background: #2d2211;
  border-color: #573e1c;
  color: #fbbf24;
}
.willow-mods-banner-info {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.dark-mode .willow-mods-banner-info {
  background: #112d20;
  border-color: #1e523a;
  color: #34d399;
}
.willow-mods-banner-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.willow-mods-banner-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.willow-mods-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--app-bg, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
}
.willow-mods-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.willow-mods-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.willow-mods-security-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 11.5px;
  color: #b91c1c;
  line-height: 1.4;
}
.dark-mode .willow-mods-security-note {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.willow-mods-security-note svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.willow-mods-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.willow-mods-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface, #ffffff);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.willow-mods-btn:hover {
  background: var(--hover, #f3f4f6);
}
.willow-mods-btn-primary {
  background: var(--green-forest, #165b35);
  color: #ffffff;
  border-color: transparent;
}
.willow-mods-btn-primary:hover {
  opacity: 0.92;
  background: var(--green-forest, #165b35);
}
.willow-mods-btn-small {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface, #ffffff);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.willow-mods-btn-small.willow-mods-btn-primary {
  background: var(--green-forest, #165b35);
  color: #fff;
  border-color: transparent;
}

.willow-mods-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.willow-mods-empty {
  text-align: center;
  padding: 24px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.willow-mod-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #ffffff);
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.willow-mod-card.is-disabled {
  opacity: 0.6;
  background: var(--app-bg, #f9fafb);
}

.willow-mod-order-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.willow-mod-btn-arrow {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
}
.willow-mod-btn-arrow:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}
.willow-mod-btn-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.willow-mod-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.willow-mod-main-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.willow-mod-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.willow-mod-badge.badge-css {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}
.dark-mode .willow-mod-badge.badge-css {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}
.willow-mod-badge.badge-js {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}
.dark-mode .willow-mod-badge.badge-js {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.willow-mod-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.willow-mod-phase-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.willow-mod-phase-select {
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--app-bg, #f9fafb);
  color: var(--text-2);
  border-radius: 5px;
  padding: 2px 6px;
  outline: none;
  font-family: var(--font);
}
.willow-mod-phase-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.willow-mod-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.willow-mod-btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.willow-mod-btn-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.willow-mods-footer {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.willow-mods-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.willow-mods-safe-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.willow-mods-link {
  font-size: 11.5px;
  color: var(--green-forest, #165b35);
  text-decoration: underline;
  cursor: pointer;
}
.dark-mode .willow-mods-link {
  color: #f59e0b;
}
.willow-mods-btn-copy {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--app-bg, #f9fafb);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
}
.willow-mods-btn-copy:hover {
  background: var(--hover);
}
.willow-mods-device-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.dark-mode .willow-mods-modal {
  background: var(--sidebar-bg, #1a1510);
  border-color: var(--border, #2b221a);
}
.dark-mode .willow-mods-toggle-row {
  background: var(--app-bg, #14100d);
  border-color: var(--border, #2b221a);
}
.dark-mode .willow-mod-card {
  background: var(--surface, #1e1914);
  border-color: var(--border, #2b221a);
}
.dark-mode .willow-mod-card.is-disabled {
  background: var(--app-bg, #14100d);
}
.dark-mode .willow-mod-phase-select {
  background: var(--app-bg, #14100d);
  border-color: var(--border, #2b221a);
}
.dark-mode .willow-mods-btn-copy {
  background: var(--app-bg, #14100d);
  border-color: var(--border, #2b221a);
}
/* #endregion */
