/* ============================================ */
/*  RESET & VARIABLES                           */
/* ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --orange-50: #fff7ed;
  --orange-500: #f97316;
  --red-50: #fef2f2;
  --red-500: #ef4444;
  --purple-50: #faf5ff;
  --purple-500: #a855f7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-350: #b6bcc5;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 237px;
  --sidebar-collapsed-w: 72px;
  --radius: 14px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.10);
  --shadow: 0 2px 8px rgba(0,0,0,0.11), 0 1px 3px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 10px -1px rgba(0,0,0,0.12), 0 2px 5px -2px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 20px -3px rgba(0,0,0,0.13), 0 4px 8px -4px rgba(0,0,0,0.07);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg,
    rgba(220,252,231,0.3) 0%,
    rgba(219,234,254,0.3) 25%,
    rgba(250,245,255,0.2) 50%,
    rgba(255,247,237,0.2) 75%,
    rgba(220,252,231,0.3) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--gray-800);
  overflow: hidden;
}

/* ============================================ */
/*  APP LAYOUT                                  */
/* ============================================ */
.app {
  display: flex;
  height: 100vh;
}

/* ============================================ */
/*  SIDEBAR                                     */
/* ============================================ */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: width 0.22s ease;
  overflow: hidden;
}

/* ---- Sidebar plegat ---- */
.sidebar.sidebar-collapsed {
  width: var(--sidebar-collapsed-w);
}
.sidebar.sidebar-collapsed .logo-texts {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar.sidebar-collapsed .sidebar-nav {
  padding-left: 0;
  padding-right: 0;
}
.sidebar.sidebar-collapsed .nav-section-title {
  display: none;
}
.sidebar.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0.6rem 0;
  border-radius: 0;
}
.sidebar.sidebar-collapsed .nav-item .nav-label,
.sidebar.sidebar-collapsed .nav-item > span[data-i18n] {
  display: none;
}
.sidebar.sidebar-collapsed .nav-item .nav-help {
  display: none !important;
}
.sidebar.sidebar-collapsed .nav-item .nav-icon {
  width: 100%;
  font-size: 1.15rem;
}
.sidebar.sidebar-collapsed .sidebar-footer .school-badge {
  display: none;
}
.sidebar.sidebar-collapsed #sidebarToastArea {
  display: none;
}
.sidebar.sidebar-collapsed .sidebar-footer {
  padding: 0.5rem 0;
}
.sidebar.sidebar-collapsed .sidebar-footer-row {
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 0;
}
.sidebar.sidebar-collapsed .sfr-item {
  width: 100%;
  justify-content: center;
  padding: 0.45rem 0;
}
.sidebar.sidebar-collapsed .sidebar-help-toggle.sfr-item {
  margin-left: 0;
}

.sidebar-logo {
  padding: 1.3rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--gray-100);
  position: relative;
}
.logo-texts {
  flex: 1;
  min-width: 0;
  overflow: visible;
  position: relative;
  z-index: 2;
  transition: opacity 0.2s, width 0.2s;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: transparent;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: background 0.15s;
}
.sidebar-logo .logo-icon:hover {
  background: var(--gray-100);
}
.sidebar-logo .logo-icon:hover + .logo-texts .logo-wordmark-link {
  z-index: 3;
}
.logo-icon-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.logo-icon-chevron {
  display: none !important;
  position: absolute;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-700);
}
.sidebar-logo .logo-icon:hover .logo-icon-img {
  display: none;
}
.sidebar-logo .logo-icon:hover .logo-icon-chevron {
  display: block !important;
}
.sidebar-logo .logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.3px;
}
.sidebar-logo .logo-wordmark-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.sidebar-logo .logo-wordmark {
  display: block;
  width: 92px;
  max-width: 100%;
  height: auto;
  transform: translate(-3px, 3px);
}
.dash-welcome-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.5rem;
  color: var(--gray-800);
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}
.dash-welcome-title .dash-welcome-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  transform: translateY(0);
}
.dash-welcome-title .dash-welcome-wordmark {
  width: 96px;
  height: auto;
  display: block;
  transform: translateX(-3px);
}
.sidebar-nav {
  flex: 1;
  padding: 0.8rem 0.7rem;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 0.3rem;
}
.nav-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.6rem 0.7rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem 0.6rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 2px;
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}
.nav-item.active {
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.nav-item.active .nav-icon { color: var(--green-600); }

/* Nav help tooltip */
.nav-item .nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-help {
  display: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  flex-shrink: 0;
  position: absolute;
  top: 50%;
  right: -3px;
  transform: translateY(-50%);
  cursor: default;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.nav-item:hover .nav-help { display: inline-block; }
body.help-hidden .nav-help { display: none !important; }
.nav-help-tooltip {
  display: none;
  position: fixed;
  min-width: 210px;
  max-width: 290px;
  padding: 0.5rem 0.7rem;
  background: #fff;
  color: var(--gray-700);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  white-space: normal;
  z-index: 99999;
  pointer-events: none;
}
.nav-help-tooltip-global {
  display: none;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--gray-100);
}
#sidebarToastArea {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
#sidebarToastArea:empty {
  margin-bottom: 0;
}
.sidebar-toast {
  font-size: 0.75rem;
  line-height: 1.3;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  overflow: hidden;
  background: var(--gray-50);
  color: var(--gray-600);
}
.sidebar-toast.toast-success i { color: var(--green-600); }
.sidebar-toast.toast-error    { background: var(--red-600, #dc2626); color: #fff; }
.sidebar-toast.toast-error i  { color: #fff; }
.sidebar-toast.toast-info i   { color: var(--blue-500);  }
.sidebar-toast .sidebar-toast-inner {
  display: block;
}
.sidebar-toast.toast-enter .sidebar-toast-inner {
  animation: toastRollIn 0.2s ease forwards;
}
.sidebar-toast.toast-exit .sidebar-toast-inner {
  animation: toastRollOut 0.2s ease forwards;
}
@keyframes toastRollIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes toastRollOut {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(-100%); opacity: 0; }
}
.school-badge {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 0.78rem;
  color: var(--gray-600);
  text-align: center;
}
.school-badge .school-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.82rem;
}
.sidebar-footer-row {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
}
.sfr-item {
  display: flex;
  align-items: center;
  padding: 0.3rem;
  border-radius: 6px;
  color: var(--gray-500);
  font-size: 0.95rem;
  cursor: default;
  transition: color 0.15s, background 0.15s;
}
.sfr-item:hover {
  color: var(--gray-700);
  background: var(--gray-50);
}
.sidebar-help-toggle.sfr-item {
  margin-left: auto;
  cursor: pointer;
}
.sidebar-help-toggle.sfr-item.help-off {
  color: var(--gray-300);
}
.sidebar-help-toggle.sfr-item.help-off:hover {
  color: var(--gray-500);
}
/* Tooltip für sfr-items (positioned via JS) */
.sfr-tip {
  display: none;
  position: fixed;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  z-index: 99999;
  pointer-events: none;
  color: var(--gray-700);
}

/* Quan la barra lateral NO està plegada, mostra el text del tip inline */
.sidebar:not(.sidebar-collapsed) .sfr-tip {
  display: inline-block;
  position: static;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 0 0.35rem;
  font-size: 0.8rem;
  box-shadow: none;
  z-index: auto;
  pointer-events: none;
  color: var(--gray-600);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-tip {
  display: none;
  position: fixed;
  background: var(--gray-800);
  color: #fff;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  z-index: 99999;
  pointer-events: none;
}

/* ============================================ */
/*  MAIN CONTENT                                */
/* ============================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
}
.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-weight: 400;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ============================================ */
/*  WINDOWS-STYLE MENU BAR (suplències)         */
/* ============================================ */
.win-menubar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: #eceef1;
  border-bottom: 1px solid #c8cdd4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
  flex-shrink: 0;
  height: 36px;
  padding: 0;
  position: relative;
  z-index: 200;
}
.win-menubar-items {
  display: flex;
  align-items: stretch;
}
.win-menubar-right {
  display: flex;
  align-items: stretch;
  border-left: 1px solid #c8cdd4;
}

/* Each menu item: same fixed width, divided by a right border */
.win-menu-item {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 170px;
  border-right: 1px solid #c8cdd4;
  font-size: 0.8rem;
  font-weight: 500;
  color: #3a3f47;
  user-select: none;
  white-space: nowrap;
}
.win-menu-item.menu-disabled {
  opacity: 0.38;
}
.win-menu-item.menu-disabled .win-menu-label,
.win-menu-item.menu-disabled .win-menu-chevron,
.win-menu-item.menu-disabled .win-submenu-item {
  pointer-events: none;
  cursor: not-allowed;
}
.win-menu-item.menu-disabled:hover > .win-menu-label,
.win-menubar:not(.dc-menubar) .win-menu-item.menu-disabled:hover > .win-menu-label {
  background: transparent;
  color: inherit;
}

/* Label area: ocupa tot l'ample */
.win-menu-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chevron (suplències): botó separat per desplegar subaccions.
   Sense position:relative perquè el submenu es posicioni respecte al win-menu-item pare. */
.win-menu-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  flex-shrink: 0;
  border-left: 1px solid #c8cdd4;
  cursor: default;
  font-size: 0.7rem;
  color: #6b7280;
}
.win-menu-chevron:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Suplències menubar: label canvia color en hover sobre l'ítem sencer */
.win-menubar:not(.dc-menubar) .win-menu-item:hover > .win-menu-label {
  background: var(--color-primary);
  color: #fff;
}
/* Suplències: el submenú s'obre en hover sobre el CHEVRON */
.win-menubar:not(.dc-menubar) .win-menu-chevron:hover > .win-submenu { display: block; }

/* Submenú del chevron: aliniat amb el left del label (= left del win-menu-item),
   ample = 100% de l'ítem (label + chevron) + 25px */
.win-menu-chevron > .win-submenu {
  left: 0;
  width: calc(100% + 25px);
}

/* dc-menubar: label canvia color en hover (feedback visual) */
.dc-menubar .win-menu-item:hover > .win-menu-label {
  background: var(--color-primary);
  color: #fff;
}
/* dc-menubar: submenú s'obre amb CLIC (classe dc-menu-open gestionada per JS) */
.dc-menubar .win-menu-item.dc-menu-open > .win-menu-label {
  background: var(--color-primary);
  color: #fff;
}
.dc-menubar .win-menu-item.dc-menu-open > .win-submenu { display: block; }

.win-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 195px;
  background: #f8f9fa;
  border: 1px solid #b0b4bb;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.14);
  z-index: 500;
  padding: 3px 0;
}
.win-submenu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 10px;
  font-size: 0.8rem;
  font-weight: 400;
  color: #2d3138;
  cursor: default;
  white-space: nowrap;
}
.win-submenu-item:hover,
.win-submenu-item.dc-menu-mode-active {
  background: var(--color-primary);
  color: #fff;
}
.win-submenu-sep {
  height: 1px;
  background: #c8cdd4;
  margin: 3px 6px;
}
/* Controls numèrics visibles sobre fons de color primari (hover) */
.win-submenu-item:hover .cal-row-height-controls button,
.win-submenu-item.dc-menu-mode-active .cal-row-height-controls button {
  border-color: rgba(255,255,255,0.55);
  color: #fff;
}
.win-submenu-item:hover .cal-row-height-controls button:hover:not([disabled]),
.win-submenu-item.dc-menu-mode-active .cal-row-height-controls button:hover:not([disabled]) {
  background: rgba(255,255,255,0.2);
}
.win-submenu-item:hover .cal-row-height-val,
.win-submenu-item.dc-menu-mode-active .cal-row-height-val {
  color: rgba(255,255,255,0.9);
}
/* Cascading submenu (2n nivell) */
.win-has-sub {
  position: relative;
}
.win-has-sub > .win-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: -3px;
  min-width: 150px;
  background: #f8f9fa;
  border: 1px solid #b0b4bb;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.14);
  z-index: 502;
  padding: 3px 0;
}
.win-has-sub:hover > .win-sub {
  display: block;
}

/* Toggle buttons (right side): estil igual que els ítems de menú */
.win-menubar .btn-tab-action {
  height: 100%;
  width: 38px;
  border-radius: 0 !important;
  border: none;
  border-right: 1px solid #c8cdd4;
  background: transparent;
  font-size: 0.9rem;
  color: #4a4f58;
}
.win-menubar .btn-tab-action:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.win-menubar .btn-tab-action.active {
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  color: var(--color-primary);
}
.win-menubar .save-indicator {
  font-size: 0.72rem;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f2f2f2 0%, #f0f0f0 45%, #c1c3c7 100%);
  box-shadow: inset 4px 0 12px rgba(0,0,0,0.06);
}
/* Les menubars (36px) ja separen prou — reduïm el padding-top */
.content-area:has(#view-professors-absents.active),
.content-area:has(#view-notifica-incidencia.active) {
  padding-top: 0.75rem;
}
/* Calendari: igualem padding amb absències (top reduït, sense extra horizontal) */
.content-area:has(#view-eines-calendari.active) {
  padding-top: 0.75rem;
}
.content-area:has(.importador-view.active) {
  padding: 0;
  overflow: hidden;
}
.importador-view.active {
  height: 100%;
}
.importador-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 74px);
  border: 0;
  background: #fff;
}

/* ============================================ */
/*  CARDS                                       */
/* ============================================ */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e6e7e9;
}
.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-body {
  padding: 1.2rem;
}

/* ============================================ */
/*  STAT CARDS                                  */
/* ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow);
  padding: 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }

/* ============================================ */
/*  ACTIVAR BORDERS CARDS                       */
/*  Per restaurar els borders eliminats,        */
/*  substituir "border: none" per:              */
/*                                              */
/*  .stat-card (línia ~788):                    */
/*    border: 1px solid var(--gray-200)         */
/*                                              */
/*  .stat-card en tema Graphite (línia ~3775):  */
/*    border: 1px solid #d8dade                 */
/*                                              */
/*  .dash-feature-card (línia ~3415):           */
/*    border: 1px solid #d8dade                 */
/*                                              */
/*  .card (línia ~752) — no s'ha eliminat,      */
/*    border: 1px solid var(--gray-200)         */
/* ============================================ */

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.green  { background: var(--green-50);  color: var(--green-600); }
.stat-icon.blue   { background: var(--blue-50);   color: var(--blue-600); }
.stat-icon.orange { background: var(--orange-50); color: var(--orange-500); }
.stat-icon.red    { background: var(--red-50);    color: var(--red-500); }
.stat-icon.purple { background: var(--purple-50); color: var(--purple-500); }
.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.stat-info .stat-label {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

/* ============================================ */
/*  FORMS & INPUTS                              */
/* ============================================ */
.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 9px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.12);
}
.form-group textarea {
  resize: vertical;
  line-height: 1.45;
}
.form-group select { cursor: pointer; padding-right: 2rem; }
.form-group input[type="date"] { cursor: pointer; }

