:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e2e6ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;

  --radius: 12px;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  /**max-width: 1200px;**/
  margin: 0 auto;
  padding: 24px;
  padding-top: 70px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: fit-content;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  outline: none;
  font-size: 14px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Conteneur de la checkbox */
.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Checkbox custom */
.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
}

/* Checkbox hover */
.checkbox-wrapper input[type="checkbox"]:hover {
  border-color: var(--primary);
}

/* Checkbox focus */
.checkbox-wrapper input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  border-color: var(--primary);
}

/* Checkbox checked */
.checkbox-wrapper input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

/* Checkmark */
.checkbox-wrapper input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}


.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
}

button:active {
}

button.primary {
  background: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: white;
}

button.primary:hover {
  background: #1e4dbf; /* plus foncé */
}

button.primary:active {
  background: #173f9d; /* encore plus foncé */
}

button.secondary {
  background: #f3f4f6;
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

button.secondary:hover {
  background: #e9ecf1; /* plus foncé mais subtil */
}

button.secondary:active {
  background: #dde1e7; /* encore plus foncé */
}

button.danger {
  background: var(--danger);
  color: white;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

button.danger:hover {
  background: #b91c1c;
}

button.danger:active {
  background: #8b1515;
}

button.small {
  padding: 8px 10px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: hidden;
  width: 100%;
}

.table {
  width: 100%;
  table-layout: fixed;
}

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

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


table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  table-layout: auto;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  width: max-content;
  border-right: 1px solid var(--border);
  text-align: center;
}

.table th,
.table td {
  white-space: normal; 
  overflow: hidden;
  text-overflow: ellipsis;
}

.table th:last-child,
.table td:last-child {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  text-align: center;
  border-right: none;
}

th {
  background: #f3f4f6;
  font-size: 13px;
  color: var(--muted);
  position: relative;
}

tr:hover td {
  background: #fafbff;
}

tr.yellow-cell td {
  background: #f6ce34;
}

table tr.yellow-cell:hover td {
  background: #f4c72d !important;
}

th .sort-arrow {
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.3;
  color: var(--text);
}

th.sorted .sort-arrow {
  opacity: 1;
  color: black; /* ou var(--text) si tu veux */
}

.table input,
.table select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  font-size: 14px;
}


.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.status.true {
  background: var(--success);
}

.status.false {
  background: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pagination {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination-bottom {
  margin-left: auto;
}

.filters input {
  width: 200px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
    align-items: flex-start;
  }
}
/* -------------------------
   MODAL (Audit / History)
-------------------------- */

.modal {
  display: none;               /* hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;

  justify-content: center;
  align-items: center;
  padding: 18px;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 1400px;
  overflow: hidden;
  max-height: 60vh;
  overflow: hidden;
}

.modal-inner {
  padding: 14px;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.close-btn {
  border: none;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
  color: var(--muted);
}

/* Scroll inside modal only */
.modal-body {
  max-height: calc(60vh - 100px);
  overflow-y: auto;
}

/* Table inside modal */
.modal-body table {
  width: max-content;  /* important: table size = content */
  min-width: 100%;     /* but at least full width */
  border-collapse: collapse;
}

.modal-body th,
.modal-body td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
}

.modal-body th {
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
}

.modal-body tr:nth-child(odd) {
  background: #f7f7f7;
}

.modal-body tr:nth-child(even) {
  background: #ffffff;
}

.modal-body tr:hover td {
  background: #fafbff;
}

/* responsive */
@media (max-width: 900px) {
  .modal-content {
    max-width: 100%;
  }
  .modal-body table {
    width: 100%;
  }
}

.edit {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.edit[type="checkbox"] {
  width: auto;
  padding: 0;
}

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  background: #112549;
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px; /* espace entre Settings et Logout */
}


.nav-brand {
  font-weight: bold;
  color: white;
}

.nav-link {
  color: white;                 /* texte blanc */
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.12);
}

/* Dropdown */
.nav-item {
  position: relative;
}

.dropdown {
  position: absolute;
  top: 40px;
  left: 0;
  background: #112549;
  border: 1px solid rgba(255,255,255,0.12);
  display: none;
  flex-direction: column;
  min-width: 150px;
  padding: 8px 0;
  border-radius: 6px;
}

.dropdown a {
  color: white;
  padding: 8px 12px;
  text-decoration: none;
}

.dropdown a:hover {
  background: rgba(255,255,255,0.12);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

input[type="text"],
input[type="password"] {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.empty-trailer.checked {
  color: #777;
  text-decoration: line-through;
  font-weight: 600;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.day {
  border: 1px solid #ddd;
  padding: 10px;
  min-height: 120px;
  border-radius: 8px;
}

.day .date {
  font-weight: 700;
  margin-bottom: 8px;
}

.day-separator td {
  background: #e6e6e6;
  font-weight: bold;
  padding: 8px 12px;
  border-top: 2px solid #bbb;
  border-bottom: 2px solid #bbb;
  font-size: 13px;
}


.event {
  background: #f3f3f3;
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}

.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.event {
  background: #f3f3f3;
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}

.day.empty {
  background: #f9f9f9;
}

.day.today {
  border: 2px solid #2f6fff;
}


.form-message {
  margin-top:10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
  text-align: center;
}

.form-message.success {
  background: #e6f4ea;
  color: #1e7e34;
  border: 1px solid #b7e1c2;
}

.form-message.error {
  background: #fdecea;
  color: #b02a37;
  border: 1px solid #f5c2c7;
}

.preplan-bar {
  display: flex;
  gap: 12px;
  padding: 5px 3px;

  flex-wrap: wrap;
}

.preplan-item {
  background: white;
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: #f5f5f5;
  border-left: 6px solid #ccc;
}

.preplan-item span {
  font-weight: 400;
  color: #555;
}

.preplan-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.preplan-bar {
  max-width: 900px;
  justify-content: center;
}

.preplan-item.progress-ok {
  background: #e7f6ec;
  border-left-color: #2ecc71;
}

.preplan-item.progress-partial {
  background: #e8f0ff;
  border-left-color: #2f6fff;
}

.preplan-item.progress-over {
  background: #fff6db;
  border-left-color: #f1c40f;
}

.total-item {
  font-weight: 700;
  border-left-width: 8px;
}

.quick-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.quick-filters label {
  display: flex;
  gap: 6px;
  align-items: center;
}

.filter-item {
  background: white;
  border-radius: 10px;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  white-space: nowrap;
  background: #f5f5f5;
}

.search-highlight {
  background: rgba(59, 130, 246, 0.12);
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.search-highlight::after {
  content: "";
  position: absolute;
  inset: -6px;
  background: rgba(59, 130, 246, 0.15);
  filter: blur(6px);
  opacity: 0.8;
  animation: neonGlow 1.4s ease-in-out infinite;
  z-index: -1;
}

@keyframes neonGlow {
  0%   { box-shadow: 0 0 6px rgba(59, 130, 246, 0.6); }
  50%  { box-shadow: 0 0 18px rgba(59, 130, 246, 0.9); }
  100% { box-shadow: 0 0 6px rgba(59, 130, 246, 0.6); }
}

.row-warning td {
  background: #fff3b0;
}

.row-warning:hover td {
  background: #fff6c7;
}

.version-footer {
  position: fixed;
  left: 12px;
  bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.8;
}
