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

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f7fa;
  color: #1f2937;
  min-height: 100vh;
}

/* ---- Vues ---- */

.view {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---- Connexion ---- */

#view-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  margin: 0 0 1.75rem;
  font-size: 1.5rem;
  text-align: center;
  color: #1f2937;
}

/* ---- Formulaires ---- */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: #374151;
}

.form-group input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  color: #1f2937;
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.error-msg {
  color: #ef4444;
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

/* ---- Boutons ---- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  background: #7c3aed;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-full {
  width: 100%;
  padding: 0.75rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #f9fafb;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-danger:hover {
  opacity: 0.9;
}

/* ---- En-tête ---- */

.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  flex: 1;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* ---- Nom du voyage ---- */

.voyage-name-input {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.25rem 0;
  outline: none;
  background: transparent;
  color: #1f2937;
  min-width: 0;
}

.voyage-name-input:focus {
  border-bottom-color: #7c3aed;
}

.voyage-name-input::placeholder {
  font-weight: 400;
  color: #9ca3af;
}

/* ---- Contenu ---- */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ---- Liste des voyages ---- */

.voyages-grid {
  display: grid;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.voyage-item {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-size: 1rem;
  color: #1f2937;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.voyage-item:hover {
  border-color: #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

.voyage-item-name {
  font-weight: 500;
}

.empty-msg {
  color: #6b7280;
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.95rem;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  .app-header {
    flex-wrap: wrap;
  }

  .voyage-name-input {
    order: 3;
    width: 100%;
    flex: none;
  }
}