/* ============================================ */
/*  BUTTONS                                     */
/* ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-700); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }
.btn-blue { background: var(--blue-600); color: #fff; }
.btn-blue:hover:not(:disabled) { background: #1d4ed8; }
.btn-orange { background: var(--orange-500); color: #fff; }
.btn-orange:hover:not(:disabled) { background: #ea580c; }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.45rem; font-size: 0.75rem; }

/* ============================================ */
/*  SUPLENCIA GRID TABLE                        */
/* ============================================ */
.suplencia-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  table-layout: fixed;
}
.suplencia-grid thead th {
  background: var(--gray-50);
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 2;
}
.suplencia-grid tbody tr { transition: background 0.1s; height: 48px; }
.suplencia-grid tbody td { overflow: hidden; white-space: nowrap; }
.suplencia-grid tbody tr:nth-child(odd)  { background: #ffffff; }
.suplencia-grid tbody tr:nth-child(even) { background: #f7f8fa; }
.suplencia-grid td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--gray-300);
  border-right: 1px solid var(--gray-300);
  vertical-align: middle;
}
.suplencia-grid td:last-child { border-right: none; }
.suplencia-grid thead th {
  border-right: 1px solid var(--gray-300);
}
.suplencia-grid thead th:last-child { border-right: none; }
.suplencia-grid .hora-cell {
  font-weight: 700;
  color: var(--gray-700);
  font-size: 0.9rem;
  white-space: nowrap;
  width: 90px;
  user-select: none;
}
.slot-present-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  margin: 0;
}
.slot-present-label input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}
.suplencia-grid tr.row-present .hora-cell {
  color: var(--gray-300);
  text-decoration: line-through;
  font-weight: 400;
}
.suplencia-grid tr.row-present td {
  opacity: 0.38;
  pointer-events: none;
}
.suplencia-grid tr.row-present .hora-cell {
  opacity: 1;
  pointer-events: auto;
}
.suplencia-grid .curs-cell {
  font-weight: 600;
  color: var(--gray-700);
  width: 80px;
}
.suplencia-grid .materia-cell {
  color: var(--gray-700);
  width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.suplencia-grid .indicacions-cell {
  width: 180px;
  max-width: 180px;
  overflow: hidden;
}
.suplencia-grid .suplent-cell select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--gray-50);
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.suplencia-grid .suplent-cell select:focus {
  border-color: var(--green-500);
  outline: none;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}
.suplencia-grid .suplent-cell select.assigned {
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-800);
  font-weight: 600;
}
.indicacions-display {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  min-height: 2em;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  transition: background 0.1s;
}
.indicacions-display:hover {
  background: var(--gray-100);
}
.indicacions-preview {
  flex: 1;
  display: block;
  font-size: 0.82rem;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.indicacions-preview:empty::before {
  content: '—';
  color: var(--gray-300);
}
.indicacions-pencil {
  font-size: 0.7rem;
  color: var(--gray-400);
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.indicacions-display:hover .indicacions-pencil {
  opacity: 1;
}

/* Indicacions floating editor overlay */
.indicacions-overlay {
  position: fixed;
  z-index: 9000;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.indicacions-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  gap: 0.5rem;
  flex-shrink: 0;
}
.indicacions-overlay-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}
.indicacions-overlay-close {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: 5px;
  line-height: 1;
  transition: color 0.1s, background 0.1s;
}
.indicacions-overlay-close:hover {
  color: var(--gray-700);
  background: var(--gray-200);
}
.indicacions-editor-content {
  flex: 1;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--gray-800);
  overflow-y: auto;
  outline: none;
  line-height: 1.5;
  word-break: break-word;
}
.suplencia-grid tr.row-free td {
  background: var(--gray-50);
  color: var(--gray-500);
}
.suplencia-grid tr.row-free.row-present td {
  opacity: 0.38;
  pointer-events: none;
}
.suplencia-grid tr.row-free.row-present .hora-cell {
  opacity: 1;
  pointer-events: auto;
}
.suplencia-grid .estat-cell {
  white-space: nowrap;
  text-align: center;
  width: 36px;
  padding: 0.4rem 0.3rem;
}

/* ============================================ */
/*  SUPLENCIA TAB TOOLBAR                     */
/* ============================================ */
.suplencia-tab-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0;
}
.tab-toolbar-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}
.tab-toolbar-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.suplencia-tabs-wrapper {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  gap: 0.25rem;
}
.tab-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  align-self: stretch;
  font-size: 0.7rem;
  color: var(--gray-200);
  cursor: default;
  pointer-events: none;
  background: none;
  border: none;
  padding: 0;
}
.tab-nav-arrow.tab-arrow-enabled {
  color: var(--gray-400);
  cursor: pointer;
  pointer-events: auto;
}
.tab-nav-arrow.tab-arrow-enabled:hover {
  color: var(--gray-600);
}
.tab-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.tab-group .suplencia-tab {
  border-radius: 0;
  border-bottom: none;
}
.tab-group .suplencia-tab:first-of-type {
  border-radius: 0 8px 0 0;
}
.tab-group .suplencia-tab:last-child {
  border-bottom: 1px solid var(--gray-200);
  border-radius: 0 0 8px 0;
}
.tab-group-label {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  user-select: none;
  border-bottom: 2px solid var(--green-200);
  background: var(--green-50);
  border-radius: 6px 6px 0 0;
}

/* ─── Dropdown mode ──────────────────────────────────── */
.tab-dropdown-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
}
.tab-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;
  background: var(--gray-100);
  color: var(--gray-500);
  user-select: none;
  transition: all 0.15s;
}
.tab-dropdown-trigger:hover {
  background: var(--gray-50);
  color: var(--gray-700);
}
.tab-dropdown-trigger.active,
.tab-dropdown-trigger.open {
  background: #fff;
  border-color: var(--gray-200);
  border-bottom-color: #fff;
  color: var(--green-700);
  font-weight: 600;
}
.tab-dropdown-trigger .tab-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.tab-dropdown-trigger .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  white-space: nowrap;
  font-size: 0.8rem;
}
.tab-dropdown-trigger .tab-date-line {
  font-size: 0.67rem;
  color: var(--gray-400);
  font-weight: 400;
  white-space: nowrap;
}
.tab-dropdown-trigger.active .tab-date-line {
  color: var(--gray-400);
}
.tab-dropdown-chevron {
  font-size: 0.6rem;
  transition: transform 0.15s;
}
.tab-dropdown-menu {
  display: none;
  position: fixed;
  z-index: 2000;
  min-width: 180px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  overflow: hidden;
}
.tab-dropdown-menu.open {
  display: block;
}
.tab-dropdown-trigger.open .tab-dropdown-chevron,
.tab-dropdown-trigger:has(+ .tab-dropdown-menu.open) .tab-dropdown-chevron {
  transform: rotate(180deg);
}
.tab-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-100);
}
.tab-dropdown-item:last-child { border-bottom: none; }
.tab-dropdown-item:hover { background: var(--gray-50); }
.tab-dropdown-item.active {
  background: var(--green-50);
  color: var(--green-700);
  font-weight: 600;
}
.tab-dropdown-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 1rem;
  color: var(--gray-400);
  line-height: 1;
  margin-left: 0.5rem;
  border-radius: 3px;
}
.tab-dropdown-close:hover { color: var(--red-500); background: var(--red-50); }

/* ============================================ */
/*  SUPLENCIA TABS                             */
/* ============================================ */
.suplencia-tabs {
  display: flex;
  gap: 0.2rem;
  padding-bottom: 0;
  overflow-x: auto;
  align-items: flex-end;
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.suplencia-tabs::-webkit-scrollbar {
  display: none;
}
.suplencia-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  max-width: 220px;
  font-family: inherit;
}
.suplencia-tab:hover {
  background: var(--gray-50);
  color: var(--gray-700);
}
.suplencia-tab.active {
  background: #fff;
  border-color: var(--gray-200);
  border-bottom-color: #fff;
  color: var(--green-700);
  font-weight: 600;
}
.suplencia-tab .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
  white-space: nowrap;
}
.suplencia-tab .tab-date {
  font-size: 0.68rem;
  color: var(--gray-400);
  font-weight: 400;
}
.suplencia-tab.active .tab-date { color: var(--green-500); }

/* Pestanya de 2 línies (sense agrupació per dia) */
.suplencia-tab.tab-two-line {
  align-items: center;
}
.suplencia-tab .tab-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.suplencia-tab .tab-body .tab-label {
  max-width: 140px;
}
.suplencia-tab .tab-date-line {
  font-size: 0.67rem;
  color: var(--gray-400);
  font-weight: 400;
  white-space: nowrap;
}
.suplencia-tab.active .tab-date-line { color: var(--gray-400); }
.suplencia-tab .tab-close-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.15rem 0.15rem;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
}
.suplencia-tab .tab-close-btn:hover {
  color: var(--red-500);
  background: rgba(239, 68, 68, 0.1);
}
.suplencia-tab.active .tab-close-btn { color: var(--green-500); }
.suplencia-tab.active .tab-close-btn:hover {
  color: var(--red-500);
  background: rgba(239, 68, 68, 0.12);
}
.suplencia-tab-new {
  background: var(--green-50);
  border-color: var(--green-200);
  color: var(--green-600);
  font-weight: 600;
  font-family: inherit;
}
.suplencia-tab-new:hover { background: var(--green-100); }
.suplencia-tab-new.active {
  background: #fff;
  border-bottom-color: #fff;
}
.tab-dirty-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange-500);
  flex-shrink: 0;
}

/* ============================================ */
/*  CHECKBOX GRID (Alliberades / Absents)      */
/* ============================================ */
.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--gray-700);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  width: 6.4rem;
  box-sizing: border-box;
  transition: background 0.15s;
}
.checkbox-label:hover {
  background: var(--green-100);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--green-600);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ============================================ */
/*  BRUSH / CLEAR BUTTONS                      */
/* ============================================ */
.btn-brush {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  margin-left: 0;
  flex-shrink: 0;
  font-size: 0.82rem;
}
.btn-brush:hover {
  background: var(--red-50, #fef2f2);
  border-color: var(--red-400, #f87171);
  color: var(--red-500, #ef4444);
}
.btn-close-sup {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--gray-300);
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
}
.btn-close-sup:hover {
  background: var(--red-50, #fef2f2);
  border-color: var(--red-500, #ef4444);
  color: var(--red-500, #ef4444);
}

/* ============================================ */
/*  BADGES                                      */
/* ============================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.85rem;
}
.badge-free { color: var(--gray-300); font-size: 0.7rem; }
.badge { display:inline-block; padding:2px 8px; border-radius:20px; font-size:0.75rem; font-weight:600; }
.badge-green  { background: var(--green-100);  color: var(--green-700);  }
.badge-blue   { background: var(--blue-100);   color: var(--blue-600);   }
.badge-orange { background: var(--orange-50);  color: var(--orange-500); }
.badge-gray   { background: var(--gray-100);   color: var(--gray-500);   }

/* Botó notificació per fila */
.slot-notify-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 1.15rem;
  position: relative;
  transition: color 0.1s;
}
.slot-notify-btn:hover { transform: none; }

/* Estat pendent: avió gris, hover una mica més fosc */
.slot-notify-btn.pending { color: #4b5563; opacity: 0.5; }
.slot-notify-btn.pending:hover { color: #374151; opacity: 0.65; }

/* Estat notificat: avió verd */
.slot-notify-btn.notified { color: #16a34a; }
.slot-notify-btn.sending { color: #2563eb; animation: notifPulse 0.9s ease-in-out infinite; }
.slot-notify-btn.error { color: #dc2626; }

@keyframes notifPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* Missatge inline post-notificació */
.notif-flash {
  font-size: 11px;
  color: #16a34a;
  font-weight: 600;
  margin-left: 6px;
  white-space: nowrap;
  animation: fadeOut 1s ease forwards;
}
@keyframes fadeOut {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================ */
/*  VIEWS                                       */
/* ============================================ */
.view { display: none; }
.view.active {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ============================================ */
/*  EMPTY STATE                                 */
/* ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.8rem; opacity: 0.6; }
.empty-state .empty-title { font-size: 1.1rem; font-weight: 600; color: var(--gray-600); margin-bottom: 0.3rem; }
.empty-state .empty-text { font-size: 0.88rem; }

/* ============================================ */
/*  SUPLENCIES LIST                             */
/* ============================================ */
.suplencies-list { display: flex; flex-direction: column; gap: 0.5rem; }
.suplencia-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.suplencia-item:hover { border-color: var(--green-300); box-shadow: var(--shadow); }
.suplencia-item .sup-date {
  background: var(--green-50); color: var(--green-700);
  padding: 0.4rem 0.7rem; border-radius: 8px;
  font-weight: 700; font-size: 0.82rem; white-space: nowrap;
}
.suplencia-item .sup-prof { font-weight: 600; color: var(--gray-800); flex: 1; }
.suplencia-item .sup-status { font-size: 0.78rem; }

/* ============================================ */
/*  PROFESSORS TABLE                            */
/* ============================================ */
.prof-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}
.prof-table th {
  background: var(--gray-50);
  padding: 0.55rem 0.8rem;
  text-align: left;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #d8dade;
}
.prof-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--gray-100);
}
.prof-table tr:hover td { background: var(--gray-50); }

.usos-bar { display: flex; align-items: center; gap: 0.5rem; }
.usos-bar .bar-bg {
  flex: 1; height: 6px;
  background: var(--gray-200); border-radius: 3px; overflow: hidden;
}
.usos-bar .bar-fill {
  height: 100%;
  background: var(--green-500);
  border-radius: 3px;
  transition: width 0.3s;
}
.usos-bar .bar-value {
  font-weight: 700; font-size: 0.82rem;
  color: var(--gray-700); min-width: 25px; text-align: right;
}

/* ============================================ */
/*  MODAL                                       */
/* ============================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 90%; max-width: 480px;
  padding: 2rem;
}
.modal h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; color: var(--gray-800); }
.modal .form-group { margin-bottom: 0.8rem; }
.modal .form-group input,
.modal .form-group textarea { width: 100%; }
.modal .modal-actions { display: flex; gap: 0.8rem; justify-content: flex-end; margin-top: 1.2rem; }

/* Modal comunicar planificacio curricular */
.dc-comm-overlay {
  left: var(--sidebar-w);
  right: 0;
  width: auto;
}
.app:has(.sidebar.sidebar-collapsed) ~ .dc-comm-overlay,
body:has(.sidebar.sidebar-collapsed) .dc-comm-overlay {
  left: var(--sidebar-collapsed-w);
}
.dc-comm-modal {
  width: 70%;
  max-width: none;
  min-width: min(720px, 94vw);
  max-height: 90vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dc-comm-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.dc-comm-dest {
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.dc-comm-section-title {
  padding: 0.55rem 1.4rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.dc-comm-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}
.dc-comm-select-all input {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
}
.dc-comm-select-all input:disabled {
  cursor: default;
}
.dc-comm-prof-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 0.35rem;
  max-height: 34vh;
  overflow-y: auto;
  padding: 0.35rem 1.4rem 0.85rem;
}
.dc-comm-prof-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.32rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}
.dc-comm-prof-item input {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.dc-comm-prof-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 500;
}
.dc-comm-prof-no-email {
  opacity: 0.42;
  cursor: default;
}
.dc-comm-empty {
  grid-column: 1 / -1;
  padding: 0.45rem 0;
  color: var(--gray-400);
  font-size: 0.85rem;
}
.dc-comm-form {
  padding: 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  flex: 1;
}
.dc-comm-table-options {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: var(--gray-50);
}
.dc-comm-table-hint {
  min-width: 0;
  flex: 1 1 280px;
  color: var(--gray-500);
  font-size: 0.78rem;
  line-height: 1.35;
}
.dc-comm-header-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--gray-700);
  font-size: 0.82rem;
  font-weight: 600;
}
.dc-comm-header-option input {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
}
.dc-preview-overlay {
  z-index: 520;
}
.dc-preview-modal {
  width: min(900px, 92vw);
  max-width: none;
  height: min(760px, 88vh);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dc-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.dc-preview-header h2 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.dc-preview-meta {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--gray-500);
}
.dc-preview-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 1.05rem;
}
.dc-preview-subject {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.dc-preview-subject span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.dc-preview-subject strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  color: var(--gray-800);
}
.dc-preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
@media (max-width: 900px) {
  .dc-comm-overlay {
    left: 0;
  }
  .dc-comm-modal {
    width: 94vw;
    min-width: 0;
  }
}

/* Confirm modal (esborrar suplència, netejar, etc.) */
.confirm-modal {
  text-align: center;
  width: min(92vw, 560px);
  max-width: 560px;
}
.confirm-modal h2 { margin-bottom: 0.5rem; }
.confirm-modal-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.confirm-modal-msg {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}
.confirm-modal .modal-actions {
  justify-content: center;
  flex-wrap: wrap;
}
.confirm-modal .modal-actions .btn {
  flex: 0 1 auto;
  white-space: nowrap;
}

.sup-output-modal {
  max-width: 520px;
}
.sup-output-modal h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}
.sup-output-summary {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.sup-output-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 0.45rem;
}
.sup-output-list {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sup-output-list-item {
  font-size: 0.86rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sup-output-format-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.sup-output-format,
.sup-output-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  color: var(--gray-700);
}
.sup-output-format {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  background: #fff;
  cursor: pointer;
}
.sup-output-format:has(input:checked) {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-lightest);
}
.sup-output-checkbox {
  margin-top: 0;
}
.sup-out-check-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  color: var(--gray-700);
  padding: 0.15rem 0;
  cursor: pointer;
}
.sup-out-toggle-all {
  padding-bottom: 0.4rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--gray-200);
}
.sup-output-cfg-box {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  padding: 0.75rem;
  margin-bottom: 1rem;
  min-height: 2.5rem;
}
.sup-cfg-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ============================================ */
/*  TOAST                                       */
/* ============================================ */
.toast-container {
  position: fixed; top: 1rem; right: 1rem;
  z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 0.8rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.85rem;
  animation: slideIn 0.3s ease;
  max-width: 360px;
  transition: opacity 0.3s;
}
.toast.success { border-left: 3px solid var(--green-500); }
.toast.error   { border-left: 3px solid var(--red-500); }
.toast.info    { border-left: 3px solid var(--blue-500); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================ */
/*  SPINNER                                     */
/* ============================================ */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--green-600);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
i.spin { display: inline-block; animation: spin 1s linear infinite; }

/* ============================================ */
/*  SCROLLBAR                                   */
/* ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================ */
/*  UTILITY                                     */
/* ============================================ */
/* ============================================ */
/*  SUPLENCIA LAYOUT 70/30                     */
/* ============================================ */
.suplencia-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.suplencia-grid-area {
  flex: 7;
  min-width: 0;
}
.suplencia-panel {
  flex: 3;
  min-width: 260px;
  max-width: 360px;
  position: sticky;
  top: 0;
}
.suplencia-panel .card {
  margin-bottom: 0;
}
.suplencia-panel .panel-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
  font-size: 0.85rem;
}
.suplencia-panel .panel-empty .panel-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}
.suplencia-panel .panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.6rem 0.8rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-clear-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s;
}
.panel-clear-btn:hover {
  color: var(--gray-700);
}
.suplencia-panel .panel-hora-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--green-700);
  padding: 0.5rem 0.8rem;
  background: var(--green-50);
  border-bottom: 1px solid var(--green-100);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Available professor item in panel */
