:root {
  --primary-color: #2563eb; /* Blue 600 — identique au design system GBE (UNFOLD primary.600) */
  --primary-hover: #1d4ed8; /* Blue 700 — identique au design system GBE (primary.700) */
  --bg-color: #F8FAFC; /* Slate 50 */
  --surface-color: #FFFFFF; /* White */
  --text-color: #0F172A; /* Slate 900 */
  --text-muted: #64748B; /* Slate 500 */
  --danger-color: #EF4444;
  --success-color: #10B981;
  --font-family: 'Inter', system-ui, sans-serif;
  --border-color: #E2E8F0; /* Slate 200 */
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --radius: 0.75rem;
  --radius-sm: 0.375rem;
  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
}

p,
li,
h1,
h2,
h3 {
  overflow-wrap: break-word;
  word-break: break-word;
}

input,
select,
textarea {
  max-width: 100%;
}

/* Icônes Material Symbols (mêmes que l'administration unfold) */
.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* ============================================================
   App Shell
   ============================================================ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — miroir du sidebar de l'administration (unfold) */
.sidebar {
  width: var(--sidebar-width);
  background-color: #f9fafb; /* base-50 */
  border-right: 1px solid #e5e7eb; /* base-200 */
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* En-tête de marque (logo seul, comme unfold) */
.sidebar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 65px;
  padding: 0 12px;
  border-bottom: 1px solid #e5e7eb; /* base-200 */
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar-logo {
  height: 40px;
  width: auto;
  max-width: 160px;
  flex-shrink: 0;
  object-fit: contain;
  object-position: left center;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
}

/* Groupe de navigation (titre + séparateur) */
.sidebar-group {
  margin-bottom: 1.5rem;
}

.sidebar-nav .sidebar-group:first-child hr {
  display: none;
}

.sidebar-group hr {
  border: 0;
  border-top: 1px solid #e5e7eb; /* base-200 */
  margin: 8px 24px;
}

.sidebar-group-title {
  margin: 0 12px 4px;
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827; /* base-900 */
}

.sidebar-items {
  list-style: none;
  margin: 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  height: 38px;
  margin: 0 -12px;
  padding: 0 12px;
  border-radius: 0.5rem; /* rounded-default */
  color: #374151; /* base-700 */
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link .material-symbols-outlined {
  margin-right: 12px;
  width: 18px;
  font-size: 18px;
}

.sidebar-link:hover {
  color: var(--primary-color);
  background-color: transparent;
}

.sidebar-link.active {
  background-color: #f3f4f6; /* base-100 */
  color: var(--primary-color);
  font-weight: 600;
}

/* Bloc utilisateur + déconnexion (miroir de navigation_user) */
.sidebar-user {
  flex-shrink: 0;
  border-top: 1px solid #e5e7eb; /* base-200 */
  padding: 12px 24px;
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -12px -24px;
  padding: 12px 24px;
  min-height: 64px;
}

.sidebar-avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 0.5rem;
  background-color: #e5e7eb; /* base-200 */
  color: #111827; /* base-900 */
  font-weight: 600;
  font-size: 0.875rem;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  color: #111827; /* base-900 */
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: #6b7280; /* base-500 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  padding: 6px 12px;
  border-radius: 0.5rem;
  color: #b91c1c; /* red-700 */
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.sidebar-logout:hover {
  background-color: #fee2e2; /* red-100 */
}

.sidebar-logout .material-symbols-outlined {
  margin-left: auto;
  font-size: 20px;
  color: #b91c1c;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-toggle {
  display: none;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  min-height: 64px;
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  gap: 1rem;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-color);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-wrapper {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* Card */
.card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.card-header {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Forms and Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  background-image: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 60%, #4f46e5 100%);
  background-repeat: no-repeat;
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background-image: linear-gradient(135deg, #2563eb 0%, #4338ca 100%);
  background-color: var(--primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.28);
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  background-color: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Form contents rendered via {{ form.as_p }} */
form p {
  margin-bottom: 1rem;
}

form p label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.card form input[type="text"],
.card form input[type="email"],
.card form input[type="number"],
.card form input[type="url"],
.card form input[type="date"],
.card form input[type="tel"],
.card form input[type="search"],
.card form input[type="password"],
.card form select,
.card form textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card form input[type="text"]:focus,
.card form input[type="email"]:focus,
.card form input[type="number"]:focus,
.card form input[type="url"]:focus,
.card form input[type="date"]:focus,
.card form input[type="tel"]:focus,
.card form input[type="search"]:focus,
.card form input[type="password"]:focus,
.card form select:focus,
.card form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.card form ul.errorlist {
  list-style: none;
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.card form .errorlist li {
  color: var(--danger-color);
  font-size: 0.875rem;
}

/* Authentication Page */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-color) 0%, #E2E8F0 100%);
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-color);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-brand .auth-logo {
  height: 90px;
  width: auto;
  max-width: 100%;
  margin-bottom: 0.75rem;
  object-fit: contain;
}

/* Nom de la marque sous le logo (pages de connexion de l'application et des
   portails). */
.auth-brand .auth-brand-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-color);
}

/* Accès discret à l'espace client, sous le formulaire de connexion. */
.auth-client-link {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8125rem;
}

.auth-client-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-client-link a:hover,
.auth-client-link a:focus-visible {
  color: var(--primary-color);
}

.auth-brand .auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ============================================================
   Layout Utilities (used by custom templates)
   ============================================================ */

/* Row of actions/toolbars: search form + action button */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.toolbar-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.toolbar-search .form-control {
  flex: 1 1 140px;
  min-width: 0;
}

/* Group of buttons that may wrap and stack on small screens */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Scrollable, contained table wrapper (never overflows the page) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   Documents du projet (consultation en lecture seule)
   ============================================================ */
.doc-group-title {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.doc-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  margin-bottom: 0.75rem;
  background: var(--surface-color);
  min-width: 0;
}

.doc-info {
  flex: 1 1 0;
  min-width: 0;
}

.doc-titre {
  font-weight: 600;
  overflow-wrap: break-word;
  word-break: break-word;
}

.doc-phase {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
}

.doc-meta {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow-wrap: break-word;
  word-break: break-word;
}

.doc-desc {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.doc-open {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Numéro de version affiché dans l'en-tête compact du document. */
.doc-version {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
  white-space: nowrap;
}

/* ============================================================
   Projet Hub (fiche projet / expérience QR)
   ============================================================ */
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.hub-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.hub-header-info {
  flex: 1;
  min-width: 0;
}

.hub-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-color);
  overflow-wrap: anywhere;
}

.hub-subtitle {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.5rem;
  align-items: center;
}

.hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon {
  font-size: 18px;
  vertical-align: -4px;
  margin-right: 0.375rem;
}

.btn-secondary {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

/* Pastilles de statut (semantiques : info/succès/alerte/danger/neutre) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28em 0.65em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-info { color: #1e40af; background: rgba(37, 99, 235, 0.10); }
.badge-success { color: #047857; background: rgba(16, 185, 129, 0.12); }
.badge-warning { color: #b45309; background: rgba(245, 158, 11, 0.15); }
.badge-danger { color: #b91c1c; background: rgba(239, 68, 68, 0.12); }
.badge-neutral { color: #4b5563; background: #f1f5f9; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.chip-primary {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
}

.chip-danger {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.10);
}

.ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
}

.ov-item {
  min-width: 0;
}

.ov-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.125rem;
}

.ov-value {
  color: var(--text-color);
  overflow-wrap: anywhere;
}

.ov-description {
  grid-column: 1 / -1;
}

.hub-empty {
  color: var(--text-muted);
}

.hub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hub-list-item {
  border: 1px solid var(--border-color);
  border-radius: 0.625rem;
  padding: 1rem;
  background: var(--surface-color);
  margin-bottom: 0.75rem;
  min-width: 0;
}

.hub-list-item:last-child {
  margin-bottom: 0;
}

.hub-list-item.highlight {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
}

.item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;
}

.item-title {
  font-weight: 600;
  color: var(--text-color);
  overflow-wrap: anywhere;
}

.item-title.overdue {
  color: var(--danger-color);
}

.item-meta {
  margin-top: 0.375rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.75rem;
  align-items: baseline;
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-width: 0;
}

.meta-label {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.meta-text {
  overflow-wrap: anywhere;
  color: var(--text-muted);
}

.visit-files {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.visit-file-btn {
  align-self: flex-start;
}

.visit-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.photo-thumb {
  width: 96px;
  height: 96px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  display: block;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visit-docs {
  margin-top: 0;
}

/* ============================================================
   Inlines repliables
   ------------------------------------------------------------
   Même habillage que les autres cartes : l'en-tête est une barre
   compacte (titre + pastilles) et la flèche, à droite, déploie le
   contenu existant. Les blocs sont indépendants : cliquer sur une
   flèche n'affecte que son propre bloc.
   ============================================================ */
.collapsible-item {
  display: block;
  padding: 0;
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  min-width: 0;
}

.collapsible-header:hover {
  background: rgba(37, 99, 235, 0.03);
}

.collapsible-summary {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;
}

.collapsible-summary > * {
  min-width: 0;
}

/* L'écart est déjà assuré par le `gap` de la barre. */
.collapsible-summary .doc-phase {
  margin-left: 0;
}

.collapsible-tail {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* La flèche est le seul élément focusable du bloc : le clavier atteint donc
   directement le contrôle de dépliage. */
.collapsible-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  line-height: 0;
  color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.collapsible-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  background: #f1f5f9;
  transition: transform 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.collapsible-caret .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  width: 20px;
  height: 20px;
}

.collapsible-toggle:hover .collapsible-caret,
.collapsible-toggle:focus-visible .collapsible-caret,
.collapsible-item.is-open .collapsible-caret {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.10);
}

.collapsible-item.is-open .collapsible-caret {
  transform: rotate(180deg);
}

.collapsible-toggle:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 999px;
}

.collapsible-body {
  padding: 0.875rem 1rem 1rem;
  border-top: 1px solid var(--border-color);
}

/* `hidden` doit l'emporter sur le `display` des conteneurs ci-dessus. */
.collapsible-body[hidden] {
  display: none;
}

.collapsible-body > :first-child {
  margin-top: 0;
}

/* Le premier bloc d'un contenu déplié ne doit pas laisser de marge haute
   (les listes imbriquées utilisent `.doc-meta` comme premier enfant). */
.collapsible-body > * > :first-child {
  margin-top: 0;
}

/* Message discret affiché quand un bloc n'a aucun détail supplémentaire. */
.collapsible-note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .collapsible-caret {
    transition: none;
  }
}

