/* =============================================================================
   EDTneo — Feuille de style principale
   ============================================================================= */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --color-primary:    #0b2a6f;   /* navy — logo gradient start */
  --color-primary-d:  #1f7a8c;   /* teal  — logo gradient end  */
  --color-success:    #16a34a;
  --color-warning:    #d97706;
  --color-danger:     #dc2626;
  --color-info:       #0891b2;
  --color-muted:      #6b7280;

  --bg:               #f9fafb;
  --bg-card:          #ffffff;
  --border:           #e5e7eb;
  --text:             #111827;
  --text-light:       #6b7280;

  --radius:           6px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.1);
  --shadow:           0 2px 8px rgba(0,0,0,.12);
  --nav-h:            56px;
  --font:             system-ui, -apple-system, sans-serif;
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Consolas', monospace; background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-size: .9em; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: linear-gradient(90deg, #0b2a6f 0%, #1f7a8c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.nav-brand-link:hover { text-decoration: none; opacity: .9; }
.nav-logo { height: 32px; width: auto; display: block; flex-shrink: 0; }
.nav-semestre {
  font-size: .8rem;
  opacity: .75;
  margin-left: 8px;
  background: rgba(255,255,255,.15);
  padding: 2px 8px;
  border-radius: 12px;
}

/* ── Switcher de période (multi-actifs) ──────────────────────────────────── */
.nav-periode-switcher { position: relative; margin-left: 8px; }
.nav-semestre-btn {
  cursor: pointer;
  user-select: none;
  transition: opacity .15s;
}
.nav-semestre-btn:hover { opacity: 1; background: rgba(255,255,255,.25); }
/* ── Boutons dans la barre de navigation ─────────────────────────────────── */
.btn-nav {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-nav:hover { background: rgba(255,255,255,.25); text-decoration: none; color: #fff; }
.periode-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 200px;
  z-index: 200;
  list-style: none;
  padding: 4px 0;
}
.periode-dropdown.open { display: block; }
.periode-dropdown li a {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); padding: 8px 14px; font-size: .88rem;
}
.periode-dropdown li a:hover { background: var(--bg); text-decoration: none; }
.periode-dropdown li.active a { font-weight: 600; color: var(--color-primary); }
.badge-publie {
  background: #dcfce7; color: #166534;
  font-size: .7rem; padding: 1px 5px; border-radius: 8px;
  margin-left: auto;
}
/* Wrapper desktop des items de nav (hamburger panel sur mobile) */
.nav-collapse {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 16px;
  min-width: 0;
}
/* Bouton hamburger — masqué sur desktop */
.nav-hamburger { display: none; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
  flex: 1;
}
.nav-links a, .nav-links span {
  color: rgba(255,255,255,.85);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  display: block;
}
.nav-links a:hover, .nav-links span:hover { background: rgba(255,255,255,.15); text-decoration: none; color: #fff; }
.nav-links a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }

