* {
  box-sizing: border-box;
}

:root {
  --text: #18212f;
  --muted: #6b7280;
  --border: #dbe4ee;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-dark: #15803d;
  --secondary: #e8eef5;
  --secondary-dark: #d7e0ea;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 20px;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, #edf4ff 0%, transparent 35%),
    linear-gradient(180deg, #f7faff 0%, #eef3f9 100%);
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 16px 30px;
}

.top-bar {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  margin-bottom: 22px;
}

.center-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.page-title {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
}

.back-link {
  text-decoration: none;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  transition: 0.2s ease;
  z-index: 2;
}

.back-link:hover {
  transform: translateY(-1px);
  background: #f8fafc;
}

.card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(219, 228, 238, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 800;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: 0.2s ease;
}

input:focus,
select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input:disabled {
  background: #edf2f7;
  color: #64748b;
  cursor: not-allowed;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 800;
  transition: 0.2s ease;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  color: var(--text);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: #fff;
}

.dest-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}

.result-box {
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
  border: 1px solid #cfe0ff;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d8e7ff;
  border-radius: 18px;
  padding: 18px;
}

.result-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.result-value {
  font-size: 28px;
  font-weight: 800;
}

.saved-msg {
  margin-top: 6px;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.deplacements-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 950px;
}

.deplacements-table th,
.deplacements-table td {
  border: 1px solid #dbe4ee;
  padding: 12px;
  text-align: left;
  font-size: 14px;
}

.deplacements-table th {
  background: #eff6ff;
  font-weight: 800;
}

.deplacements-table td {
  background: #fff;
}

.empty-cell {
  text-align: center !important;
  color: var(--muted);
  font-style: italic;
}

.table-action-btn {
  border: none;
  background: #ef4444;
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.monthly-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.summary-box {
  background: #f8fbff;
  border: 1px solid #dbe4ee;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.summary-box strong {
  font-size: 22px;
}

#map {
  width: 100%;
  height: 420px;
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 14px 28px rgba(22, 163, 74, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: 0.3s ease;
  font-weight: 800;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mt-10 {
  margin-top: 10px;
}

.mt-16 {
  margin-top: 16px;
}

/* ACCUEIL */

.home-body {
  min-height: 100vh;
}

.home-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.home-card {
  width: 100%;
  max-width: 1100px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 228, 238, 0.9);
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  padding: 34px;
}

.home-header {
  text-align: center;
  margin-bottom: 30px;
}

.home-header h1 {
  margin: 0 0 10px;
  font-size: 36px;
  font-weight: 900;
}

.home-header p {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.menu-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dbe4ee;
  border-radius: 22px;
  padding: 26px;
  transition: 0.25s ease;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.12);
  border-color: #bfd7ff;
}

.menu-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.menu-title {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 8px;
}

.menu-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.menu-card.disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.menu-card.disabled:hover {
  transform: none;
}

@media (max-width: 900px) {
  .grid-3,
  .result-grid,
  .home-grid,
  .monthly-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .result-grid,
  .home-grid,
  .monthly-summary {
    grid-template-columns: 1fr;
  }

  .dest-row {
    grid-template-columns: 1fr;
  }

  .container {
    margin: 18px auto;
    padding: 0 12px 24px;
  }

  .card,
  .home-card {
    padding: 18px;
    border-radius: 20px;
  }

  .top-bar {
    justify-content: flex-start;
    min-height: auto;
    padding-top: 6px;
  }

  .center-title {
    position: static;
    transform: none;
    width: 100%;
    text-align: center;
    margin-top: 12px;
  }

  .page-title {
    font-size: 26px;
    white-space: normal;
  }

  .home-header h1 {
    font-size: 30px;
  }

  #map {
    height: 300px;
  }

  .btn {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }
}