.available-prof-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: all 0.12s;
  font-size: 0.84rem;
}
.available-prof-item:hover {
  background: var(--green-50);
}
.available-prof-item:last-child {
  border-bottom: none;
}
.available-prof-item .prof-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.available-prof-item .prof-rank.top {
  background: var(--green-100);
  color: var(--green-700);
}
.available-prof-item .prof-info {
  flex: 1;
  min-width: 0;
}
.available-prof-item .prof-info .prof-name-text {
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.available-prof-item .prof-info .prof-detail {
  font-size: 0.73rem;
  color: var(--gray-400);
}
.available-prof-item .prof-priority {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.available-prof-item .priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}
.available-prof-item .priority-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-500);
  min-width: 14px;
  text-align: center;
}
.available-prof-item .prof-usos {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Slot suplent controls */
.suplent-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Suplent button (replaces select) */
.suplent-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.55rem;
  border: 1px dashed var(--gray-300);
  border-radius: 6px;
  background: var(--gray-50);
  color: var(--gray-400);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  overflow: hidden;
}
.suplent-btn:hover {
  border-color: var(--color-primary);
  background: var(--blue-50, #eff6ff);
  color: var(--color-primary);
}
.suplent-btn.assigned {
  border: 1px solid var(--gray-300);
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 600;
}
.suplent-btn.assigned:hover {
  border-color: var(--color-primary);
  background: var(--blue-50, #eff6ff);
  color: var(--color-primary);
}
.suplent-btn-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
}
.suplent-btn-nom {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suplent-btn-placeholder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}
.suplent-controls-locked {
  align-items: stretch;
}
.suplent-locked {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--green-200);
  border-radius: 6px;
  background: var(--green-50);
  color: var(--green-800);
  font-size: 0.82rem;
  font-weight: 700;
}
.suplent-locked span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suplent-locked i {
  flex-shrink: 0;
  color: var(--green-600);
}
.btn-help {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: inherit;
  padding: 0;
}
.btn-help:hover {
  background: var(--blue-500);
  color: #fff;
}

/* Responsive: stack on narrow screens */
@media (max-width: 900px) {
  .suplencia-layout {
    flex-direction: column;
  }
  .suplencia-panel {
    max-width: 100%;
    position: static;
  }
}

/* ============================================ */
/*  SLOT PICKER MODAL                          */
/* ============================================ */
.slot-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.slot-picker-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.slot-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.slot-picker-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.slot-picker-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  color: var(--gray-400);
  font-size: 0.9rem;
  transition: all 0.15s;
}
.slot-picker-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}
.slot-picker-body {
  overflow-y: auto;
  padding: 0.75rem 0.75rem 0.5rem;
  flex: 1;
}
.slot-picker-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.nodisponible-label {
  color: var(--red-400, #f87171);
  margin-top: 0.25rem;
}
.slot-picker-footer {
  border-top: 1px solid var(--gray-100);
  padding: 0.6rem 0.75rem 0.75rem;
  flex-shrink: 0;
}
.slot-picker-mostrar-tots {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
  font-family: inherit;
}
.slot-picker-mostrar-tots:hover {
  background: var(--gray-50);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.available-prof-item.nodisponible {
  opacity: 0.55;
  cursor: default;
}
.available-prof-item.all-prof-dim {
  opacity: 0.35;
}

/* ============================================ */
/*  UTILITY                                    */
/* ============================================ */
.gap-sm { gap: 0.5rem; }
.mt-1 { margin-top: 0.8rem; }
.mb-1 { margin-bottom: 0.8rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-sm { font-size: 0.82rem; }
.text-muted { color: var(--gray-500); }
.fw-600 { font-weight: 600; }
.w-full { width: 100%; }

/* ============================================ */
/*  SUPLÈNCIES: Barra botons unificada          */
/* ============================================ */
.sup-button-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.btn-bar-sep {
  width: 1px;
  height: 22px;
  background: var(--gray-300);
  margin: 0 0.2rem;
  flex-shrink: 0;
}
.sup-button-bar .btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.sup-button-bar .btn:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  color: var(--green-700);
}

/* Split buttons for batch actions */
.btn-split-group {
  position: relative;
  display: inline-flex;
}
.btn-split-group .btn-split-main {
  border-radius: 6px 0 0 6px;
  border-right: none;
}
.btn-split-group .btn-split-caret {
  border-radius: 0 6px 6px 0;
  padding: 0.35rem 0.38rem;
  border-left: 1px solid rgba(0,0,0,0.13);
}
.btn-split-danger {
  background: #fff0f0 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}
.btn-split-danger:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
}
.batch-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  z-index: 300;
  overflow: hidden;
}
.batch-dropdown-menu.open { display: block; }
.batch-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.8rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--gray-700);
  text-align: left;
  white-space: nowrap;
}
.batch-dropdown-menu button:hover {
  background: var(--green-50);
  color: var(--green-700);
}

/* Nova múltiples dies modal */
.nova-mult-modal { max-width: 420px; }
.nova-mult-modal .form-group label { font-size: 0.8rem; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 0.3rem; }

/* Batch picker modal */
.batch-picker-modal { max-width: 340px; }
.batch-picker-list {
  max-height: 260px;
  overflow-y: auto;
  margin: 0.6rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.batch-picker-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--gray-700);
}
.batch-picker-item:hover { background: var(--gray-50); }
.batch-picker-item input[type="checkbox"],
.batch-picker-toggle input[type="checkbox"] { accent-color: var(--color-primary); }
.batch-picker-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem 0.5rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: default;
  user-select: none;
}

/* Save indicator (auto-save status) */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--gray-400);
  padding: 0.3rem 0.5rem;
  transition: all 0.3s;
  margin-left: auto;
}
.save-indicator.saving { color: var(--orange-500); }
.save-indicator.saved { color: var(--green-600); }
.save-indicator.error { color: var(--red-500); }

/* ============================================ */
/*  SUPLÈNCIES: Inline header (prof + data)     */
/* ============================================ */
.btn-undo {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.3rem;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.btn-undo:not(:disabled):hover {
  color: var(--color-primary);
  background: var(--color-primary-lightest);
}
.btn-undo:disabled {
  opacity: 0.3;
  cursor: default;
}
.inline-sup-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}
.inline-sup-header select,
.inline-sup-header input[type="date"] {
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  font-size: 0.88rem;
  font-family: inherit;
  background: white;
}
.inline-sup-header select:focus,
.inline-sup-header input[type="date"]:focus {
  border-color: var(--green-500);
  outline: none;
}
.header-separator {
  color: var(--gray-400);
  font-size: 0.85rem;
}
#gridCard .card-header {
  border-bottom: 1px solid var(--gray-300);
}

/* Mode readonly quan un altre usuari edita la mateixa suplència */
#gridCard.rt-readonly {
  pointer-events: none;
  opacity: 0.72;
  user-select: none;
}
.inline-motiu-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem 0.1rem 0;
  border-radius: 5px;
}
.inline-motiu-wrap:hover {
  background: var(--gray-100);
}
.inline-motiu-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
}
.inline-motiu-pencil {
  font-size: 0.7rem;
  color: var(--gray-400);
  opacity: 0;
  transition: opacity 0.15s;
}
.inline-motiu-wrap:hover .inline-motiu-pencil {
  opacity: 1;
}
.inline-motiu-input {
  padding: 0.25rem 0.5rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  font-size: 0.82rem;
  font-family: inherit;
  width: 150px;
}
.header-dia-label {
  font-size: 0.82rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ============================================ */
/*  SUPLÈNCIES: Toolbar botons icona            */
/* ============================================ */
.btn-tab-action {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--gray-300);
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}
.btn-tab-action:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  color: var(--green-700);
}
.btn-tab-action.active {
  background: var(--green-100);
  border-color: var(--green-500);
  color: var(--green-700);
}