.nav-dropdown { position: relative; }
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  right: 0;
  height: 8px;
  pointer-events: auto;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 180px;
  z-index: 200;
  list-style: none;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu li a {
  display: block;
  color: var(--text);
  padding: 8px 16px;
  font-size: .9rem;
}
.dropdown-menu li a:hover { background: var(--bg); color: var(--color-primary); text-decoration: none; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: rgba(255,255,255,.9);
}
.btn-logout {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  margin: 0 auto;
  max-width: 1200px;
  border-radius: var(--radius);
  font-size: .9rem;
}
.flash-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--color-success); }
.flash-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--color-danger); }
.flash-info    { background: #e0f2fe; color: #075985; border-left: 4px solid var(--color-info); }
.flash-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--color-warning); }
.banner-lecture-seule { background: #fef3c7; color: #92400e; border-bottom: 2px solid #f59e0b; padding: 8px 24px; font-size: .88rem; font-weight: 500; text-align: center; }
.badge-env-dev {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: #f59e0b; color: #1c1917;
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 10px; pointer-events: none;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .9rem;
}
.alert-info    { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text); }
.card h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }
.card-info { background: #f0f9ff; border-color: #bae6fd; }
.card-success { background: #f0fdf4; border-color: #bbf7d0; }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; color: var(--text); }
.semestre-info { color: var(--text-light); font-size: .9rem; margin-left: auto; }
.subtitle { color: var(--text-light); font-size: .95rem; margin-top: 4px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  transition: background .15s, opacity .15s;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-d); }
.btn-outline  { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary-d); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text-light); border-color: var(--border); }
.btn-success  { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-warning  { background: var(--color-warning); color: #fff; border-color: var(--color-warning); }
.btn-danger   { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-outline-success { background: transparent; color: var(--color-success); border-color: var(--color-success); }
.btn-outline-warning  { background: transparent; color: var(--color-warning); border-color: var(--color-warning); }
.btn-outline-danger   { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn-back     { font-size: .85rem; color: var(--text-light); }
.btn-sm       { padding: 4px 10px; font-size: .8rem; }

/* ── Formulaires ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; background: #fff; color: var(--text);
}
.form-group input:focus, .form-group select:focus {
  outline: 2px solid var(--color-primary); outline-offset: 1px;
}
.form-group small { display: block; margin-top: 4px; color: var(--text-light); font-size: .8rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; color: var(--text-light); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f9fafb; }
.table-sm th, .table-sm td { padding: 5px 8px; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge { background: var(--color-primary); color: #fff; border-radius: 12px; padding: 2px 8px; font-size: .75rem; }
.badge-statut { border-radius: 12px; padding: 2px 8px; font-size: .75rem; font-weight: 500; }
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-valide   { background: #dcfce7; color: #166534; }
.badge-rejete   { background: #fee2e2; color: #991b1b; }
.badge-canceled   { background: #fee2e2; color: #991b1b; }
.rejet-motif    { font-size: .8rem; color: #991b1b; margin-top: .25rem; font-style: italic; }
.badge-draft    { background: #f3f4f6; color: #374151; }
.badge-actif    { background: #dcfce7; color: #166534; }
.badge-archive  { background: #e0e7ff; color: #3730a3; }
.badge-lecture  { background: #fef3c7; color: #92400e; }
.badge-publie-table { background: #dcfce7; color: #166534; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.badge-courante { background: rgba(11,42,111,.12); color: var(--color-primary); font-size: .72rem; padding: 1px 6px; border-radius: 8px; margin-left: 6px; }
.periode-courante td { background: #f0fdf4; }
.actions-cell { white-space: nowrap; }
.statuts-guide { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: baseline; font-size: .88rem; }
.statuts-guide dt { white-space: nowrap; }
.statuts-guide dd { color: var(--text-light); margin: 0; }
.badge-success  { background: #dcfce7; color: #166534; font-size: .75rem; padding: 2px 8px; border-radius: 12px; }
.badge-error    { background: #fee2e2; color: #991b1b; font-size: .75rem; padding: 2px 8px; border-radius: 12px; }
.badge-warning  { background: #fef3c7; color: #92400e; font-size: .75rem; padding: 2px 8px; border-radius: 12px; }

.role-badge { border-radius: 12px; padding: 2px 8px; font-size: .75rem; font-weight: 500; }
.role-admin        { background: #ede9fe; color: #5b21b6; }
.role-responsable  { background: #e0f2fe; color: #075985; }
.role-gestionnaire { background: #f0fdf4; color: #166534; }

/* ── UE Grid ──────────────────────────────────────────────────────────────── */
.ue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ue-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s;
}
.ue-card:hover { box-shadow: var(--shadow); border-color: var(--color-primary); text-decoration: none; }
.ue-code { font-weight: 700; color: var(--color-primary); font-size: .9rem; }
.ue-nom  { color: var(--text); font-size: .9rem; }
.ue-meta { color: var(--text-light); font-size: .78rem; margin-top: 4px; }

/* ── Sessions ─────────────────────────────────────────────────────────────── */
.session-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; background: var(--bg-card);
}
.session-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.session-type { padding: 2px 8px; border-radius: 12px; font-size: .78rem; font-weight: 600; }
.type-cm { background: #dbeafe; color: #1e40af; }
.type-td { background: #d1fae5; color: #065f46; }
.type-tp, .type-tme { background: #fce7f3; color: #9d174d; }
.type-examen { background: #fef9c3; color: #854d0e; }
.type-consultation-de-copies { background: #fef9c3; color: #854d0e; }
.session-horaire { font-weight: 500; font-size: .9rem; }
.session-groupes { color: var(--text-light); font-size: .85rem; margin-left: auto; }
.session-semaines { font-size: .85rem; color: var(--text-light); margin-bottom: 8px; }
.session-salles { font-size: .85rem; margin-bottom: 8px; }
.session-salles summary { cursor: pointer; color: var(--text-light); }
.session-notes-publiques { font-size: .85rem; margin-bottom: 8px; }
.session-notes-publiques summary { cursor: pointer; color: var(--text-light); }
.salles-list, .notes-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.salle-item, .note-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: .78rem;
}
.salle-content, .note-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.note-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.salle-dates, .note-dates {
  color: var(--text-light);
  font-size: .72rem;
}
.salle-actions, .note-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.salle-badge { background: #f3f4f6; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: .78rem; margin-right: 4px; }
.session-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.session-changements { margin-top: 10px; font-size: .85rem; overflow-x: auto; }
.session-changements summary { cursor: pointer; color: var(--text-light); }

.sessions-filtre { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filtre-btn {
  cursor: pointer; border: 1.5px solid transparent; padding: 4px 11px; border-radius: 99px;
  font-size: .78rem; font-weight: 600; opacity: .6;
  transition: opacity .15s, border-color .15s, box-shadow .15s;
}
.filtre-btn:hover { opacity: .9; }
.filtre-btn.active { opacity: 1; border-color: currentColor; box-shadow: 0 0 0 1px currentColor; }
.filtre-all { background: #f3f4f6; color: var(--text); }

/* ── Onglets fiche UE ─────────────────────────────────────────────────────── */
.detail-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.detail-tab-panel { display: none; }
.detail-tab-panel.active { display: block; }

/* ── Grille de sessions (fiche UE) ────────────────────────────────────────── */
.session-grid {
  display: grid; gap: 12px; align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.session-grid .session-card { margin-bottom: 0; min-width: 0; }
/* Grand écran : 3 cartes par ligne */
@media (min-width: 2500px) { .session-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Petit écran : une seule colonne */
@media (max-width: 720px) { .session-grid { grid-template-columns: 1fr; } }
.session-publics { font-size: .85rem; margin-bottom: 8px; }
.session-publics summary { cursor: pointer; color: var(--text-light); }
.session-publics-body { margin-top: 4px; color: var(--text-light); }

/* ── Filter bar (changements) ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar a {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-light);
  background: var(--bg-card);
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.filter-bar a:hover { color: var(--text); border-color: #d1d5db; background: #f3f4f6; text-decoration: none; }
.filter-bar a.active { color: #fff; border-color: transparent; }
.filter-bar a.filter-pending.active { background: var(--color-warning); }
.filter-bar a.filter-valide.active  { background: var(--color-success); }
.filter-bar a.filter-rejete.active  { background: var(--color-danger); }
.filter-bar a.filter-toutes.active  { background: var(--color-primary); }

/* ── Changements ──────────────────────────────────────────────────────────── */
.changements-list {
  display: grid; gap: 12px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}
.changements-list .changement-card { margin-bottom: 0; }
@media (max-width: 760px) { .changements-list { grid-template-columns: 1fr; } }
.changement-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; background: var(--bg-card);
}
.changement-card.statut-pending  { border-left: 4px solid var(--color-warning); }
.changement-card.statut-valide   { border-left: 4px solid var(--color-success); }
.changement-card.statut-rejete   { border-left: 4px solid var(--color-danger); opacity: .8; }
.changement-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-delete-form { margin-left: auto; }
.changement-details { font-size: .88rem; display: grid; gap: 4px; margin-bottom: 10px; }
.changement-meta { color: var(--text-light); font-size: .8rem; margin-top: 4px; }
.changement-actions { display: flex; gap: 8px; }
.motif-rejet { background: #fee2e2; color: #991b1b; padding: 6px 10px; border-radius: 4px; font-size: .85rem; margin-top: 6px; }
.type-badge { background: #f3f4f6; border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-size: .78rem; }

/* ── Calendrier — page header ─────────────────────────────────────────────── */
.cal-page-header { flex-wrap: wrap; gap: 8px; }
.week-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.week-label { font-weight: 600; }
.week-dates { font-weight: 400; color: var(--text-light); font-size: .88rem; }

/* ── Filtres calendrier (sticky) ─────────────────────────────────────────── */
.cal-filtres {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 12px;
  position: sticky;
  top: calc(var(--nav-h) + 6px);
  z-index: 50;
  box-shadow: var(--shadow);
}
.filtre-groupe { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.filtre-afficher { flex-direction: row; align-items: center; gap: 8px; border-right: 1px solid var(--border); padding-right: 14px; margin-right: 2px; }
.filtre-label { font-weight: 600; font-size: .8rem; color: var(--text-light); white-space: nowrap; }
.radio-inline { font-size: .85rem; display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.filtre-details { border-left: 1px solid var(--border); padding-left: 14px; }
.filtre-details summary { cursor: pointer; font-weight: 600; font-size: .8rem; color: var(--text-light); list-style: none; padding: 4px 0; }
.filtre-details summary::-webkit-details-marker { display: none; }
.filtre-details summary::after { content: ' ▾'; font-size: .7rem; }
details[open].filtre-details summary::after { content: ' ▴'; }
.filtre-checks { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 4px; max-width: 380px; }
.check-inline { font-size: .83rem; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.check-sub { color: var(--text-light); font-size: .76rem; }
.filtre-count { color: var(--color-primary); font-weight: 700; }
.filtre-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; padding: 4px 0; }
.filtre-types { border-left: 1px solid var(--border); padding-left: 14px; }
/* UEs : une par ligne (colonne unique) */
.filtre-checks-col { flex-direction: column; flex-wrap: nowrap; gap: 3px; max-width: none; }
/* Publics : colonnes par type, débordement automatique en colonnes supplémentaires */
.filtre-publics-cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 18px; margin-top: 4px; }
.filtre-public-col { display: flex; flex-direction: column; gap: 3px; }
.filtre-public-coltitle { display: flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; margin-bottom: 2px; }
.col-suite { font-weight: 400; font-style: italic; text-transform: none; font-size: .7rem; }

/* ── Calendrier — grille temporelle ──────────────────────────────────────── */
.cal-timetable {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Règle horaire : wrapper colonne (aligne le ruler avec le jour-body) */
.time-ruler-wrap {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.time-ruler-hdr {
  height: 44px; /* correspond à .jour-header — ajusté par JS au chargement */
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.time-ruler {
  position: relative;
  /* width/border/background gérés par .time-ruler-wrap */
}
.time-mark {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-size: .7rem;
  color: var(--text-light);
  white-space: nowrap;
}
.time-gridline {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed var(--border);
  pointer-events: none;
}

/* Grille des jours */
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  flex: 1;
  min-width: 0;
}
.jour-col-time {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.jour-col-time:last-child { border-right: none; }

.jour-header {
  text-align: center;
  padding: 7px 4px;
  background: var(--color-primary);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  flex-shrink: 0;
  min-height: 44px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.jour-date { display: block; font-size: .72rem; font-weight: 400; opacity: .85; }

.jour-body { flex: 1; position: relative; }
.jour-gridline {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed var(--border);
  pointer-events: none;
  opacity: .6;
}

/* Séance positionnée */
.seance-positioned {
  position: absolute;
  box-sizing: border-box;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 3px 5px;
  font-size: .75rem;
  overflow: hidden;
  cursor: pointer;
  transition: filter .1s, box-shadow .1s;
  line-height: 1.25;
}
.seance-positioned:hover { filter: brightness(.93); box-shadow: 0 2px 6px rgba(0,0,0,.18); z-index: 10; }
.seance-positioned:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
/* Séances non-éditables (gestionnaire sans accès à cette UE) : pas de survol interactif */
.seance-positioned:not([data-session]):not([data-ajoute-cid]) { cursor: default; }
.seance-positioned:not([data-session]):not([data-ajoute-cid]):hover { filter: none; box-shadow: none; }

.seance-positioned.type-cm  { background: #eff6ff; border-color: #93c5fd; }
.seance-positioned.type-td  { background: #f0fdf4; border-color: #86efac; }
.seance-positioned.type-tp,
.seance-positioned.type-tme { background: #fdf2f8; border-color: #f9a8d4; }
.seance-positioned.type-examen { background: #fefce8; border-color: #fde047; }
.seance-positioned.type-consultation-de-copies { background: #fefce8; border-color: #fde047; }
.seance-positioned.seance-modifiee { border-style: dashed; opacity: .9; }

.sp-heure   { font-weight: 700; font-size: .7rem; color: var(--text-light); }
.sp-ue      { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 1px; }
.sp-code    { font-weight: 700; font-size: .78rem; color: var(--text); }
.sp-groupes { color: var(--text-light); font-size: .7rem; margin-top: 1px; }
.sp-badge-reporte {
  position: absolute; bottom: 2px; right: 3px;
  font-size: .65rem; background: #fef3c7; color: #92400e;
  padding: 0 3px; border-radius: 2px;
}.no-seance { color: var(--text-light); font-size: .85rem; }

/* ── Modale détail séance ─────────────────────────────────────────────────── */
dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { font-size: 1.1rem; margin-bottom: 10px; }

.cal-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.cal-dialog-header h2 { margin: 0; }
.cal-dialog-header .btn-close-dialog {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--text-light); padding: 0 2px;
  line-height: 1;
}
.cal-detail-info { margin-bottom: 16px; font-size: .9rem; line-height: 1.6; }
.cal-detail-info p { margin: 2px 0; }
.cal-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Demandes dans le popup de détail */
.cal-demandes { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.cal-demandes-titre { font-weight: 600; font-size: .82rem; color: var(--text-light); margin-bottom: 4px; }
.cal-demande-item { font-size: .82rem; padding: 3px 0; border-bottom: 1px solid #f3f4f6; }
.cal-demande-item:last-child { border-bottom: none; }

/* Zone de conflits dans la modale reporter */
.conflict-zone {
  background: #fef3c7;
  border: 1px solid #d97706;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: .88rem;
}
.conflict-zone ul { margin: 6px 0 0 16px; padding: 0; }
.conflict-zone li { margin: 2px 0; }
.conflict-force { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; color: var(--color-danger); }

/* ── Gestionnaires UE ─────────────────────────────────────────────────────── */
.section-gestionnaires { margin-bottom: 28px; }
.gest-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.gest-item { display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; font-size: .88rem; }
.gest-email { color: var(--text-light); font-size: .8rem; }
.form-inline-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.select-sm { padding: 4px 8px; font-size: .88rem; border: 1px solid var(--border); border-radius: var(--radius); }
.btn-xs { padding: 2px 7px; font-size: .75rem; }
[hidden] { display: none !important; }

/* ── Enseignant ICS ───────────────────────────────────────────────────────── */
.ue-checklist { display: grid; gap: 8px; max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.checkbox-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.checkbox-item:hover { background: var(--bg); }
.checkbox-item input { width: auto; margin: 0; }
.ics-link-box { background: #f3f4f6; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.ics-link-box code { flex: 1; font-size: .82rem; word-break: break-all; }
.ics-url { font-size: .78rem; word-break: break-all; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.page-login { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 36px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow);
}
.login-logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 0 auto 28px;
}
.login-box button[type=submit] {
  width: 100%; padding: 10px; background: var(--color-primary); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1rem; cursor: pointer;
  margin-top: 8px;
}
.login-box button[type=submit]:hover { background: var(--color-primary-d); }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 60px 20px; }
.error-page h1 { font-size: 2rem; color: var(--text-light); margin-bottom: 12px; }
.empty-state { color: var(--text-light); font-size: .9rem; padding: 20px 0; text-align: center; }
.text-muted { color: var(--text-light); }
.user-inactive td { opacity: .55; }
.section-ues, .section-sessions, .section-demandes, .section-ajoutes, .section-ajouter { margin-bottom: 28px; }
.section-ues h2, .section-sessions h2, .section-demandes h2 { font-size: 1.1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section-title { font-size: 1.05rem; font-weight: 600; margin: 20px 0 10px; color: var(--text); }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.ue-header-row { display: flex; gap: 28px; margin-bottom: 24px; flex-wrap: wrap; align-items: flex-start; }
.ue-header-col { flex: 1; min-width: 250px; }
.ue-action-buttons { display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
.code-block { background: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: var(--radius); font-size: .8rem; overflow-x: auto; margin-top: 10px; white-space: pre; }

/* ── Semainier ────────────────────────────────────────────────────────────── */

/* Page header avec badge état */
.smr-page-header { position: relative; }
.smr-etat-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.smr-etat-vacances   { background: #dbeafe; color: #1d4ed8; }
.smr-etat-rattrapages { background: #fef3c7; color: #92400e; }

/* Bande de semaines */
/* Rangée bande + nav (deux colonnes) */
.smr-band-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  /* Sous la navbar sticky ET la barre de filtres sticky (≈ une ligne) pour que
     l'ancre #smr-top affiche la navigation des semaines sans la masquer. */
  scroll-margin-top: calc(var(--nav-h, 56px) + 72px);
}
.smr-bande-wrapper {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 10px 0 6px;
  margin: 0 -4px 0;
  scrollbar-width: thin;
}
.smr-week-nav-col {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 4px 8px;
  min-width: 200px;
  text-align: center;
  white-space: nowrap;
}
.smr-week-nav-col .week-label { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.smr-week-nav-col .week-dates { display: block; font-weight: 400; font-size: .78rem; color: var(--text-light); }
.smr-bande {
  display: flex;
  gap: 4px;
  padding: 2px 4px;
  min-width: max-content;
}

.smr-sem-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.smr-sem-pill:hover { background: #e0f2fe; border-color: var(--color-info); text-decoration: none; }

.smr-sem-active {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
  transform: scale(1.08);
  box-shadow: var(--shadow);
}
.smr-sem-active .smr-pill-nb,
.smr-sem-active .smr-pill-etat { color: rgba(255,255,255,.8); }

/* États spéciaux */
.smr-sem-vacances    { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.smr-sem-rattrapages { background: #fef3c7; border-color: #fbbf24; color: #92400e; }
.smr-sem-arret       { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.smr-sem-examens     { background: #ede9fe; border-color: #c4b5fd; color: #6d28d9; }
.smr-sem-ferie       { background: #fefce8; border-style: dashed; border-color: #f59e0b; color: #92400e; }

.smr-pill-num  { font-size: .95rem; font-weight: 700; line-height: 1; }
.smr-pill-nb   { font-size: .65rem; color: var(--text-light); line-height: 1; margin-top: 2px; }
.smr-pill-etat { font-size: .6rem;  line-height: 1; margin-top: 2px; text-transform: uppercase; font-weight: 700; }

/* Filtre inline (legacy, kept for compat) */
.smr-filtre-inline {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Alerte état semaine */
.smr-alert-etat { margin-bottom: 10px; }

/* Jours hors de la période dans la grille */
.jour-hors-periode { background: #f3f4f6; }
.jour-hors-periode .jour-header { color: #9ca3af; }
.jour-hors-periode-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg, #e5e7eb 0, #e5e7eb 8px, #f3f4f6 8px, #f3f4f6 16px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .8;
  z-index: 1;
}
.jour-hors-periode-overlay span { font-size: .8rem; color: #6b7280; font-weight: 600; padding: 4px 8px; background: #e5e7eb; border-radius: 4px; }

/* Jours fériés dans la grille */
.jour-ferie { background: #fefce8; }
.jour-ferie .jour-header { color: var(--color-warning); }
.ferie-badge { margin-left: 4px; cursor: default; }
.jour-ferie-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg, #fef9c3 0, #fef9c3 8px, #fefce8 8px, #fefce8 16px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .85;
  z-index: 1;
}
.jour-ferie-overlay span { font-size: .8rem; color: #92400e; font-weight: 600; padding: 4px 8px; background: #fef9c3; border-radius: 4px; }

/* Overlay état semaine : vacances, arrêt cours (hachuré comme jour-ferie) */
.jour-etat-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.jour-etat-overlay span { font-size: .8rem; font-weight: 600; padding: 4px 8px; border-radius: 4px; }
.jour-overlay-vacances {
  background: repeating-linear-gradient(
    -45deg, #bfdbfe 0, #bfdbfe 8px, #dbeafe 8px, #dbeafe 16px
  );
  opacity: .8;
}
.jour-overlay-vacances span { color: #1d4ed8; background: #dbeafe; }
.jour-overlay-cours {
  background: repeating-linear-gradient(
    -45deg, #e5e7eb 0, #e5e7eb 8px, #f3f4f6 8px, #f3f4f6 16px
  );
  opacity: .75;
}
.jour-overlay-cours span { color: #374151; background: #f3f4f6; }
.jour-overlay-arret {
  background: repeating-linear-gradient(
    -45deg, #fecaca 0, #fecaca 8px, #fee2e2 8px, #fee2e2 16px
  );
  opacity: .8;
}
.jour-overlay-arret span { color: #b91c1c; background: #fee2e2; }
.jour-overlay-examens {
  background: repeating-linear-gradient(
    -45deg, #ddd6fe 0, #ddd6fe 8px, #ede9fe 8px, #ede9fe 16px
  );
  opacity: .8;
}
.jour-overlay-examens span { color: #6d28d9; background: #ede9fe; }

/* Séances au-dessus des overlays */
.seance-positioned { z-index: 2; }

/* Restrictions de jour */
.jour-restriction { font-size: .65rem; color: var(--color-warning); font-weight: 600; margin-left: 4px; }
.jour-etat-badge  { font-size: .65rem; background: #fef3c7; color: #92400e; border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.jour-sans-cours .jour-body { background: repeating-linear-gradient(-45deg,#f9fafb 0,#f9fafb 6px,#f3f4f6 6px,#f3f4f6 12px); }

/* Badges règle séance */
.regle-badge { font-size: .65rem; margin-left: 3px; opacity: .75; }
.regle-deplace { color: #7c3aed; }
.regle-extra   { color: #059669; }
.seance-deplace { border-left: 3px solid #7c3aed !important; }
.seance-extra   { border-left: 3px solid #059669 !important; }

/* Badge inline */
.badge-deplace { background: #ede9fe; color: #7c3aed; padding: 1px 6px; border-radius: 10px; font-size: .72rem; font-weight: 600; }
.badge-extra   { background: #d1fae5; color: #059669; padding: 1px 6px; border-radius: 10px; font-size: .72rem; font-weight: 600; }
.badge-source-planneo { background: #e0e7ff; color: #3730a3; padding: 1px 6px; border-radius: 10px; font-size: .72rem; font-weight: 600; }
.badge-source-manuel  { background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 10px; font-size: .72rem; font-weight: 600; }

/* ── Pages publiques — Header ─────────────────────────────────────────────── */
.main-content--wide { max-width: min(100% - 32px, 1800px); }

.site-header {
  background: linear-gradient(90deg, #0b2a6f 0%, #1f7a8c 100%);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; box-shadow: 0 1px 3px rgba(0,0,0,.1);
  position: sticky; top: 0; z-index: 100;
}
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a, .site-nav button {
  display: inline-flex; align-items: center; padding: 6px 14px;
  border-radius: var(--radius); font-size: .9rem; font-weight: 500;
  color: rgba(255,255,255,.85); border: 1.5px solid transparent;
  text-decoration: none; transition: background .15s, color .15s;
  background: none; cursor: pointer;
}
.site-nav a:hover, .site-nav button:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.site-nav .nav-active  { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); font-weight: 600; }
.site-nav .nav-login   { background: #fff; color: var(--color-primary); border-color: #fff; font-weight: 600; }
.site-nav .nav-login:hover { background: rgba(255,255,255,.9); color: var(--color-primary); }

/* ── Session type badges (subscribe) ──────────────────────────────────────── */
.sess-type           { font-weight: 700; font-size: .78rem; padding: 1px 5px; border-radius: 3px; }
.sess-type.cm        { background: #dbeafe; color: #1e40af; }
.sess-type.td        { background: #dcfce7; color: #15803d; }
.sess-type.tp, .sess-type.tme { background: #fce7f3; color: #9d174d; }

/* ── Onglets ──────────────────────────────────────────────────────────────── */
.sub-tabs    { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin: 1.5rem 0 0; }
.sub-tab-btn {
  flex: 1; padding: 10px 20px; background: none; border: none;
  border-bottom: 2px solid transparent; font-size: 1rem; font-weight: 600;
  color: var(--text-light); cursor: pointer;
  transition: color .15s, border-color .15s; margin-bottom: -2px;
}
.sub-tab-btn:hover  { color: var(--text); }
.sub-tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.sub-tab-panel        { display: none; padding: 1.5rem 0; }
.sub-tab-panel.active { display: block; }

/* ── Page S'abonner ───────────────────────────────────────────────────────── */
.publics-type-title {
  margin: 18px 0 6px; font-size: .85rem; text-transform: uppercase;
  color: var(--text-light); font-weight: 700; letter-spacing: .05em;
}
.public-cards {
  display: grid; gap: 10px; margin-bottom: 8px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.public-card  {
  display: flex; align-items: center; gap: 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 8px; flex-wrap: wrap;
}
.public-cards .public-card { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 0; }
.public-cards .public-card .ics-url-text { flex: none; width: 100%; }
.public-cards .public-card .ics-btn-row { width: 100%; }
.public-code  { font-weight: 700; font-size: 1rem; min-width: 80px; }
.public-type  {
  font-size: .78rem; padding: 2px 7px; border-radius: 99px;
  background: var(--bg); color: var(--text-light); font-weight: 600;
}
.ics-url-text { flex: 1; font-size: .78rem; color: var(--text-light); word-break: break-all; min-width: 120px; }
.ics-btn-row  { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.ue-picker { margin: 8px 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ue-picker > summary {
  padding: 10px 14px; background: var(--bg-card); cursor: pointer; user-select: none;
  font-weight: 600; display: flex; align-items: center; gap: 10px; list-style: none;
}
.ue-picker > summary::-webkit-details-marker { display: none; }
.ue-picker > summary::before { content: '▶'; font-size: .75rem; color: var(--text-light); transition: transform .15s; }
.ue-picker[open] > summary::before { transform: rotate(90deg); }
.ue-picker > summary:hover { background: var(--bg); }
.ue-nom       { font-weight: 400; color: var(--text-light); }
.ue-sel-count { margin-left: auto; font-size: .8rem; color: var(--color-primary); font-weight: 600; }
.ue-picker-body { padding: 10px 14px 14px; }

.sess-row   { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.sess-check {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); font-size: .85rem; cursor: pointer; transition: background .1s;
}
.sess-check:hover  { background: var(--bg-card); }
.sess-check input  { cursor: pointer; }
.sess-horaire      { color: var(--text-light); font-size: .8rem; }

.link-box      {
  display: flex; align-items: center; gap: 8px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; word-break: break-all;
}
.link-box code { flex: 1; font-size: .85rem; }
.no-periode    { text-align: center; padding: 3rem; color: var(--text-light); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 16px; color: var(--text-light); font-size: .8rem; border-top: 1px solid var(--border); margin-top: auto; }

.smr-sem-nav-inner { display: flex; align-items: center; gap: 5px; }

/* ── Toggle vue Semaine / Jour ───────────────────────────────────────────── */
.cal-view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.cal-view-btn {
  padding: 5px 14px;
  font-size: .82rem;
  font-weight: 600;
  background: var(--bg-card);
  border: none;
  cursor: pointer;
  color: var(--text-light);
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.cal-view-btn + .cal-view-btn { border-left: 1px solid var(--border); }
.cal-view-btn.active { background: var(--color-primary); color: #fff; }
.cal-view-btn:hover:not(.active) { background: var(--bg); }

/* Navigation vue jour */
.cal-jour-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-jour-nav-label {
  font-weight: 600;
  font-size: .92rem;
  min-width: 150px;
  text-align: center;
}

/* Vue jour : une seule colonne occupe toute la grille */
.cal-view-jour .cal-days-grid { grid-template-columns: 1fr; }
.cal-view-jour .jour-col-time { display: none; }
.cal-view-jour .jour-col-time.jour-actif { display: flex; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Navbar : brand + hamburger sur une ligne, panel en dessous */
  .navbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 0; }
  .navbar > .nav-brand { flex: 1; display: flex; align-items: center; }
  .badge-env-dev { display: none; }

  .nav-hamburger {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
    color: #fff; width: 36px; height: 36px; border-radius: var(--radius);
    cursor: pointer; font-size: 1.2rem; flex-shrink: 0; line-height: 1;
  }
  .nav-hamburger:hover { background: rgba(255,255,255,.25); }

  /* Panel masqué par défaut */
  .nav-collapse {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,.15);
    padding: 6px 0 10px;
  }
  .nav-collapse.open { display: flex; }

  /* Liens nav : verticaux */
  .nav-links {
    flex-direction: column; gap: 0; flex: none; width: 100%;
  }
  .nav-links a, .nav-links span {
    display: block; padding: 11px 6px; font-size: .93rem;
    border-radius: 0; border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .nav-links a.active { border-radius: 0; }

  /* Dropdown Administration : accordéon au clic sur mobile */
  li.nav-dropdown > span { cursor: pointer; }
  .nav-dropdown .dropdown-menu {
    position: static; display: none; background: rgba(0,0,0,.12);
    border: none; box-shadow: none; min-width: 0; border-radius: 0; padding: 0;
  }
  .nav-dropdown.mob-open .dropdown-menu { display: block; }
  .nav-dropdown .dropdown-menu li a {
    color: rgba(255,255,255,.75); padding: 9px 8px 9px 22px;
    font-size: .87rem; border-bottom: 1px solid rgba(255,255,255,.05);
  }
  .nav-dropdown .dropdown-menu li a:hover {
    background: rgba(255,255,255,.1); color: #fff; text-decoration: none;
  }

  /* Tableaux : défilement horizontal si dépassement */
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Btn-nav (Calendrier public / S'abonner) */
  .btn-nav {
    display: block; padding: 11px 6px; font-size: .93rem;
    background: none; border: none; border-bottom: 1px solid rgba(255,255,255,.08);
    border-radius: 0; color: rgba(255,255,255,.85); text-align: left; width: 100%;
  }
  .btn-nav::after { content: ' ↗'; font-size: .8em; opacity: .7; }
  .btn-nav:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }

  /* Utilisateur + déconnexion */
  .nav-user {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 6px 4px; flex-wrap: wrap;
    border-top: 1px solid rgba(255,255,255,.12); margin-top: 4px;
  }

  /* Layout */
  .form-row { grid-template-columns: 1fr; }
  .cal-days-grid { grid-template-columns: repeat(3, 1fr); }
  .ue-grid { grid-template-columns: 1fr 1fr; }
  .cal-filtres { position: static; }
}
@media (max-width: 480px) {
  .cal-days-grid { grid-template-columns: repeat(2, 1fr); }
  .ue-grid { grid-template-columns: 1fr; }
}

/* ── Responsive mobile (pages publiques) ─────────────────────────────────── */
@media (max-width: 640px) {
  /* Header public */
  .site-header { padding: 0 10px; }
  .nav-brand-name { font-size: .95rem; }
  .site-nav a { padding: 5px 8px; font-size: .82rem; }

  /* Page header */
  .page-header { gap: 6px; margin-bottom: 10px; }
  .page-header h1 { font-size: 1.15rem; }
  .semestre-info { margin-left: 0; font-size: .8rem; width: 100%; }

  /* Bande semaines + nav : empilement vertical */
  .smr-band-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .smr-bande-wrapper { padding: 4px 0; }
  .smr-week-nav-col {
    min-width: 0;
    justify-content: center;
    padding: 0 4px 4px;
  }
  .smr-sem-nav-inner { justify-content: center; }
  .cal-jour-nav { justify-content: center; }

  /* Masquer les dates dans la nav semaine (gardé le numéro) */
  .week-dates { display: none; }

  /* Filtres */
  .cal-filtres { padding: 6px 10px; gap: 0 10px; top: calc(var(--nav-h) + 2px); }
  .filtre-actions { margin-left: 0; width: 100%; justify-content: flex-end; }

  /* Modale : bottom-sheet sur mobile */
  dialog {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 72vh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 16px 16px 24px;
  }

  /* Contenu principal : réduire les marges */
  .main-content { padding: 12px 10px; }
  .main-content--wide { max-width: 100%; }
}
