:root {
  --bg: #ffffff;
  --bg-elevated: #f8f9fa;
  --bg-soft: #f1f3f5;
  --accent: #86efac;
  --accent-hover: #4ade80;
  --accent-soft: rgba(134, 239, 172, 0.15);
  --accent-strong: rgba(134, 239, 172, 0.3);
  --accent-green: #86efac;
  --accent-green-dark: #4ade80;
  --accent-red: #f97373;
  --text: #1a1a1a;
  --text-soft: #6b7280;
  --border-subtle: #e5e7eb;
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius-lg: 18px;
  --radius-xl: 22px;
  --transition-fast: 0.18s ease-out;
  --sidebar-width: 260px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: #ffffff;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app-root {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  width: var(--sidebar-width);
  background: #f8f9fa;
  border-right: 1px solid var(--border-subtle);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 6px;
}

.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(134, 239, 172, 0.3);
  box-shadow:
    0 0 0 2px rgba(134, 239, 172, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.08);
}

.logo-text {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 15px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.nav-item .nav-icon {
  width: 24px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item .nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(134, 239, 172, 0.1);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-item.active {
  background: rgba(134, 239, 172, 0.15);
  color: #22c55e;
  box-shadow: 0 2px 8px rgba(134, 239, 172, 0.2);
  border: 1px solid rgba(134, 239, 172, 0.3);
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(134, 239, 172, 0.3);
  transition: all var(--transition-fast);
}

.user-pill:hover {
  background: rgba(134, 239, 172, 0.05);
  border-color: rgba(134, 239, 172, 0.5);
  transform: translateY(-1px);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 0 0, #4ade80, #22c55e);
  font-size: 13px;
  font-weight: 600;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
}

.user-role {
  font-size: 11px;
  color: var(--text-soft);
}

/* Main layout */

.main {
  flex: 1;
  padding: 22px 28px;
  max-width: calc(100% - var(--sidebar-width));
}

.main__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.main__header h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft);
}

.main__header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border-width: 1px;
  border-style: solid;
}

.badge--green {
  background: rgba(134, 239, 172, 0.2);
  border-color: rgba(134, 239, 172, 0.4);
  color: #22c55e;
}

.muted {
  color: var(--text-soft);
  font-size: 12px;
}

.section {
  display: none;
}

.section--active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 18px 18px 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.card-clickable {
  cursor: pointer;
  transition: 
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
  position: relative;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: rgba(134, 239, 172, 0.5);
}

.card-clickable:active {
  transform: translateY(0);
}

.card-dashboard {
  padding: 14px 14px 12px;
}

.card-dashboard h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.card h3 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 15px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-soft);
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-label {
  font-size: 13px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  border-width: 1px;
  border-style: solid;
}

.chip--ok {
  background: rgba(134, 239, 172, 0.2);
  border-color: rgba(134, 239, 172, 0.5);
  color: #22c55e;
}

.chip--alert {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #dc2626;
}

.progress {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
  margin-top: 10px;
}

.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, #86efac, #4ade80, #a7f3d0);
  border-radius: inherit;
  transition: width 0.2s ease-out;
}

/* Forms & inputs */

.form-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.7fr auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0 16px;
}

.input {
  appearance: none;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text);
  padding: 7px 11px;
  font-size: 13px;
  min-width: 0;
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.input::placeholder {
  color: rgba(107, 114, 128, 0.6);
}

.input:focus {
  border-color: rgba(134, 239, 172, 0.6);
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.1);
  background: #ffffff;
}

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.btn--primary {
  background: radial-gradient(circle at 0 0, #86efac, #4ade80 40%, #22c55e 100%);
  color: #000000;
  box-shadow: 0 4px 12px rgba(134, 239, 172, 0.3);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(134, 239, 172, 0.4);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(134, 239, 172, 0.3);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover {
  transform: none !important;
  box-shadow: 0 4px 12px rgba(134, 239, 172, 0.3) !important;
}

/* Filtres */
.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-soft);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-soft);
  border-color: rgba(134, 239, 172, 0.4);
  color: var(--text);
}

.filter-btn.active {
  background: rgba(134, 239, 172, 0.1);
  border-color: rgba(134, 239, 172, 0.5);
  color: #22c55e;
}

/* Tables */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 7px 8px;
  text-align: left;
}

.table thead th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-soft);
}

.table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.table tbody tr:nth-child(even) {
  background: var(--bg-soft);
}