/* ============================================================
   Tables (desktop)
   ============================================================ */
.table-list {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}

.table-list thead th {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-list tbody tr {
  border-bottom: 1px solid var(--border-color);
}

.table-list tbody td {
  padding: 1rem;
  vertical-align: middle;
  overflow-wrap: break-word;
  word-break: break-word;
}

.table-list tbody td .actions,
.actions {
  white-space: nowrap;
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */

@media (max-width: 1023px) {

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 85vw);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: none;
    visibility: hidden;
  }

  .app-container.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    box-shadow: 0 10px 40px -12px rgba(15, 23, 42, 0.35);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .app-container.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .sidebar-toggle:hover,
  .sidebar-toggle:focus-visible {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    outline: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 56px;
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .page-title {
    font-size: 1rem;
  }

  .content-wrapper {
    padding: 1rem;
    overflow-x: hidden;
  }

  body.sidebar-locked {
    overflow: hidden;
  }

  /* Actions d'administration masquées en mobile (expérience QR en lecture seule) */
  .desktop-only-admin {
    display: none !important;
  }
}

@media (max-width: 768px) {

  /* Tables stay readable without squeezing: contained scroll + stacked cards */
  .table-list thead th,
  .table-list tbody td {
    padding: 0.75rem;
  }

  .table-list thead th {
    white-space: normal;
  }

  /* Stacked "card" rows with data-label values */
  .table-responsive .table-list {
    min-width: 0;
  }

  .table-responsive .table-list thead {
    display: none;
  }

  .table-responsive .table-list,
  .table-responsive .table-list tbody {
    display: block;
    width: 100%;
  }

  .table-responsive .table-list tbody tr {
    display: block;
    padding: 0.625rem 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.625rem;
    background: var(--surface-color);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .table-responsive .table-list tbody tr:last-child {
    margin-bottom: 0;
  }

  .table-responsive .table-list tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.125rem 0.75rem;
    padding: 0.4375rem 0;
    border-bottom: 1px dashed rgba(226, 232, 240, 0.8);
  }

  .table-responsive .table-list tbody td:last-child {
    border-bottom: none;
  }

  .table-responsive .table-list tbody td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .table-responsive .table-list tbody td .actions,
  .table-responsive .actions {
    white-space: normal;
  }

  .table-responsive .table-list tbody td[colspan] {
    display: block;
    text-align: center;
    padding: 1rem 0;
    border-bottom: none;
  }

  .table-responsive .table-list tbody td[colspan]::before {
    display: none;
  }

  .card {
    padding: 1.25rem;
  }

  /* Documents : empilés, bouton d'ouverture pleine largeur (cible tactile) */
  .doc-item {
    flex-direction: column;
    align-items: stretch;
  }

  .doc-open {
    width: 100%;
  }

  /* Projet Hub : axe vertical, aucune coupure des actions */
  .hub-header {
    flex-direction: column;
    align-items: stretch;
  }

  .hub-actions {
    width: 100%;
  }

  .hub-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .visit-file-btn {
    align-self: stretch;
    text-align: center;
  }

  .photo-thumb {
    width: 88px;
    height: 88px;
  }
}

@media (max-width: 480px) {

  .hub-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {

  .page-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-search {
    width: 100%;
  }

  .page-toolbar > .btn {
    width: 100%;
    text-align: center;
  }

  .card {
    padding: 1rem;
    border-radius: 0.625rem;
  }

  .card-header {
    font-size: 1rem;
  }

  .auth-card {
    padding: 1.75rem;
  }

  .auth-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {

  .btn-row .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .topbar {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 360px) {

  .content-wrapper {
    padding: 0.75rem;
  }

  .card {
    padding: 0.875rem;
  }
}
/* ===== Cloche de notifications (interface frontale) ===== */
.gbef{ position:relative; flex-shrink:0; }
.gbef-trigger{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border:none; border-radius:var(--radius-sm); cursor:pointer;
  background:transparent; color:var(--text-color); transition:all 0.2s ease;
}
.gbef-trigger:hover{ background:var(--primary-color); color:#fff; }
.gbef-trigger .material-symbols-outlined{ font-size:1.4rem; }
.gbef-badge{
  position:absolute; top:1px; right:0; min-width:18px; height:18px; padding:0 4px;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--primary-color); color:#fff;
  border:2px solid var(--surface-color); border-radius:9999px;
  font-size:0.62rem; font-weight:800; line-height:1;
}
.gbef-dropdown{
  position:absolute; right:0; top:calc(100% + 8px); z-index:60;
  width:min(360px, calc(100vw - 24px));
  background:#fff; border:1px solid var(--border-color);
  border-radius:var(--radius); box-shadow:0 10px 30px rgba(16,24,40,0.14);
  overflow:hidden; text-align:left;
}
.gbef-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:10px 14px; border-bottom:1px solid var(--border-color);
  font-weight:600; font-size:0.875rem; color:var(--text-color);
}
.gbef-all{border:none; background:transparent; cursor:pointer; padding:0; font-size:0.72rem; font-weight:600; color:var(--primary-color);}
.gbef-all:hover{ text-decoration:underline; }
.gbef-body{ max-height:min(60vh, 460px); overflow-y:auto; display:flex; flex-direction:column; }
.gbef-item{
  display:flex; align-items:flex-start; gap:10px; padding:10px 14px;
  text-decoration:none; color:inherit; border-bottom:1px solid var(--border-color);
  transition:background 0.15s ease;
}
.gbef-item:hover{ background:var(--bg); }
.gbef-item.unread{ background:rgba(59,130,246,0.06); }
.gbef-item-dot{ width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; background:var(--border-color); }
.gbef-item.unread .gbef-item-dot{ background:var(--primary-color); }
.gbef-item-txt{ min-width:0; }
.gbef-item-title{ display:block; font-size:0.8rem; font-weight:600; color:var(--text-color); line-height:1.3; }
.gbef-item-meta{ display:block; font-size:0.68rem; color:var(--text-muted); margin-top:2px; }
.gbef-item-msg{ display:block; font-size:0.74rem; color:var(--text-color); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gbef-empty{ padding:24px 14px; text-align:center; font-size:0.8rem; color:var(--text-muted); }
.gbef-footer{
  display:block; text-align:center; padding:10px 14px;
  font-size:0.78rem; font-weight:600; text-decoration:none; color:var(--primary-color);
  border-top:1px solid var(--border-color);
}
.gbef-footer:hover{ background:var(--bg); }

/* ==========================================================================
   Portails externes (Espace Client / Portail intervenant)
   Reprend les variables et les classes de la fiche projet (card, hub-*, doc-*,
   ov-*, badge, chip) ; n'ajoute que la barre de navigation et les formulaires.
   ========================================================================== */
.portail{ background:var(--bg); min-height:100vh; }
.portail-topbar{
  position:sticky; top:0; z-index:20;
  background:#fff; border-bottom:1px solid var(--border-color);
}
.portail-topbar-inner{
  max-width:1100px; margin:0 auto; padding:10px 16px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.portail-marque{ display:inline-flex; align-items:center; gap:10px; font-weight:700; letter-spacing:.06em; color:var(--primary-color); }
.portail-logo{ height:34px; width:auto; max-width:120px; flex-shrink:0; object-fit:contain; object-position:left center; }
.portail-topbar-titre{ font-size:0.9rem; font-weight:600; color:var(--text-color); }
.portail-nav{ margin-left:auto; display:flex; align-items:center; gap:10px; }
.portail-nav-form{ display:inline-flex; margin:0; }
.btn-sm{ padding:6px 12px; font-size:0.78rem; }
.btn-block{ width:100%; justify-content:center; }
.portal-search{ display:flex; gap:8px; margin-bottom:14px; }
.portal-search input{
  flex:1; padding:9px 12px; border:1px solid var(--border-color);
  border-radius:8px; font:inherit; font-size:0.88rem;
}
.portal-form .form-field{ margin-bottom:14px; }
/* Formulaire de connexion des portails : les champs sont enchaînés sans
   conteneur `.portal-form`, on leur donne donc l'espacement explicitement. */
.auth-card .form-field{ margin-bottom:16px; }
.auth-card .form-field:last-of-type{ margin-bottom:22px; }
.auth-card .btn-block{ margin-top:4px; }
.portal-form input[type=text], .portal-form input[type=number],
.portal-form select, .portal-form textarea, .form-field input, .form-field select, .form-field textarea{
  width:100%; padding:9px 12px; border:1px solid var(--border-color);
  border-radius:8px; font:inherit; font-size:0.88rem; background:#fff;
}
.form-field label{ display:block; font-size:0.78rem; font-weight:600; margin-bottom:5px; color:var(--text-color); }
.field-help{ font-size:0.72rem; color:var(--text-muted); margin:5px 0 0; }
.field-error{ font-size:0.74rem; color:#b91c1c; margin:5px 0 0; }
.alert{ padding:11px 14px; border-radius:8px; font-size:0.82rem; margin-bottom:14px; }
.alert-danger{ background:rgba(239,68,68,0.10); color:#b91c1c; }
.alert-success{ background:rgba(16,185,129,0.12); color:#047857; }
.alert-info{ background:rgba(37,99,235,0.10); color:#1e40af; }
.alert-warning{ background:rgba(245,158,11,0.15); color:#b45309; }
@media (max-width:640px){
  .portail-topbar-inner{ padding:8px 12px; }
  .item-title a{ word-break:break-word; }
}


/* =========================================================
   Pièces jointes de tâche (inline dans la liste des tâches)
   ========================================================= */
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}
.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.tache-pj-section {
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.tache-pj-header {
  margin-bottom: 8px;
}

.tache-pj-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tache-pj-icon {
  font-size: 1rem;
}

/* Liste des fichiers */
.tache-pj-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tache-pj-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-color, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.tache-pj-file-icon {
  font-size: 1.1rem;
  color: var(--primary-color);
  flex-shrink: 0;
}

.tache-pj-name {
  font-size: 0.88rem;
  font-weight: 500;
  flex: 1 1 auto;
  word-break: break-all;
}

.tache-pj-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-basis: 100%;
  margin-top: 2px;
}

.tache-pj-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-basis: 100%;
}

.tache-pj-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.tache-pj-delete-form {
  display: inline-flex;
  margin: 0;
}

/* Formulaire d'upload */
.tache-pj-upload-form {
  margin: 0;
}

.tache-pj-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tache-pj-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.tache-pj-file-input {
  font-size: 0.82rem;
  flex: 1 1 180px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 640px) {
  .tache-pj-upload-row { flex-direction: column; align-items: flex-start; }
  .tache-pj-actions { flex-wrap: wrap; }
}