/* ============================================ */
/*  CONSULTA HORARIS: Vistes ch-*               */
/* ============================================ */
.ch-type-toggles-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.ch-toggles-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  order: 2;
}
.ch-data-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.ch-data-wrap input[type="date"] {
  flex: 1;
}
.ch-data-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400, #9ca3af);
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
}
.ch-data-clear:hover {
  color: #ef4444;
  background: #fee2e2;
}
.ch-toggles-meta-btn {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 2px;
  cursor: pointer;
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  line-height: 1.4;
  text-transform: uppercase;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.ch-toggles-meta-btn:hover {
  color: #111827;
  border-color: #6b7280;
  background: #f3f4f6;
}
.ch-toggles-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #374151;
  padding: 0.1rem 0.2rem;
  font-size: 0.95rem;
  line-height: 1;
  margin-left: 0.15rem;
}
.ch-toggles-collapse-btn:hover { color: #111827; }
.ch-type-toggles {
  flex: 1;
  order: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.2s ease, opacity 0.2s ease;
  opacity: 1;
}
.ch-toggles-collapsed .ch-type-toggles {
  max-height: 0;
  opacity: 0;
}

/* Botó toggle: look rectangular dur, fons gris fosc, línia dreta de color prioritat */
.ch-type-btn {
  padding: 0.28rem 0.65rem;
  border: none;
  border-radius: 2px;
  border-right: 4px solid var(--type-color, #6b7280);
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  opacity: 0.42;
  transition: opacity 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
  user-select: none;
}
.ch-type-btn.active {
  background: #d1d5db;
  color: #374151;
  opacity: 1;
}
.ch-type-btn.active:hover {
  background: #9ca3af;
  color: #111827;
  border-right-color: color-mix(in srgb, var(--type-color, #6b7280) 70%, #000 30%);
  opacity: 1;
}
.ch-type-btn:not(.active):hover {
  opacity: 0.65;
}
.ch-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}
.ch-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem;
}
.ch-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.85rem;
}
.ch-result-item strong {
  flex-shrink: 0;
}
.ch-result-two-line {
  flex-direction: column;
  align-items: stretch;
}
.ch-result-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ch-estat {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.ch-estat-green  { background: #dcfce7; color: #15803d; }
.ch-estat-orange { background: #fff7ed; color: #c2410c; }
.ch-estat-red    { background: #fee2e2; color: #b91c1c; }
.ch-guard-row-absent   td:first-child { border-left: 3px solid #fca5a5 !important; }
.ch-guard-row-suplint  td:first-child { border-left: 3px solid #fdba74 !important; }
/* Separador entre dies (3px color primari) */
.ch-row-dia-sep td { border-top: 3px solid var(--color-primary, #2563eb) !important; }
/* Alternança per dia: blanc / gris 10% */
.ch-row-dia-alt td { background: #f0f0f0; }
/* Separador entre hores (2px gris mitjà, cada canvi d'hora) */
.ch-row-hora-sep td { border-top: 2px solid #94a3b8 !important; }
/* Separador de dia té prioritat sobre el d'hora quan coincideixen */
.ch-row-dia-sep.ch-row-hora-sep td { border-top: 3px solid var(--color-primary, #2563eb) !important; }
/* Alternança per hora (llegat, ja no s'usa per al separador) */
.ch-row-hora-alt td { border-top: 1px solid var(--color-primary, #2563eb); }
.ch-row-dia-sep.ch-row-hora-alt td { border-top: 3px solid var(--color-primary, #2563eb) !important; }
.ch-guard-row-alliberat td { color: var(--gray-600); }
.ch-guard-row-alliberat td:first-child { border-left: 3px solid #86efac !important; }
.ch-alliberats-toggle { --type-color: #15803d; }
.ch-result-unavailable {
  background: #fff1f2 !important;
  border-color: #fecdd3 !important;
}
.ch-result-unavailable strong { color: #b91c1c; }
.ch-result-two-line .ch-detail {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  white-space: nowrap;
}
.ch-result-two-line .ch-detail .ch-detail-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}
.ch-result-two-line .ch-detail .ch-estat {
  flex-shrink: 0;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-detail {
  color: var(--gray-500);
  font-size: 0.78rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-mail {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--gray-400);
  flex-shrink: 0;
}
.ch-mail:hover {
  color: var(--green-600);
}
.ch-nav-link {
  cursor: pointer;
}
.ch-nav-link:hover {
  filter: brightness(0.7);
}
.ch-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ch-export-toolbar {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}
.ch-export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ch-export-btn:hover {
  background: var(--gray-50);
  color: var(--green-600);
  border-color: var(--green-400);
}
.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.ch-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: 0.3px;
}
.ch-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.ch-table tbody tr:hover {
  background: var(--green-50);
}
.ch-grid-table tbody tr:hover {
  background: transparent;
}
.ch-guardies-table {
  table-layout: fixed;
}
.ch-guardies-table th:nth-child(1),
.ch-guardies-table td:nth-child(1) { width: 90px; }
.ch-guardies-table th:nth-child(2),
.ch-guardies-table td:nth-child(2) { width: 65px; }
.ch-guardies-table th:nth-child(3),
.ch-guardies-table td:nth-child(3) { width: 40%; }
.ch-guardies-table th:nth-child(4),
.ch-guardies-table td:nth-child(4) { width: auto; }
.ch-guardies-table th:nth-child(5),
.ch-guardies-table td:nth-child(5) { width: 35px; }

/* ============================================ */
/*  CH GRID TABLE (horari professor/curs)      */
/* ============================================ */
.ch-grid-wrapper {
  overflow-x: auto;
}
.ch-grid-table {
  border-collapse: separate;
  border-spacing: 0;
}
.ch-grid-table th,
.ch-grid-table td {
  border-right:  1px solid #d0d1d3;
  border-bottom: 1px solid #d0d1d3;
  border-top:    none;
  border-left:   none;
}
.ch-grid-table th:first-child,
.ch-grid-table td:first-child {
  border-left: 1px solid #d0d1d3;
}
.ch-grid-table thead tr:first-child th {
  border-top: 1px solid #d0d1d3;
}
.ch-grid-table thead tr:first-child th:first-child {
  border-radius: 10px 0 0 0;
}
.ch-grid-table thead tr:first-child th:last-child {
  border-radius: 0 10px 0 0;
}
.ch-grid-table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 10px;
}
.ch-grid-table tbody tr:last-child td:last-child {
  border-radius: 0 0 10px 0;
}
.ch-grid-table th {
  text-align: center;
  min-width: 110px;
  background: #f5f5f6;
  color: #7a808d;
  font-weight: 400;
  text-transform: none;
}
.ch-grid-table th:first-child {
  text-align: left;
  min-width: 60px;
  width: 60px;
}
.ch-grid-table .ch-grid-hora {
  font-weight: 400;
  color: #7a808d;
  font-size: 0.78rem;
  white-space: nowrap;
  background: #f5f5f6;
}
.ch-grid-cell {
  text-align: center;
  vertical-align: middle;
  padding: 0.4rem 0.5rem;
  height: 2.8rem;
}
.ch-grid-cell.ch-grid-empty {
  background: #eaebec;
}
.ch-grid-curs {
  font-weight: 600;
  color: #606773;
  font-size: 0.78rem;
}
.ch-grid-mat {
  font-size: 0.72rem;
  color: #606773;
  line-height: 1.3;
}
.ch-tipus-llegenda {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.ch-tipus-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  line-height: 1.4;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.ch-tipus-l  { background: #dcfce7; color: #166534; }
.ch-tipus-nl { background: #f3f4f6; color: #6b7280; }
.ch-tipus-c  { background: #fef9c3; color: #854d0e; }
/* Editor panel (modal horari professor) */
.hap-cell-selected { background: #dbeafe !important; outline: 2px solid #3b82f6; outline-offset: -2px; border-radius: 2px; }
.hap-field { margin-bottom: 0.6rem; }
.hap-label { color: #6b7280; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.22rem; }
.hap-input { width: 100%; background: #fff; border: 1.5px solid #d1d5db; border-radius: 6px; color: #1f2937; font-family: inherit; font-size: 0.82rem; padding: 0.3rem 0.5rem; outline: none; transition: border-color 0.15s; box-sizing: border-box; }
.hap-input:focus { border-color: var(--color-primary, #3d5a80); box-shadow: 0 0 0 3px rgba(61,90,128,0.1); }
.hap-btn-save { width: 100%; background: var(--color-primary, #3d5a80); border: none; border-radius: 7px; color: #fff; font-size: 0.82rem; font-weight: 600; padding: 0.48rem; cursor: pointer; transition: background 0.15s; margin-top: 0.2rem; }
.hap-btn-save:hover { background: var(--color-primary-dark, #2d415c); }
.ch-grid-prof {
  font-size: 0.72rem;
  font-weight: 600;
  color: #606773;
  margin-top: 0.1rem;
}
.ch-nav-link {
  cursor: pointer;
}

/* ============================================ */
/*  LOG: Entrades col·lapsables                 */
/* ============================================ */
.log-entry {
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.78rem;
}
.log-summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  cursor: default;
}
.log-toggle {
  cursor: pointer;
  font-size: 0.65rem;
  color: var(--gray-400);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  user-select: none;
}
.log-toggle:hover {
  color: var(--green-600);
}
.log-detail {
  display: none;
  padding: 0.3rem 0.6rem 0.5rem 1.8rem;
  font-size: 0.72rem;
  color: var(--gray-500);
  background: var(--gray-50);
  border-top: 1px dashed var(--gray-200);
  line-height: 1.5;
}
.log-detail.open {
  display: block;
}
.log-ts {
  color: var(--gray-400);
  font-size: 0.72rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.log-msg {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================ */
/*  CURSOS EDITOR (tags)                       */
/* ============================================ */
.curs-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid var(--blue-100);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.curs-tag button {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  margin: 0;
}
.curs-tag button:hover {
  color: var(--red-500);
}

/* ============================================ */
/*  PROFESSORS EDITOR TABLE                    */
/* ============================================ */
.prof-editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: fixed;
}
.prof-editor-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.prof-editor-table td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--gray-100);
  overflow: hidden;
}
.prof-editor-table tr.nr-group-header td {
  padding: 0.55rem 0.4rem 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: none;
  border-top: 2px solid var(--gray-200);
  background: transparent;
  text-transform: none;
  letter-spacing: 0;
}
.prof-editor-table tbody tr.nr-group-header:first-child td {
  border-top: none;
}
.prof-ed-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  background: white;
}
.prof-ed-input:focus {
  border-color: var(--green-500);
  outline: none;
}

/* ============================================ */
/*  HORARIS PREVIEW GRID (Configuració)        */
/* ============================================ */
.horaris-grid-container {
  overflow-x: auto;
}
/* Graella horaris — disseny unificat (importador + webapp) */
.preview-grid {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
  white-space: nowrap;
}
.preview-grid th {
  background: var(--gray-100, #f3f4f6);
  padding: 0.4rem 0.5rem;
  font-weight: 700;
  color: var(--gray-600, #4b5563);
  border-bottom: 2px solid var(--gray-300, #d1d5db);
  border-right: 1px solid var(--gray-200, #e5e7eb);
  position: sticky;
  top: 0;
  z-index: 3;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.preview-grid th.corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 5;
  background: var(--gray-200, #e5e7eb);
}
.preview-grid th.day-header {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-600, #4b5563);
  background: var(--gray-100, #f3f4f6);
  border-bottom: 1px solid var(--gray-300, #d1d5db);
  border-left: 2px solid var(--gray-300, #d1d5db);
}
.preview-grid th.hour-header {
  font-size: 0.68rem;
  text-align: center;
  min-width: 110px;
}
.preview-grid th.hour-header.day-first {
  border-left: 2px solid var(--gray-300, #d1d5db);
}
.preview-grid td.prof-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  font-weight: 600;
  color: var(--gray-700, #374151);
  padding: 0.3rem 0.6rem;
  border-right: 2px solid var(--gray-300, #d1d5db);
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  min-width: 140px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-grid td.cell {
  padding: 0.3rem 0.4rem;
  border-right: 1px solid var(--gray-100, #f3f4f6);
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  min-width: 110px;
  max-width: 180px;
  min-height: 2.8rem;
  white-space: normal;
  word-break: break-word;
  font-size: 0.7rem;
  transition: outline 0.1s;
  vertical-align: top;
  cursor: default;
}
.preview-grid td.cell:hover {
  outline: 2px solid #3b82f6;
  outline-offset: -1px;
  z-index: 1;
}
.preview-grid.edit-mode td.cell {
  cursor: pointer;
  outline: 2px dashed rgba(0,0,0,0.18);
  outline-offset: -2px;
}
.preview-grid.edit-mode td.cell:hover {
  outline: 2px solid #3b82f6;
  outline-offset: -1px;
}

/* ============================================ */
/*  DASHBOARD: Features grid                   */
/* ============================================ */
.dash-functions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.4rem;
}
.dash-func-item {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}
.dash-func-item strong {
  color: var(--gray-800);
}

.dash-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.dash-feature-card {
  background: #fcfcfc;
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 1.3rem 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.dash-feature-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
}
.dash-feature-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--color-primary-lightest);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.dash-feature-info {
  flex: 1;
  min-width: 0;
}
.dash-feature-title {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}
.dash-feature-desc {
  font-size: 0.82rem;
  color: var(--gray-500);
  line-height: 1.45;
}
/* Badge de dreçera de teclat a les cards del dashboard */
.dash-kbd {
  align-self: center;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
  background: var(--gray-100, #f1f5f9);
  border: 1px solid var(--gray-300, #cbd5e1);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--gray-500, #64748b);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.dash-feature-card:hover .dash-kbd {
  opacity: 1;
}
.dash-kbd.dash-kbd-disabled {
  display: none;
}

/* ============================================ */
/*  INPUT WITH CLEAR BUTTON                    */
/* ============================================ */
.input-with-clear {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-clear input {
  width: 100%;
  padding-right: 2rem;
}
.input-clear-btn {
  position: absolute;
  right: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 0.72rem;
  padding: 0.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.input-clear-btn:hover {
  color: var(--gray-600);
}

/* ============================================ */
/*  NOTIFICA REUBICAT LAYOUT                   */
/* ============================================ */
.nr-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.nr-calendar {
  flex-shrink: 0;
  width: 240px;
}
.nr-fields {
  flex: 1;
  min-width: 0;
}
@media (max-width: 700px) {
  .nr-layout {
    flex-direction: column;
  }
  .nr-calendar {
    width: 100%;
  }
}

/* ============================================ */
/*  DATEPICKER                                 */
/* ============================================ */
.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.dp-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
}
.dp-nav {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--gray-500);
  transition: all 0.15s;
  font-family: inherit;
  padding: 0;
}
.dp-nav:hover {
  background: var(--green-50);
  border-color: var(--green-400);
  color: var(--green-700);
}
.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.dp-day {
  text-align: center;
  padding: 0.3rem 0;
  font-size: 0.78rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--gray-700);
}
.dp-day:hover {
  background: var(--green-50);
  color: var(--green-700);
}
.dp-day.dp-other {
  color: var(--gray-300);
  cursor: default;
}
.dp-day.dp-other:hover {
  background: none;
}
.dp-day.dp-today {
  background: var(--blue-50);
  color: var(--blue-600);
  font-weight: 700;
}
.dp-day.dp-selected {
  background: var(--green-500);
  color: white;
  font-weight: 700;
}
.dp-day.dp-weekend {
  color: var(--gray-400);
}
.dp-day.dp-selected.dp-weekend {
  color: white;
}
.dp-day.dp-in-range {
  background: var(--blue-100, #dbeafe);
  color: var(--blue-700, #1d4ed8);
  border-radius: 4px;
}

/* Popup datepicker trigger & popup */
.dp-popup-wrap {
  position: relative;
}
.dp-popup-trigger {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--gray-700);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s;
}
.dp-popup-trigger:hover {
  border-color: var(--gray-400);
}
.dp-popup {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 600;
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.6rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  min-width: 220px;
}
.dp-popup.dp-popup-open {
  display: block;
}
/* Variant fixed: el JS calcula top/left; el CSS no imposa posicionament */
.dp-popup.dp-popup-fixed {
  position: fixed;
  top: auto;
  left: auto;
}

/* ============================================ */
/*  GRAPHITE EDITORIAL THEME                   */
/* ============================================ */
:root {
  --sidebar-w: 247px;
  --radius: 8px;
  --bg: #ededee;
  --panel: #fcfcfc;
  --panel-2: #f3f3f4;
  --line: #d2d4d8;
  --text: #1b1d22;
  --muted: #686e78;
  --shadow: 0 4px 14px rgba(0,0,0,.11);

  /* Dynamic color system */
  --color-primary: #3d5a80;
  --color-primary-dark: color-mix(in srgb, var(--color-primary) 70%, black);
  --color-primary-light: color-mix(in srgb, var(--color-primary) 30%, white);
  --color-primary-lighter: color-mix(in srgb, var(--color-primary) 15%, white);
  --color-primary-lightest: color-mix(in srgb, var(--color-primary) 8%, white);
  --color-secondary: #5a7e6b;
  --color-secondary-light: color-mix(in srgb, var(--color-secondary) 30%, white);
  --color-secondary-lighter: color-mix(in srgb, var(--color-secondary) 15%, white);
  --color-alt: #957a5a;
  --color-alt-light: color-mix(in srgb, var(--color-alt) 30%, white);
  --color-alt-lighter: color-mix(in srgb, var(--color-alt) 15%, white);
}

body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: linear-gradient(180deg, #f2f2f3 0%, #e7e8eb 100%);
  color: var(--text);
}

/* Sidebar */
.sidebar {
  background: #f7f7f8;
  border-right: 1px solid #d5d7db;
  box-shadow: none;
  border-top: 4px solid var(--color-primary);
}
.sidebar-logo {
  padding: 1.15rem 1.2rem;
  border-bottom: 1px solid #d8dade;
  background: #edeef0;
  height: 106px;
  box-sizing: border-box;
}
.sidebar-logo .logo-text,
.topbar-title,
.card-header h3 {
  font-family: "IBM Plex Serif", Georgia, serif;
}
.sidebar-logo .logo-icon {
  background: transparent;
  border-radius: 8px;
}
.nav-section-title {
  padding-top: 0.9rem;
  color: #8b919c;
  letter-spacing: 1.4px;
}
.nav-item {
  border-radius: 8px;
  padding: 0.7rem 0.78rem;
  color: #4a4f58;
}
.nav-item:hover {
  background: linear-gradient(135deg, #eff0f2, var(--color-alt-lighter));
}
.nav-item.active {
  background: #e6e8ec;
  color: var(--color-primary);
  box-shadow: inset 3px 0 0 var(--color-primary);
}
.nav-item .nav-icon {
  font-size: 1rem;
}
.nav-item.active .nav-icon {
  color: var(--color-primary);
}

/* Topbar */
.topbar {
  background: rgba(247,247,248,0.92);
  border-bottom: 1px solid #d5d7db;
  backdrop-filter: blur(10px);
  border-top: 4px solid var(--color-primary);
  height: 74px;
  box-sizing: border-box;
}
.topbar-title {
  font-size: 1.34rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Cards */
.card,
.stat-card {
  background: #fcfcfc;
  border: none;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.card-header {
  background: #f5f5f6;
}

/* Buttons & Inputs */
.btn, button, input, select, textarea {
  border-radius: 8px !important;
}
.btn-primary {
  background: var(--color-primary);
  color: white;
  border: 1px solid var(--color-primary);
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}
input, select, textarea {
  background: #fff;
  border: 1px solid #d0d4da;
}

/* School badge */
.school-badge {
  background: #f0f1f3;
  border: 1px solid #d7dade;
  border-radius: 10px;
}

/* Suplencia grid table header */
.suplencia-grid thead th {
  background: #f1f2f4;
  font-family: "IBM Plex Sans", sans-serif;
}
.suplencia-grid thead th .btn-brush {
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
}
.btn-brush.btn-primary-hover:hover {
  background: color-mix(in srgb, var(--color-primary) 10%, white);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================ */
/*  VIEW HELP FOOTER                           */
/* ============================================ */
.view-help-footer {
  margin-top: auto;
  padding: 2rem 0.25rem 0;
  text-align: center;
}
body.help-hidden .view-help-footer {
  display: none;
}
.view-help-footer-inner {
  font-size: 0.79rem;
  color: var(--gray-500);
  line-height: 1.55;
}
.view-help-footer-desc {
  margin-bottom: 0.2rem;
}
.view-help-footer-config {
  font-size: 0.77rem;
}

/* Spinner per botons d'enviament */
.btn-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 2px;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* Bootstrap icon sizing in nav and buttons */
.nav-icon i,
.btn i {
  font-size: 1rem;
  line-height: 1;
}
.card-header h3 i {
  font-size: 1rem;
}

/* Sup button bar graphite theme */
.sup-button-bar .btn {
  background: #f0f1f3;
  border: 1px solid #d0d4da;
  color: #4a4f58;
}
.sup-button-bar .btn:hover {
  background: linear-gradient(135deg, #e6e8ec, var(--color-alt-lighter));
  border-color: #b0b4bb;
  color: var(--color-primary);
}

/* Tab toolbar buttons */
.btn-tab-action {
  border-radius: 8px;
}
.btn-tab-action:hover {
  background: linear-gradient(135deg, #e6e8ec, var(--color-alt-lighter));
  border-color: #b0b4bb;
  color: var(--color-primary);
}
.btn-tab-action.active {
  background: var(--color-primary-lighter);
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

/* Tab nav arrow */
.tab-nav-arrow.tab-arrow-enabled:hover {
  color: var(--color-primary);
  background: none;
}

/* Tab group */
.tab-group-label {
  border-bottom: 2px solid var(--color-primary-light);
  background: var(--color-primary-lightest);
  border-radius: 8px 8px 0 0;
}
.tab-dropdown-trigger {
  border-bottom-color: var(--color-primary-light);
  background: var(--color-primary-lightest);
}
.tab-dropdown-trigger:hover {
  background: var(--color-primary-lighter);
}
.tab-dropdown-trigger.active,
.tab-dropdown-trigger.open {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}
.tab-dropdown-item.active {
  background: var(--color-primary-lightest);
  color: var(--color-primary);
}
.tab-group .suplencia-tab:first-of-type {
  border-radius: 0;
}
.tab-group .suplencia-tab:last-child {
  border-radius: 0 0 8px 8px;
}

/* Suplencia tab overrides */
.suplencia-tab.active {
  color: var(--color-primary);
  border-bottom-color: #fcfcfc;
}
.suplencia-tab.active .tab-date {
  color: #686e78;
}
.suplencia-tab-new {
  background: var(--color-primary-lightest);
  border-color: var(--color-primary-lighter);
  color: var(--color-primary);
}
.suplencia-tab-new:hover {
  background: var(--color-primary-lighter);
}
.suplencia-tab.active .tab-close-btn {
  color: #686e78;
}

/* Focus states */
.form-group input:focus,
.form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-lightest);
}
.suplencia-grid .suplent-cell select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-lightest);
}
.inline-sup-header select:focus,
.inline-sup-header input[type="date"]:focus {
  border-color: var(--color-primary);
}
.indicacions-editor-content:focus {
  outline: none;
}

/* Assigned select — already set in base */


/* Checkbox accent */
.checkbox-label:hover {
  background: var(--color-primary-lightest);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--color-primary);
}

/* Help button graphite */
.btn-help {
  border-color: var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-500);
}
.btn-help:hover {
  background: linear-gradient(135deg, #e6e8ec, var(--color-alt-lighter));
  border-color: #b0b4bb;
  color: var(--color-primary);
}

/* Available prof panel */
.suplencia-panel .panel-hora-label {
  color: var(--color-primary);
  background: var(--color-primary-lightest);
  border-bottom: 1px solid var(--color-primary-lighter);
}
.available-prof-item:hover {
  background: #f0f1f3;
}
.available-prof-item .prof-rank.top {
  background: var(--color-primary-lighter);
  color: var(--color-primary);
}

/* Datepicker graphite */
.dp-popup-trigger {
  background: var(--surface);
  border-color: #b0b4bb;
  color: var(--text-primary);
}
.dp-popup-trigger:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.dp-popup {
  background: #f5f6f8;
  border-color: #b0b4bb;
}
.dp-nav:hover {
  background: linear-gradient(135deg, var(--color-primary-lightest), var(--color-alt-lighter));
  border-color: #b0b4bb;
  color: var(--color-primary);
}
.dp-day:hover {
  background: var(--color-primary-lightest);
  color: var(--color-primary);
}
.dp-day.dp-selected {
  background: var(--color-primary);
  color: white;
}

/* Spinner graphite */
.spinner {
  border-top-color: var(--color-primary);
}

/* Stat icon green → graphite */
.stat-icon.green {
  background: var(--color-primary-lightest);
  color: var(--color-primary);
}

/* Dashboard func items */
.dash-func-item:hover {
  background: linear-gradient(135deg, var(--color-primary-lightest), var(--color-alt-lighter));
  color: var(--color-primary);
}

/* Suplencia item hover */
.suplencia-item:hover {
  border-color: #b0b4bb;
}
.suplencia-item .sup-date {
  background: var(--color-primary-lightest);
  color: var(--color-primary);
}

/* Profile editor input focus */
.prof-ed-input:focus {
  border-color: var(--color-primary);
}

/* CH results */
.ch-time-badge {
  background: var(--color-primary-lightest);
  color: var(--color-primary);
}
.ch-table tbody tr:hover {
  background: #f5f5f6;
}
.ch-grid-table tbody tr:hover {
  background: transparent;
}
.ch-mail:hover {
  color: var(--color-primary);
}
.ch-grid-cell.ch-grid-empty {
  background: #eaebec;
}

/* Horaris grid header — theme override */
.preview-grid .day-header {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
}

/* Usos bar */
.usos-bar .bar-fill {
  background: var(--color-primary);
}

/* Smooth transitions */
.sidebar, .topbar, .card, .stat-card, .school-badge,
.nav-item, .btn, input, select, textarea,
.sidebar-logo .logo-icon {
  transition: all 0.18s ease;
}

/* Empty state icons sizing for Bootstrap Icons */
.empty-state .empty-icon i {
  font-size: 3rem;
}

/* Curs tags → secondary color */
.curs-tag {
  background: var(--color-secondary-lighter);
  color: var(--color-secondary);
  border-color: var(--color-secondary-light);
}

/* Save indicator → primary */
.save-indicator.saved {
  color: var(--color-primary);
}

/* Toast success → primary */
.toast.success {
  border-left-color: var(--color-primary);
}

/* Datepicker today → secondary */
.dp-day.dp-today {
  background: var(--color-secondary-lighter);
  color: var(--color-secondary);
}

/* ============================================ */
/*  COLOR PICKER                               */
/* ============================================ */
.color-picker-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.color-picker-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.color-picker-group input[type="color"] {
  width: 44px;
  height: 36px;
  border: 2px solid var(--gray-200) !important;
  border-radius: 8px !important;
  padding: 2px;
  cursor: pointer;
  background: white;
}
.color-picker-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.color-picker-group input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
.color-hex {
  font-family: 'Fira Code', monospace, inherit;
  font-size: 0.78rem;
  color: var(--gray-500);
}
.color-hint {
  font-size: 0.72rem;
  color: var(--gray-400);
}

/* ============================================ */
/*  USOS ADJUSTMENT BUTTONS                    */
/* ============================================ */
.btn-usos-adj {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  font-size: 0.85rem;
}
.btn-usos-adj:hover {
  background: var(--color-primary-lightest);
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

/* ============================================ */
/*  COLLAPSIBLE SECTIONS                       */
/* ============================================ */
.card-header.collapsible {
  cursor: pointer;
  user-select: none;
}
.card-header.collapsible:hover {
  background: #f0f1f3;
}
.card-header .chevron-icon {
  font-size: 0.82rem;
  color: var(--gray-400);
  transition: transform 0.2s ease;
  margin-left: 0.4rem;
}
.card-header.collapsed .chevron-icon {
  transform: rotate(-90deg);
}
.card-header.collapsed + .card-body,
.card-header.collapsed + div > .card-body,
.card-header.collapsed ~ .card-body {
  display: none !important;
}
/* Handle card-body preceded by other elements like forms */
.card.section-collapsed > .card-body,
.card.section-collapsed > div:not(.card-header) {
  display: none !important;
}
.card.section-collapsed > .card-header {
  border-bottom: none;
}

/* ============================================ */
/*  SIDEBAR COLLAPSIBLE SECTIONS               */
/* ============================================ */
.nav-section-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.nav-section-title .nav-chevron {
  font-size: 0.6rem;
  color: var(--gray-400);
  transition: transform 0.2s ease;
}
.nav-section.collapsed .nav-section-title .nav-chevron {
  transform: rotate(-90deg);
}
.nav-section.collapsed .nav-item {
  display: none;
}
.sidebar.sidebar-collapsed .nav-section.collapsed .nav-item {
  display: flex;
}

/* ============================================ */
/*  CFG SUB-SECTIONS (accordion dins config)    */
/* ============================================ */
.cfg-sub {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.cfg-sub > summary {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--gray-600);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--gray-50, #f9fafb);
}
.cfg-sub > summary::-webkit-details-marker { display: none; }
.cfg-sub > summary::after {
  content: '\F282';
  font-family: 'bootstrap-icons';
  margin-left: auto;
  font-weight: 400;
  font-size: 0.8rem;
  transition: transform 0.2s;
  color: var(--gray-400);
}
.cfg-sub[open] > summary::after { transform: rotate(180deg); }
.cfg-sub > summary:hover { background: var(--gray-100, #f3f4f6); }
.cfg-sub .cfg-sub-body {
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--gray-200);
}

/* ============================================ */
/*  FUNCIONS PRÒPIES                            */
/* ============================================ */

/* Nav section hidden */
.nav-section.hidden { display: none; }

/* Config list items */
.fp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  background: var(--gray-50, #f9fafb);
}
.fp-nom {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.fp-actions { display: flex; gap: 0.4rem; }
.fp-buit {
  color: var(--gray-400);
  font-size: 0.85rem;
  padding: 0.4rem 0;
}

/* Install modal */
.fp-modal {
  max-width: 660px;
  width: 95vw;
}
.fp-codi-textarea {
  width: 100%;
  font-family: 'Fira Code', monospace, inherit;
  font-size: 0.8rem;
  resize: vertical;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: var(--gray-50, #f9fafb);
  color: var(--gray-800);
}
.fp-codi-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

/* View container */
#funcioPropiaContainer {
  padding: 1.5rem;
  min-height: 200px;
}

/* Botó carrega horari (inline header) */
.btn-carrega-horari {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.32rem 0.55rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, opacity 0.15s;
}
.btn-carrega-horari:hover {
  opacity: 0.85;
}

/* ============================================ */
/*  ARXIU I ESTADÍSTIQUES                       */
/* ============================================ */

/* Sub-tabs */
.arxiu-sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--gray-200);
  background: var(--gray-50);
}
.arxiu-sub-btn {
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s, border-color 0.15s;
}
.arxiu-sub-btn:hover { color: var(--gray-800); }
.arxiu-sub-btn.active {
  color: var(--color-primary, var(--blue-600));
  border-bottom-color: var(--color-primary, var(--blue-600));
  font-weight: 600;
}

/* Filtres */
.arxiu-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.arxiu-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.arxiu-filter-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.arxiu-filter-input {
  font-size: 0.83rem;
  padding: 0.3rem 0.5rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  color: var(--gray-800);
  background: #fff;
}
.arxiu-filter-input:focus {
  outline: none;
  border-color: var(--color-primary, var(--blue-500));
}

/* Section headers dins resultats */
.arxiu-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1.5px solid var(--gray-200);
}
.arxiu-section-header:first-child { margin-top: 0; }
.arxiu-count {
  background: var(--gray-200);
  color: var(--gray-600);
  border-radius: 20px;
  padding: 0 7px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Taula arxiu */
.arxiu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin-bottom: 0.25rem;
}
.arxiu-table th {
  background: var(--gray-50);
  padding: 7px 10px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
  border-bottom: 1.5px solid var(--gray-200);
}
.arxiu-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--gray-700);
}
.arxiu-table tr:last-child td { border-bottom: none; }
.arxiu-table tr:hover td { background: var(--gray-50); }

/* States */
.arxiu-loading, .arxiu-empty, .arxiu-error {
  padding: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.arxiu-error { color: var(--red-500); }

/* Barra de neteja */
.arxiu-neteja-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}
.arxiu-neteja-label {
  font-size: 0.82rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Stats */
.stats-highlights {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.stat-highlight-card {
  flex: 1;
  min-width: 200px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-highlight-icon {
  font-size: 2rem;
  color: var(--orange-500);
  line-height: 1;
}
.stat-highlight-icon.text-green { color: var(--green-600); }
.stat-highlight-icon.text-orange { color: var(--orange-500); }
.stat-highlight-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}
.stat-highlight-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.1rem;
}
.stat-highlight-count {
  font-size: 0.82rem;
  color: var(--gray-500);
}

/* Charts */
.stats-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 700px) {
  .stats-charts { grid-template-columns: 1fr; }
}
.stats-chart-block {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.stats-chart-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.stat-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.stat-bar-label {
  width: 130px;
  font-size: 0.8rem;
  color: var(--gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.stat-bar-track {
  flex: 1;
  background: var(--gray-200);
  border-radius: 4px;
  height: 16px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: var(--color-primary, var(--blue-500));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.stat-bar-value {
  width: 35px;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  flex-shrink: 0;
}

/* ============================================ */
/*  HORARIS EDITOR                              */
/* ============================================ */

/* Mode edició botó actiu */
#hrEditorModeBtn.active {
  background: var(--color-primary, var(--blue-600));
  color: #fff;
  border-color: var(--color-primary, var(--blue-600));
}

/* Toolbar d'edició */
.hr-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
  background: #fffbeb;
  border-bottom: 1.5px solid #fde68a;
}
.hr-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.hr-toolbar-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.hr-toolbar-sep {
  width: 1px;
  height: 24px;
  background: #fde68a;
  flex-shrink: 0;
}

/* Cell popup */
.hr-cell-popup {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
  padding: 1rem 1.1rem;
  width: 300px;
  font-size: 0.85rem;
}
.hr-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.hr-popup-title {
  font-weight: 700;
  color: var(--gray-800);
  font-size: 0.88rem;
}
.hr-popup-sub {
  font-size: 0.75rem;
  color: var(--gray-500);
}
.hr-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  margin-left: 0.5rem;
}
.hr-popup-close:hover { color: var(--gray-700); }
.hr-popup-contingut {
  background: var(--gray-50);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
  border: 1px solid var(--gray-200);
}
.hr-popup-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
  margin-bottom: 0.4rem;
}
.hr-popup-label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.hr-prio-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.hr-prio-btn {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.1s;
}
.hr-prio-btn:hover { transform: scale(1.1); }
.hr-prio-btn.selected { border-color: var(--gray-800); box-shadow: 0 0 0 1px var(--gray-800); }
.hr-popup-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

/* Editor de prioritats — disseny unificat (importador + webapp) */
.priority-list { display: flex; flex-direction: column; gap: 0.3rem; }
.priority-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; border: 1px solid var(--gray-200, #e5e7eb); border-radius: 9px; font-size: 0.84rem; transition: background 0.1s; }
.priority-row:hover { background: var(--gray-50, #f9fafb); }
.priority-row.disabled { opacity: 0.5; }
.priority-row.selected { border-color: var(--gray-700, #374151); background: var(--gray-50, #f9fafb); box-shadow: 0 0 0 1.5px var(--gray-700, #374151); }
.priority-swatch { width: 28px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.15); flex-shrink: 0; }
.priority-color-input { width: 34px; height: 28px; padding: 2px; border: 1px solid var(--gray-300, #d1d5db); border-radius: 7px; background: #fff; cursor: pointer; flex-shrink: 0; }
.priority-rank { font-weight: 700; color: var(--green-600, #16a34a); min-width: 26px; text-align: center; font-size: 0.82rem; }
.priority-hex { font-family: monospace; font-size: 0.78rem; color: var(--gray-500, #6b7280); min-width: 70px; }
.priority-count { font-size: 0.78rem; color: var(--gray-400, #9ca3af); min-width: 65px; }
.priority-bar-bg { flex: 1; height: 8px; background: var(--gray-200, #e5e7eb); border-radius: 4px; overflow: hidden; min-width: 60px; }
.priority-bar-fill { height: 100%; border-radius: 4px; }
.priority-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }

.priority-new-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem 0;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  margin-top: 0.5rem;
}
.priority-merge-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  margin-top: 0.5rem;
}

/* ====================================================== */
/* ENVIAMENTS                                             */
/* ====================================================== */

.env-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.env-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Filters card body: 3 fixed columns */
.env-filters-body {
  padding: 0.5rem 0.75rem;
  display: grid;
  grid-template-columns: 160px minmax(170px, auto) minmax(0, 1fr);
  gap: 0 0.75rem;
  align-items: stretch;
  overflow: hidden;
  height: 250px;
}

.env-filters-resize-handle {
  height: 12px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.75rem;
  user-select: none;
  touch-action: none;
  border-top: 1px solid #e5e7eb;
  margin: 0;
  border-radius: 0 0 8px 8px;
}
.env-filters-resize-handle:hover { background: #f3f4f6; color: #6b7280; }

/* Col 1: tutoria + etapes stacked — scroll vertical si no hi cap */
.env-filter-col-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  overflow-y: auto;
  min-height: 0;
}

/* Col 2: cursos — scroll vertical si no hi cap */
.env-filters-body > .env-filter-group {
  background: #f0f0f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Col 3: matèries — scroll vertical intern */
.env-filter-col-mats {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.env-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.env-filter-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.env-group-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}
.env-group-label input[type="checkbox"] {
  accent-color: #1e293b;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Text search with X button */
.env-text-search-wrap {
  position: relative;
  margin-top: 0.3rem;
}
.env-text-input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.6rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  line-height: 1.2;
}
.env-text-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-400);
  line-height: 1;
  padding: 0 0.15rem;
}
.env-text-clear:hover { color: var(--gray-700); }

/* Grid layout for checkboxes */
.env-grid-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.1rem;
}

/* Cursos: 3 columns, compact — el scroll el fa el pare (.env-filter-group) */
.env-grid-2col {
  grid-template-columns: repeat(3, max-content);
  gap: 0.25rem 0.5rem;
  overflow: visible;
  padding-bottom: 0.5rem;
}
.env-grid-2col .env-checkbox-item,
.env-mat-grid .env-checkbox-item {
  padding: 0.1rem 0.2rem;
  font-size: 0.79rem;
}

/* Materies: columnes i alçada de fila calculades per JS */
.env-mat-grid {
  display: grid;
  gap: 0.25rem 6px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding-bottom: 0.3rem;
}

.env-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.18rem 0.3rem;
  border-radius: 5px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.env-checkbox-item:hover { background: var(--gray-100); }
.env-checkbox-item input { accent-color: var(--color-primary, #16a34a); flex-shrink: 0; }

/* Professors: simple list */
.env-profs-grid {
  padding: 0.3rem 0.6rem;
  overflow-y: auto;
  max-height: 380px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 0.5rem;
  align-items: start;
}

.env-prof-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.3rem;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  min-width: 0;
  overflow: hidden;
}
.env-prof-chip:nth-child(odd)  { background: #f5f5f5; }
.env-prof-chip:nth-child(even) { background: #e9e9e9; }
.env-prof-chip:hover { background: #d8d8d8 !important; }
.env-prof-chip input { accent-color: var(--color-primary, #16a34a); flex-shrink: 0; }
.env-prof-chip.env-prof-no-email { opacity: 0.38; cursor: default; }

/* ====================================================== */
/* PROFESSOR EDITOR — inline edit                         */
/* ====================================================== */

.prof-editor-table th, .prof-editor-table td {
  vertical-align: middle;
  padding: 0.15rem 0.3rem;
  white-space: nowrap;
}

/* Compact inline table inputs */
.prof-inline-input {
  width: 100%;
  padding: 0.28rem 0.45rem;
  border: 1.5px solid transparent;
  border-radius: 5px;
  font-size: 0.83rem;
  font-family: inherit;
  background: transparent;
  outline: none;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.prof-inline-input:hover { border-color: var(--gray-300); background: var(--gray-50); }
.prof-inline-input:focus { border-color: var(--green-500); background: #fff; }

.prof-inline-select {
  padding: 0.28rem 0.35rem;
  border: 1.5px solid transparent;
  border-radius: 5px;
  font-size: 0.83rem;
  font-family: inherit;
  background: transparent;
  outline: none;
  cursor: pointer;
  max-width: 130px;
}
.prof-inline-select:hover { border-color: var(--gray-300); background: var(--gray-50); }
.prof-inline-select:focus { border-color: var(--green-500); background: #fff; }

.prof-etapes-cell {
  white-space: nowrap;
}

.prof-etapa-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.76rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  user-select: none;
  white-space: nowrap;
}
.prof-etapa-inline:hover { background: var(--gray-100); }
.prof-etapa-inline input { accent-color: var(--green-600); }

/* ============================================ */
/*  DC ICON TOOLBAR  +  DC MENUBAR             */
/* ============================================ */

/* Wrapper de la barra d'icones (col·lapsable) */
.dc-iconbar {
  overflow-x: auto;
  scrollbar-width: thin;
}

/* Botó icona base: quadrat igual per a tots */
.dc-ico-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  padding: 0;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #4a4f58;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  user-select: none;
}
.dc-ico-btn:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.dc-ico-btn:disabled {
  cursor: not-allowed;
}
/* Estat actiu (toggle activat, mode seleccionat, panel obert) */
.dc-ico-btn.btn-primary,
.dc-ico-btn.dc-ico-active {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.dc-ico-btn.btn-primary:hover:not(:disabled),
.dc-ico-btn.dc-ico-active:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
}
/* Neutralitza btn-secondary/btn-primary del framework quan s'aplica a dc-ico-btn */
.dc-ico-btn.btn-secondary {
  background: transparent;
  border-color: transparent;
  color: #4a4f58;
}
.dc-ico-btn.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
/* Separador vertical entre seccions */
.dc-ico-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--gray-200);
  flex-shrink: 0;
  margin: 0 3px;
  align-self: center;
}
/* DC Menubar embedded dins d'una card */
.dc-menubar {
  position: relative;
  border-radius: 0;
}
/* Dropdown de la barra d'icones (sort / col-vis) */
.dc-ico-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 155px;
  background: #f8f9fa;
  border: 1px solid #b0b4bb;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.14);
  z-index: 600;
  padding: 3px 0;
}
.dc-ico-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 10px;
  font-size: 0.8rem;
  cursor: default;
  white-space: nowrap;
  position: relative;
}
.dc-ico-dd-item:hover {
  background: var(--color-primary);
  color: #fff;
}
.dc-ico-dd-item > .dc-ico-dropdown {
  display: none;
  top: -3px;
  left: 100%;
}
.dc-ico-dd-item:hover > .dc-ico-dropdown {
  display: block;
}
.dc-ico-dd-sep {
  height: 1px;
  background: #c8cdd4;
  margin: 3px 6px;
}
/* Fullscreen: mantenim el menubar i la barra d'icones visibles */
#dc-viewer-fs-wrapper:fullscreen .dc-menubar,
#dc-viewer-fs-wrapper:-webkit-full-screen .dc-menubar {
  flex-shrink: 0;
  border-bottom: 1px solid #c8cdd4;
}
/* Submenu checkmark helper */
.dc-mchk {
  margin-left: auto;
  visibility: hidden;
  color: var(--color-primary);
}
.dc-mchk.on {
  visibility: visible;
}

/* ============================================ */
/*  Custom Select Dropdown (cross-browser)      */
/* ============================================ */
.cs-wrap {
  position: relative;
  display: inline-block;
  /* width s'aplica via JS des de l'element original */
}
.cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%; /* omple el .cs-wrap; si wrap és auto, el trigger s'ajusta al contingut */
  padding: 0.5rem 0.75rem;
  background: var(--bg-white, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-main, #1e293b);
  gap: 0.5rem;
  text-align: left;
  min-height: 2.25rem;
  min-width: 10rem; /* amplada mínima quan el context no imposa cap mida */
  box-sizing: border-box;
}
.cs-trigger:hover {
  border-color: var(--color-primary, #2563eb);
}
.cs-trigger.open {
  border-color: var(--color-primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.cs-trigger .cs-arrow {
  flex-shrink: 0;
  transition: transform 0.15s;
  color: var(--gray-400, #94a3b8);
}
.cs-trigger.open .cs-arrow {
  transform: rotate(180deg);
}
.cs-trigger .cs-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-menu {
  position: fixed;
  z-index: 10100;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  min-width: 200px;
  max-height: 320px;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.cs-menu.open {
  display: flex;
}
.cs-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}
.cs-search input {
  width: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.25rem;
  font-size: 0.82rem;
  outline: none;
  box-sizing: border-box;
}
.cs-search input:focus {
  border-color: var(--color-primary, #2563eb);
}
.cs-list {
  overflow-y: auto;
  flex: 1;
}
.cs-item {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-main, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-item:hover {
  background: var(--bg-light, #f1f5f9);
}
.cs-item.selected {
  background: var(--color-primary-light, #eff6ff);
  color: var(--color-primary, #2563eb);
  font-weight: 600;
}
.cs-item.cs-placeholder {
  color: var(--gray-400, #94a3b8);
}

/* ============================================ */
/*  CALENDARI ESCOLAR                           */
/* ============================================ */

/* Wrapper general */
.cal-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 1rem 0 1.2rem;
}

/* Card unificada: pestanyes + graella del mes */
.cal-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  background: #fff;
  flex: 1;
  min-height: 0;
}

/* --- Barra superior: pestanyes de mes + selector de curs --- */
.cal-top-bar {
  display: flex;
  align-items: stretch;
  background: #f8fafc;
  border-bottom: 1px solid var(--gray-300);
  flex-shrink: 0;
  min-height: 38px;
  padding: 0;
  gap: 0;
}

.cal-month-tabs-scroller {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
  align-items: stretch;
}
.cal-month-tabs-scroller::-webkit-scrollbar { display: none; }

.cal-month-tabs {
  display: flex;
  align-items: stretch;
}

.cal-month-tab {
  background: transparent;
  border: none;
  border-right: 1px solid var(--gray-300);
  border-bottom: 1px solid transparent;
  padding: 0 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  height: 100%;
}
.cal-month-tab:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}
.cal-month-tab.active {
  color: var(--color-primary, #2563eb);
  background: color-mix(in srgb, var(--color-primary, #2563eb) 10%, #fff);
  border-bottom: 1px solid var(--color-primary, #2563eb);
  font-weight: 700;
}

/* --- Barra del nom del calendari (estil "Aula: 119") --- */
.cal-name-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--gray-300);
  background: #fff;
  flex-shrink: 0;
}
.cal-name-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-400);
}
.cal-name-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gray-700);
  padding: 1px 4px;
}
.cal-name-curs {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  border-radius: 4px;
  padding: 2px 8px;
}
.cal-name-actiu {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary, #2563eb);
  background: color-mix(in srgb, var(--color-primary, #2563eb) 10%, #fff);
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: auto;
}
.cal-name-actiu .bi { font-size: 0.78rem; }
.cal-name-set-actiu {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary, #2563eb);
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--color-primary, #2563eb) 40%, #fff);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cal-name-set-actiu:hover {
  background: var(--color-primary, #2563eb);
  color: #fff;
}

/* --- Menubar --- */
.cal-menubar {
  flex-shrink: 0;
}

/* .cal-month-title eliminat (mes visible a les pestanyes) */

/* Controls d'alçada de files */
.cal-row-height-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: 'Inter', system-ui, sans-serif;
}
.cal-row-height-controls button {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 0.75rem;
  transition: background 0.1s;
}
.cal-row-height-controls button:hover:not([disabled]) {
  background: var(--gray-100);
  color: var(--gray-900);
}
.cal-row-height-controls button[disabled] {
  opacity: 0.35;
  cursor: default;
}
.cal-row-height-val {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500);
  min-width: 34px;
  text-align: center;
  font-family: 'Inter', monospace;
}

/* Fa que el contenidor d'items del calendari s'estiri per emplenar tota la barra */
#calMenubarOuterItems {
  flex: 1;
}

/* --- Botons desfer/refer --- */
.cal-history-btns {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 2px;
  padding: 0 6px;
  border-right: 1px solid #c8cdd4;
}
.cal-history-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 0.95rem;
  padding: 3px 6px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  transition: color 0.1s, background 0.1s;
}
.cal-history-btn:hover:not([disabled]) {
  color: var(--gray-800);
  background: var(--gray-200);
}
.cal-history-btn[disabled] {
  opacity: 0.3;
  cursor: default;
}

/* --- Botó de pantalla completa (menubar, a la dreta de desfer/refer) --- */
.cal-fs-btn {
  margin-left: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1rem;
  padding: 0 12px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.cal-fs-btn:hover {
  color: var(--gray-700);
}

/* --- Mode pantalla completa del calendari --- */
body.cal-fullscreen-active .sidebar,
body.cal-fullscreen-active .topbar {
  display: none !important;
}
body.cal-fullscreen-active .main-content {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: #fff;
}

/* --- Àrea de la graella: sense padding lateral, ample complet --- */
.cal-grid-area {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

/* La graella del mes és filla de .cal-card: sense border/shadow/radius propis */
.cal-month-grid {
  width: 100%;
}

.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-300);
}

.cal-day-header {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0;
}
.cal-day-header.cal-header-weekend {
  color: var(--gray-400);
}

.cal-grid-body {
  display: flex;
  flex-direction: column;
}

.cal-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--gray-300);
}
.cal-week-row:last-child {
  border-bottom: none;
}

/* --- Cel·la de dia: altura fixa i igual per a totes les files --- */
.cal-day-cell {
  height: var(--cal-row-h, 72px);
  min-height: var(--cal-row-h, 72px);
  max-height: var(--cal-row-h, 72px);
  overflow: hidden;
  border-right: 1px solid var(--gray-300);
  padding: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.1s;
  background: #fff;
}
.cal-day-cell:last-child {
  border-right: none;
}
.cal-day-cell:hover {
  box-shadow: inset 0 0 0 2px var(--blue-200, #bfdbfe);
  z-index: 1;
}
.cal-day-cell.cal-day-empty {
  background: var(--gray-50);
  cursor: default;
}
.cal-day-cell.cal-day-empty:hover {
  box-shadow: none;
}
.cal-day-cell.cal-day-selected {
  box-shadow: inset 0 0 0 2px var(--color-primary, #2563eb) !important;
  z-index: 2;
}
.cal-day-cell.cal-weekend { background: #fdfdfe; }
.cal-day-cell.cal-festiu  { background: #fefce8; }
.cal-day-cell.cal-lliure  { background: #eff6ff; }

/* Número del dia + etiqueta festiu/lliure inline */
.cal-day-top {
  display: flex;
  align-items: baseline;
  padding: 0.25rem 0.35rem 0.1rem;
  flex-shrink: 0;
  min-width: 0;
  gap: 2px;
}

.cal-day-number {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  line-height: 1;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.cal-day-number.cal-today-num {
  color: #fff;
  font-weight: 700;
  background: var(--gray-800);
  border-radius: 3px;
  padding: 0 5px;
}
.cal-day-cell.cal-today .cal-day-top {
  background: transparent;
}

.cal-day-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: flex-end;
  flex: 1;
  margin-left: 2px;
}

/* --- Etiqueta inline de festiu / lliure disposició --- */
.cal-day-mark-label {
  font-size: 0.6rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  margin-left: 3px;
  line-height: 1.3;
  align-self: flex-end;
  padding-bottom: 1px;
}
.cal-day-mark-festiu        { color: #92400e; }
.cal-day-mark-lliure        { color: #1e40af; }
.cal-day-mark-editable      { cursor: pointer; }
.cal-day-mark-editable:hover { text-decoration: underline; text-decoration-style: dashed; }

/* --- Capçalera de secció: label + (pastilla si overflow) a la mateixa fila --- */
.cal-section-header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
  min-height: 0;   /* col·lapsa a 0 quan no hi ha label ni pill visible */
}

/* === ESTAT NORMAL: entrades visibles, pastilla oculta === */
.cal-section-entries       { display: flex; }
.cal-overflow-pill         { display: none; }

/* === ESTAT OVERFLOW: entrades ocultes, pastilla ocupa tot l'alt === */

/* La pastilla surt a la capçalera i s'expandeix per omplir la secció */
.cal-section-overflow .cal-section-header {
  flex: 1;           /* la capçalera creix fins a omplir l'alçada de la secció */
  align-items: center;
}
.cal-section-overflow .cal-section-entries {
  display: none;     /* amaga totes les entrades */
}
.cal-section-overflow .cal-overflow-pill {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-start;
  background: rgba(0,0,0,0.06);
  border-radius: 3px;
  margin: 1px 0;
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--gray-800);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  padding: 1px 4px;
}
.cal-section-overflow .cal-overflow-pill::before {
  content: none;
}
.cal-section-overflow .cal-overflow-pill:hover {
  background: rgba(0,0,0,0.13);
  color: var(--gray-800);
}

/* --- Tooltip global d'overflow (fixed, escapa overflow:hidden dels pares) --- */
.cal-overflow-tooltip-global {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  padding: 4px 6px;
  min-width: 160px;
  max-width: 280px;
  pointer-events: auto;  /* navegable */
}
.cal-overflow-tip-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 2px;
  border-bottom: 1px solid var(--gray-100);
}
.cal-overflow-tip-item:last-child { border-bottom: none; }
.cal-overflow-tip-item {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}
.cal-overflow-tip-item:hover { background: var(--gray-100); }
.cal-overflow-tip-empty      { cursor: default; font-style: italic; color: var(--gray-400); }
.cal-overflow-tip-empty:hover { background: none; }

.cal-tip-text {
  flex: 1;
  font-size: 0.77rem;
  color: var(--gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-tip-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.68rem;
  padding: 2px 3px;
  border-radius: 3px;
  flex-shrink: 0;
  opacity: 0;
  color: var(--gray-400);
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.cal-overflow-tip-item:hover .cal-tip-del { opacity: 1; }
.cal-tip-del:hover  { color: var(--red-500); background: var(--red-50); }

/* --- Contenidor de seccions --- */
.cal-sections-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cal-sections-container:empty {
  flex: 0;
}

/* --- Secció individual: fila horitzontal (contingut + botó + dreta) --- */
.cal-section {
  border-top: 1px solid transparent;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  transition: background 0.1s;
}
.cal-section:first-child { border-top: none; }
.cal-section-single      { border-top: none !important; }

/* Zona de contingut (label + entrades + pill) */
.cal-section-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 2px 2px 3px 4px;
}

.cal-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.cal-section-entries {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 2px;
  padding-bottom: 2px;
}

/* --- Entrades --- */
.cal-entry {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.07);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
  padding: 1px 3px 1px 4px;
  font-size: var(--cal-entry-fs, 11px);
  color: var(--gray-900);
  line-height: 1.3;
  min-height: 14px;
  gap: 2px;
}
.cal-entry-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-chips-expanded .cal-entry {
  align-items: flex-start;
}
.cal-chips-expanded .cal-entry-text {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

/* --- Alt variable: cada rengle de dies s'adapta al contingut --- */
.cal-alt-variable .cal-day-cell {
  height: auto;
  min-height: 0;       /* treu la restricció del rowHeight fix */
  max-height: none;
  overflow: visible;
}
.cal-alt-variable .cal-sections-container {
  overflow: visible;
  min-height: auto;
  /* flex:1 es manté per omplir l'alçada de la cel·la */
}
.cal-alt-variable .cal-section {
  flex: none;          /* cada secció ocupa el seu propi contingut */
  overflow: visible;
  min-height: auto;
}
.cal-alt-variable .cal-section-main {
  overflow: visible;
  min-height: auto;
}
.cal-alt-variable .cal-section-entries {
  flex: none;
  overflow: visible;
  min-height: 18px;    /* mínim una chip */
}
/* --- Ajustar a pantalla: zoom on #calGridArea via JS; prevent page scroll --- */
body.cal-fit-screen-active .content-area:has(#view-eines-calendari.active) {
  overflow-y: hidden;
}

.cal-entry:hover {
  background: rgba(0,0,0,0.12);
}
.cal-entry-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 0.75rem;
  padding: 0 1px;
  line-height: 1;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.cal-entry:hover .cal-entry-del {
  opacity: 1;
  color: var(--red-500);
}
.cal-entry-del:hover {
  background: var(--red-50);
  border-radius: 2px;
}

/* --- Drag-and-drop d'entrades --- */
.cal-entry-draggable {
  cursor: grab;
}
.cal-entry-draggable:active {
  cursor: grabbing;
}
.cal-entry.cal-dragging {
  opacity: 0.35;
}
.cal-section.cal-drag-over {
  outline: 2px dashed var(--blue-500, #3b82f6);
  outline-offset: -2px;
  background-color: rgba(59, 130, 246, 0.07) !important;
}

/* --- Escriptura directa --- */
.cal-section-direct {
  cursor: text;
}
.cal-section-direct .cal-entry {
  cursor: pointer;  /* els chips mantenen cursor de clic */
}
.cal-section-direct .cal-plus-btn {
  cursor: pointer;
}
.cal-direct-input-wrap {
  padding: 0;
}
.cal-direct-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--gray-800);
  padding: 1px 2px;
  outline: none;
  min-width: 0;
  caret-color: var(--gray-700);
}

/* --- Botó + per afegir: franja vertical a la dreta de la secció --- */
.cal-plus-btn {
  display: flex;               /* sempre reserva espai; visibility controla visibilitat */
  visibility: hidden;
  pointer-events: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  align-self: stretch;
  margin: 2px 2px 2px 0;
  background: rgba(55,65,81,0.08);
  color: var(--gray-600);
  border: none;
  border-left: 1px solid rgba(55,65,81,0.12);
  border-radius: 3px !important;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}
.cal-plus-btn.visible {
  visibility: visible;
  pointer-events: auto;
}
.cal-plus-btn:hover {
  background: var(--gray-700);
  color: #fff;
}

/* --- Modal del calendari --- */
.cal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: calFadeIn 0.12s ease;
}
@keyframes calFadeIn { from { opacity: 0; } to { opacity: 1; } }

.cal-modal {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  width: 360px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  animation: calSlideUp 0.13s ease;
}
@keyframes calSlideUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.cal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem 0.7rem;
  border-bottom: 1px solid var(--gray-200);
}
.cal-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
}
.cal-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.cal-modal-close:hover { color: var(--gray-700); }

.cal-modal-body {
  padding: 1rem 1.1rem;
}
.cal-modal-label {
  font-size: 0.85rem;
  color: var(--gray-600);
  display: block;
  margin-bottom: 0.5rem;
}

.cal-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem 0.9rem;
  border-top: 1px solid var(--gray-100);
}
.cal-modal-footer .btn {
  border-radius: 12px;
}

/* Botó danger per modals de confirmació */
.btn-danger {
  background: var(--red-500);
  color: #fff;
  border-color: var(--red-500);
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* =============================================
   VIGILÀNCIA D'ESPAIS  (.vig-*)
   ============================================= */

/* --- Menubar --- */
.vig-menubar {
  display: flex; align-items: center; gap: 0;
  padding: 0.2rem 0.5rem;
  background: #fff; border-bottom: 1px solid var(--gray-200); flex-shrink: 0;
}
.vig-menu-espai--actiu { font-weight: 600; }
.vig-espai-nom { font-weight: 600; font-size: 1rem; color: var(--gray-800); }

/* --- Selector principal (legacy) --- */
.vig-selector-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.vig-espai-sel {
  flex: 1;
  min-width: 200px;
  max-width: 380px;
  padding: 0.5rem 0.8rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}
.vig-espai-sel:focus { outline: none; border-color: var(--green-500, #22c55e); }
.vig-info-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Espai card --- */
.vig-espai-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--gray-50);
  transition: box-shadow 0.15s;
}
.vig-espai-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,0.07); }
.vig-espai-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.45rem;
}
.vig-espai-nom  { font-weight: 600; font-size: 0.95rem; color: var(--gray-800); }
.vig-espai-hora { font-size: 0.82rem; color: var(--gray-500); margin-top: 0.1rem; }
.vig-espai-btns { display: flex; gap: 0.4rem; }

/* --- Badges --- */
.vig-badges-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.vig-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 500;
}
.vig-badge--dia  { background: #d1fae5; color: #065f46; }
.vig-badge--zona { background: var(--gray-200); color: var(--gray-700); }
.vig-text-muted  { font-size: 0.8rem; color: var(--gray-400); font-style: italic; }

/* --- Professor list --- */
#vigProfessorsList {
  display: grid; grid-template-columns: 1fr 1fr 1fr; column-gap: 1.5rem;
}
.vig-prof-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--gray-100);
}
.vig-prof-row--off { opacity: 0.45; }
.vig-prof-check-wrap input { width: 1rem; height: 1rem; cursor: pointer; }
.vig-prof-nom {
  flex: 0 0 165px; width: 165px;
  font-size: 0.85rem; font-weight: 500; color: var(--gray-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vig-prof-dies { display: flex; gap: 0.1rem; flex-shrink: 0; }
.vig-dia-btn {
  display: inline-flex; align-items: center; gap: 0.15rem;
  width: 2.6rem; flex-shrink: 0; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: 4px;
  font-size: 0.74rem; padding: 0.05rem 0; cursor: pointer;
  color: var(--gray-400); font-family: inherit; transition: background 0.1s, color 0.1s;
  line-height: 1.4;
}
.vig-dia-btn:not(:disabled):hover { background: var(--gray-100); color: var(--gray-600); }
.vig-dia-btn--pref  { color: #065f46; font-weight: 700; }
.vig-dia-btn--avoid { color: #991b1b; font-weight: 700; }
.vig-dia-btn:disabled { opacity: 0.4; cursor: default; }
.vig-dia-icon { flex: 0 0 0.75rem; text-align: center; font-size: 0.7rem; }

.vig-check-label {
  display: inline-flex; align-items: center; gap: 0.3rem;
  cursor: pointer; padding: 0.2rem 0.55rem;
  border-radius: 5px; font-size: 0.82rem;
  border: 1px solid var(--gray-200); background: #fff;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}
.vig-check-label:has(input:checked) {
  background: #d1fae5; border-color: #22c55e; color: #065f46; font-weight: 600;
}
.vig-check-label--sm { padding: 0.1rem 0.35rem; font-size: 0.74rem; }
.vig-disabled { opacity: 0.45; pointer-events: none; }

.vig-drag-handle {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem; border-radius: 5px;
  border: 1px solid var(--gray-300); background: var(--gray-50);
  cursor: grab; font-size: 0.78rem; color: var(--gray-600);
  white-space: nowrap; flex-shrink: 0;
}
.vig-drag-handle:hover { background: var(--gray-100); border-color: var(--gray-400); }
.vig-drag-handle:active { cursor: grabbing; }

/* --- Criteris box --- */
.vig-criteris-box {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 8px; padding: 1rem 1.25rem;
}
.vig-criteris-title {
  font-size: 0.78rem; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 0.75rem;
}
.vig-criteris-grid { display: flex; flex-direction: column; gap: 0.55rem; }
.vig-cb-label {
  display: flex; align-items: flex-start; gap: 0.55rem;
  font-size: 0.85rem; color: var(--gray-700); cursor: pointer;
}
.vig-cb-label input[type=checkbox] { margin-top: 0.2rem; flex-shrink: 0; }

/* --- Graella --- */
.vig-graella-title {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem; font-size: 1rem; color: var(--gray-800);
}
.vig-hora-badge {
  font-size: 0.8rem; background: var(--gray-100);
  padding: 0.2rem 0.65rem; border-radius: 999px; color: var(--gray-600);
}
.vig-graella-outer { overflow-x: auto; padding-bottom: 0.5rem; }
.vig-table-wrap {
  --vig-grid-border: #8f98a8;
  overflow-x: auto; border: 1px solid var(--vig-grid-border); border-radius: 8px;
}
.vig-table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.vig-table th, .vig-table td {
  border-right: 1px solid var(--vig-grid-border); border-bottom: 1px solid var(--vig-grid-border);
  padding: 0.5rem 0.6rem; vertical-align: top;
}
.vig-table th:last-child, .vig-table td:last-child { border-right: 0; }
.vig-table tbody tr:last-child td { border-bottom: 0; }
.vig-th-zona {
  background: var(--gray-100); font-size: 0.76rem; font-weight: 600;
  color: var(--gray-600); text-align: left; min-width: 100px; white-space: nowrap;
}
.vig-th-dia {
  background: var(--gray-100); font-size: 0.82rem; font-weight: 600;
  color: var(--gray-700); text-align: center; min-width: 130px;
}
.vig-td-zona { background: var(--gray-50); min-width: 120px; max-width: 170px; vertical-align: middle !important; }
.vig-zona-cell-inner {
  min-height: 54px; display: flex; flex-direction: column;
  justify-content: center; gap: 0.12rem;
}
.vig-zona-label { font-size: 0.82rem; font-weight: 600; color: var(--gray-700); }
.vig-zona-desc-grid { font-size: 0.72rem; font-weight: 400; color: var(--gray-600); line-height: 1.25; }
.vig-zona-np    { font-size: 0.72rem; color: var(--gray-400); margin-top: 0.1rem; }
.vig-table td.vig-cell {
  padding: 0; vertical-align: stretch;
}
.vig-cell {
  min-width: 130px; height: calc(var(--vig-slot-capacity, 1) * 34px);
  min-height: 54px; position: relative;
  transition: background 0.12s;
}
.vig-cell--over {
  background: #d1fae5 !important;
  outline: 2px dashed #22c55e;
  outline-offset: -2px;
}
.vig-cell--full { background: var(--gray-50); cursor: not-allowed; }
.vig-cell--full .vig-cell-drop-hint { display: none !important; }
.vig-cell-drop-hint {
  font-size: 0.72rem; color: var(--gray-300); text-align: center;
  padding: 0.25rem 0; display: none; margin: auto;
}
.vig-cell:not(:has(.vig-card)) .vig-cell-drop-hint,
.vig-cell--over .vig-cell-drop-hint { display: block; }

/* --- Cards de professors --- */
.vig-card {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: var(--green-600, #16a34a); color: #fff;
  border-radius: 5px; padding: 0.18rem 0.25rem 0.18rem 0.5rem;
  font-size: 0.78rem; font-weight: 500; margin: 2px;
  cursor: grab; max-width: 135px;
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s;
  user-select: none;
}
/* Cards dins d'una cel·la ocupen tota l'amplada i s'apilen verticalment */
.vig-cell-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; min-height: 54px;
}
.vig-cell .vig-card {
  display: flex !important;
  width: 100% !important;
  flex: 0 0 calc(100% / var(--vig-slot-capacity, 1));
  max-width: none !important;
  box-sizing: border-box;
  margin: 0 !important;
  border-radius: 0;
  align-items: center;
  padding: 0.25rem 0.45rem 0.25rem 0.65rem;
  border-top: 1px solid rgba(255,255,255,0.28);
}

/* ============================================ */
/* Preferències: majúscules matèries            */
/* ============================================ */
body.mat-uppercase .materia-cell,
body.mat-uppercase .ch-materia,
body.mat-uppercase [data-concepte],
body.mat-uppercase .dc-assignacio-nom,
body.mat-uppercase .vig-materia,
body.mat-uppercase td.mat { text-transform: uppercase; }
.vig-cell .vig-card:first-child {
  border-top: 0;
}
.vig-cell .vig-card:hover { transform: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }
.vig-card:hover        { transform: translateY(-1px); box-shadow: 0 2px 7px rgba(0,0,0,0.18); }
.vig-card--dragging    { opacity: 0.35; }
.vig-card--over        { outline: 2px dashed rgba(255,255,255,0.8); outline-offset: -1px; }
.vig-card--pool        { background: var(--gray-500, #6b7280); }
.vig-card-nom {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.vig-cell .vig-card-nom {
  text-align: center;
}
.vig-card-x {
  background: none; border: none; color: var(--vig-card-x-color, rgba(255,255,255,0.7));
  opacity: 0.72;
  cursor: pointer; font-size: 0.9rem; line-height: 1;
  padding: 0 0.1rem; border-radius: 3px; flex-shrink: 0;
}
.vig-card-x:hover { opacity: 1; background: rgba(0,0,0,0.14); }

/* --- Pool (fora de la graella) --- */
.vig-pool {
  margin-top: 1rem; border: 2px dashed var(--gray-300);
  border-radius: 8px; padding: 0.75rem 1rem; min-height: 52px;
  background: var(--gray-50); transition: border-color 0.15s, background 0.15s;
}
.vig-pool--over { border-color: var(--gray-500); background: var(--gray-100); }
.vig-pool-label { font-size: 0.74rem; color: var(--gray-400); font-style: italic; }
.vig-pool-cards { display: flex; flex-wrap: wrap; gap: 0.35rem; min-height: 28px; }
.vig-disponibles-pool {
  border: 2px dashed var(--gray-300); border-radius: 8px;
  padding: 0.75rem 1rem; min-height: 52px; background: var(--gray-50);
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-content: flex-start;
}

/* --- Modal zones --- */
.vig-dies-row  { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.vig-zones-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.25rem; }
.vig-zona-row  { display: flex; align-items: center; gap: 0.5rem; }
.vig-zona-num  {
  width: 1.3rem; font-size: 0.78rem; font-weight: 600;
  color: var(--gray-500); text-align: center; flex-shrink: 0;
}
.vig-zona-texts {
  flex: 1 1 0; min-width: 90px; display: flex; flex-direction: column; gap: 0.25rem;
}
/* Overrides globals de .form-group input / .modal .form-group input */
.vig-zona-row .vig-zona-nom,
.vig-zona-row .vig-zona-desc {
  width: 100% !important;
  border: 1px solid var(--gray-300) !important; border-radius: 4px !important;
  padding: 0.28rem 0.5rem !important; font-size: 0.85rem !important;
  box-sizing: border-box;
}
.vig-zona-row .vig-zona-desc {
  font-size: 0.78rem !important;
}
.vig-zona-row .vig-zona-nom:focus,
.vig-zona-row .vig-zona-desc:focus { border-color: var(--green-500, #22c55e) !important; outline: none; }
.vig-zona-np-label { font-size: 0.78rem; color: var(--gray-500); white-space: nowrap; flex-shrink: 0; }
.vig-zona-row .vig-zona-np {
  flex: 0 0 58px !important; width: 58px !important;
  border: 1px solid var(--gray-300) !important; border-radius: 4px !important;
  padding: 0.28rem 0.4rem !important; font-size: 0.85rem !important;
  text-align: center; box-sizing: border-box;
}
.vig-zona-row .vig-zona-np:focus { border-color: var(--green-500, #22c55e) !important; outline: none; }
.vig-zona-row .vig-zona-color {
  flex: 0 0 32px; width: 32px; height: 28px;
  padding: 2px; border: 1px solid var(--gray-300); border-radius: 4px;
  cursor: pointer; background: none;
}

/* --- Chips de professors disponibles --- */
.vig-prof-chips-area {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.vig-prof-chips-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.vig-etapes-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.vig-etapa-btn {
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.vig-etapa-btn:hover { background: var(--gray-100); border-color: var(--gray-400); }
.vig-etapa-btn--active {
  background: #1e40af;
  border-color: #1e40af;
  color: #fff;
}
.vig-prof-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 32px;
}
.vig-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--gray-300);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
  cursor: grab;
  user-select: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.1s, box-shadow 0.1s;
}
.vig-chip:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.vig-chip:active { cursor: grabbing; }
.vig-chip.vig-card--dragging { opacity: 0.35; }
.vig-chip--lg {
  padding: 0.45rem 0.6rem 0.45rem 0.9rem;
  border-radius: 8px;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.vig-chip-nom { flex: 1; }
.vig-chip-x {
  background: none; border: none; color: var(--gray-400);
  cursor: pointer; font-size: 1rem; line-height: 1;
  padding: 0 0.1rem; border-radius: 3px; flex-shrink: 0;
}
.vig-chip-x:hover { color: var(--gray-700); background: var(--gray-100); }

/* --- Modal comunicar --- */
.vig-mail-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  margin-bottom: 1rem;
}
.vig-mail-card summary {
  list-style: none;
  cursor: pointer;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--gray-700);
}
.vig-mail-card summary::-webkit-details-marker { display: none; }
.vig-mail-card[open] summary {
  border-bottom: 1px solid var(--gray-200);
}
.vig-mail-card[open] summary .bi-chevron-down {
  transform: rotate(180deg);
}
.vig-mail-card-body {
  padding: 0.9rem 1rem 1rem;
}
.vig-mail-dest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.4rem;
  max-height: 220px;
  overflow: auto;
}
.vig-mail-dest-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: #fff;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  color: var(--gray-700);
}
.vig-mail-dest-item input { flex-shrink: 0; }
.vig-mail-dest-item span {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vig-mail-dest-item small {
  color: var(--gray-400);
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Filtre professors (dins card de professors) --- */
.vig-prof-filtres-row {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin-bottom: 0.75rem; padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--gray-100);
}
.vig-filt-sep {
  display: inline-block; width: 1px; background: var(--gray-200);
  margin: 0 0.25rem; align-self: stretch;
}

/* --- Misc --- */
.vig-hint { font-size: 0.83rem; color: var(--gray-500); margin-bottom: 0.75rem; line-height: 1.5; }
.vig-spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: vigSpin 0.6s linear infinite; vertical-align: middle;
}
@keyframes vigSpin { to { transform: rotate(360deg); } }

/* ============================================ */
/*  NOM-ARXIUS — Modal configurador de patró    */
/* ============================================ */
.nom-arxius-modal {
  width: 94vw;
  max-width: 1180px;
  max-height: 88vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.na-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.na-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.na-header-sub {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 400;
  margin-left: 0.25rem;
}

.na-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.na-left  { display: flex; flex-direction: column; gap: 0.75rem; }
.na-right { display: flex; flex-direction: column; gap: 0.75rem; }

.na-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.na-card-title {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-500);
  margin-bottom: 0.7rem;
}

/* Paleta */
.na-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.na-tile {
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 2px solid transparent;
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.na-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.35);
}
.na-tile:active { cursor: grabbing; }
.na-tile i { font-size: 0.9rem; flex-shrink: 0; }
.na-tile .na-ti-info { display: flex; flex-direction: column; }
.na-tile .na-ti-info strong { font-size: 0.67rem; font-weight: 700; line-height: 1.2; }
.na-tile .na-ti-info small  { font-size: 0.58rem; opacity: 0.85; }

/* Colors tokens — compartits entre paleta i zona de construcció */
.t-nom { background: linear-gradient(135deg, #1d4ed8, #60a5fa); }
.t-cog { background: linear-gradient(135deg, #15803d, #4ade80); }
.t-sep { background: linear-gradient(135deg, #b45309, #fbbf24); }
.t-txt { background: linear-gradient(135deg, #7e22ce, #c084fc); }
.t-num { background: linear-gradient(135deg, #9f1239, #fb7185); }
.t-ext { background: linear-gradient(135deg, #0e7490, #22d3ee); }
.t-wld { background: linear-gradient(135deg, #44403c, #a8a29e); }

/* Presets */
.na-preset-list { display: flex; flex-direction: column; gap: 0.3rem; }
.na-preset-btn {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  color: var(--gray-700);
  font-size: 0.77rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.na-preset-btn:hover { background: var(--blue-50); border-color: var(--blue-500); color: var(--blue-600); }
.na-preset-btn .na-ex { font-size: 0.63rem; opacity: 0.55; font-family: monospace; }

/* Builder */
.na-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}
.na-drop-zone {
  min-height: 58px;
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.7rem;
  gap: 0.35rem;
  flex-wrap: wrap;
  position: relative;
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
}
.na-drop-zone.over { border-color: var(--blue-500); background: var(--blue-50); }
.na-dz-hint {
  color: var(--gray-400);
  font-size: 0.78rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
}

/* Tokens a la zona de construcció */
.na-tok {
  position: relative;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 2px solid transparent;
  color: #fff;
  transition: filter 0.12s, border-color 0.12s;
}
.na-tok:hover { filter: brightness(1.1); }
.na-tok.sel   { border-color: rgba(255,255,255,0.85); box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }
.na-tok.drag-ghost { opacity: 0.35; }
.na-tok .na-tok-label { font-size: 0.7rem; font-weight: 700; }
.na-tok .na-tok-badge {
  font-size: 0.58rem;
  background: rgba(0,0,0,0.2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
}
.na-tok .na-del-btn {
  position: absolute;
  top: -6px; right: -6px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--red-500);
  border: none;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}
.na-tok:hover .na-del-btn { opacity: 1; }
.na-tok-connector { color: var(--gray-400); font-size: 0.85rem; pointer-events: none; user-select: none; }

/* Fila inferior: config + preview */
.na-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Panell de configuració */
.na-cfg-empty { color: var(--gray-400); font-size: 0.78rem; text-align: center; padding: 1rem 0; }
.na-form-group { margin-bottom: 0.65rem; }
.na-form-group:last-child { margin-bottom: 0; }
.na-form-label {
  display: block;
  font-size: 0.67rem;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 0.28rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.na-form-select,
.na-form-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  padding: 0.38rem 0.55rem;
  color: var(--gray-800);
  font-size: 0.81rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.na-form-select:focus,
.na-form-input:focus { border-color: var(--blue-500); }
.na-inline-preview {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  padding: 0.38rem 0.65rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--gray-700);
}

/* Panell de previsualització */
.na-pattern-str {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-family: monospace;
  font-size: 0.83rem;
  color: var(--blue-600);
  margin-bottom: 0.65rem;
  word-break: break-all;
  border: 1px solid var(--gray-200);
}
.na-preview-table { width: 100%; border-collapse: collapse; font-size: 0.79rem; }
.na-preview-table th {
  text-align: left;
  padding: 0.28rem 0.55rem;
  color: var(--gray-500);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--gray-200);
}
.na-preview-table td  { padding: 0.35rem 0.55rem; border-bottom: 1px solid var(--gray-100); }
.na-preview-table tr:last-child td { border-bottom: none; }
.na-preview-table .arrow { color: var(--gray-400); text-align: center; width: 22px; }
.na-preview-table .fname { font-family: monospace; color: var(--green-600); font-weight: 500; }

/* Opcions avançades */
.na-adv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 1rem;
}
.na-adv-row:last-child  { border-bottom: none; padding-bottom: 0; }
.na-adv-row:first-child { padding-top: 0; }
.na-adv-label { font-size: 0.81rem; color: var(--gray-700); }
.na-adv-desc  { font-size: 0.69rem; color: var(--gray-500); margin-top: 1px; }

/* Toggle switch */
.na-sw { position: relative; width: 36px; height: 20px; flex-shrink: 0; display: inline-block; }
.na-sw input { opacity: 0; width: 0; height: 0; }
.na-sw-track {
  position: absolute; inset: 0;
  background: var(--gray-300);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.22s;
}
.na-sw-track::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  top: 3px; left: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.na-sw input:checked ~ .na-sw-track { background: var(--blue-500); }
.na-sw input:checked ~ .na-sw-track::before { transform: translateX(16px); }

/* Footer */
.na-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
}
.na-footer-hint { font-size: 0.77rem; color: var(--gray-500); margin-right: auto; }

/* Popup hores absència */
.abs-hora-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.35rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.83rem;
  transition: background 0.1s;
}
.abs-hora-label:hover { background: var(--gray-100); }
.abs-hora-label input[type="checkbox"] { accent-color: var(--color-primary); width: 14px; height: 14px; }
.abs-hora-txt { color: var(--gray-500); font-weight: 500; }
.abs-sel-btn {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
}
.abs-sel-btn:hover { border-color: var(--gray-400); color: var(--gray-600); }

/* Submenú del calendari: força l'aparença amb z-index al