.table tbody tr:hover {
  background: rgba(134, 239, 172, 0.08);
}

.cleaning-table {
  margin-top: 12px;
  margin-bottom: 12px;
}

.cleaning-table th {
  font-size: 11px;
  padding: 6px 8px;
}

.cleaning-table td {
  font-size: 12px;
  padding: 6px 8px;
}

.cleaning-btn {
  min-width: 100px;
  transition: all 0.2s ease;
}

.cleaning-btn--green {
  background: rgba(134, 239, 172, 0.2);
  color: #22c55e;
  border-color: rgba(134, 239, 172, 0.4);
}

.cleaning-btn--green:hover {
  background: rgba(134, 239, 172, 0.3);
  border-color: rgba(134, 239, 172, 0.6);
}

.cleaning-btn--orange {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.3);
}

.cleaning-btn--orange:hover {
  background: rgba(249, 115, 22, 0.25);
  border-color: rgba(249, 115, 22, 0.5);
}

.cleaning-btn--red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.cleaning-btn--red:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Boutons de température (similaires aux boutons de nettoyage) */
.temperature-btn {
  min-width: 100px;
  transition: all 0.2s ease;
}

.temperature-btn--green {
  background: rgba(134, 239, 172, 0.2);
  color: #22c55e;
  border-color: rgba(134, 239, 172, 0.4);
}

.temperature-btn--green:hover {
  background: rgba(134, 239, 172, 0.3);
  border-color: rgba(134, 239, 172, 0.6);
}

.temperature-btn--orange {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.3);
}

.temperature-btn--orange:hover {
  background: rgba(249, 115, 22, 0.25);
  border-color: rgba(249, 115, 22, 0.5);
}

.temperature-btn--red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.temperature-btn--red:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

.temperature-equipment-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.temperature-equipment-table th {
  text-align: left;
  padding: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border-subtle);
}

.temperature-equipment-table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.temperature-equipment-table tr:last-child td {
  border-bottom: none;
}

/* Checklist */

.checklist {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 13px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(134, 239, 172, 0.5);
  accent-color: var(--accent);
  cursor: pointer;
}

.checklist input[type="checkbox"]:checked + span {
  text-decoration: line-through;
  color: var(--text-soft);
}

.checklist input[type="checkbox"]:checked ~ span {
  opacity: 0.8;
}

.checklist label:hover {
  border-color: rgba(134, 239, 172, 0.5);
  background: rgba(134, 239, 172, 0.05);
  transform: translateY(-1px);
}

/* Responsiveness */

@media (max-width: 960px) {
  .app-root {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }

  .sidebar__logo {
    padding-bottom: 10px;
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-top: 0;
  }

  .sidebar__footer {
    margin-left: auto;
    margin-top: 0;
    border-top: none;
  }

  .main {
    max-width: 100%;
    padding: 18px 16px 22px;
  }

  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .main__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .main__header-right {
    align-items: flex-start;
  }
}

/* Page de connexion/authentification */
.auth-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.auth-container {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 40px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo img {
  margin-bottom: 12px;
}

.auth-logo h1 {
  margin: 0;
  font-size: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form h2 {
  margin: 0 0 8px;
  font-size: 20px;
  text-align: center;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.auth-form .input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text);
  box-sizing: border-box;
}

.auth-form .input:focus {
  border-color: rgba(134, 239, 172, 0.6);
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.1);
  background: #ffffff;
}

.auth-form .btn--primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-bottom: 16px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-soft);
  margin: 8px 0 0;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.btn--secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border-subtle);
}

.btn--secondary:hover {
  background: var(--bg-soft);
  border-color: rgba(134, 239, 172, 0.4);
}

.btn--small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn--logout {
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  font-size: 12px;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #dc2626;
  font-weight: 500;
}

.btn--logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.6);
  color: #b91c1c;
}

.cleaning-btn {
  background: rgba(134, 239, 172, 0.2);
  color: #22c55e;
  border-color: rgba(134, 239, 172, 0.4);
}

.cleaning-btn:hover {
  background: rgba(134, 239, 172, 0.3);
  border-color: rgba(134, 239, 172, 0.6);
}

.cleaning-btn.completed {
  background: var(--bg-soft);
  color: var(--text-soft);
  border-color: var(--border-subtle);
}

/* Modal profil utilisateur */
#user-profile-modal {
  backdrop-filter: blur(4px);
}

#user-profile-modal > div {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
