:root {
  --bg: #eef3f8;
  --bg-dark: #0f172a;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --orange: #f97316;
  --orange-soft: #ffedd5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --shadow: 0 18px 45px rgba(15, 23, 42, .10);
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, .07);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, .18), transparent 28%),
    radial-gradient(circle at top right, rgba(37, 99, 235, .16), transparent 30%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .035) 1px, transparent 1px);
  background-size: 38px 38px;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, .92);
  backdrop-filter: blur(18px);
  color: white;
  padding: 14px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 30px rgba(2, 6, 23, .25);
}

nav strong {
  font-size: 18px;
  letter-spacing: -.02em;
  margin-right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

nav strong::before {
  content: "◆";
  color: #2dd4bf;
  font-size: 15px;
}

nav a {
  color: #e5e7eb;
  text-decoration: none;
  opacity: .92;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 999px;
  transition: all .18s ease;
}

nav a:hover {
  background: rgba(255,255,255,.10);
  color: #ffffff;
  transform: translateY(-1px);
}

main {
  position: relative;
  max-width: 1240px;
  margin: 32px auto;
  padding: 0 20px 70px;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -.055em;
  color: #0f172a;
}

h1::after {
  content: "";
  display: block;
  width: 86px;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--blue));
  border-radius: 999px;
  margin-top: 16px;
}

h2 {
  margin: 32px 0 14px;
  font-size: 22px;
  letter-spacing: -.035em;
  color: #111827;
}

p {
  color: #334155;
}

small {
  color: var(--muted);
  line-height: 1.45;
}

.center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(45,212,191,.22), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(59,130,246,.22), transparent 32%),
    #0f172a;
}

.card {
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(226,232,240,.86);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
}

.card:hover {
  box-shadow: var(--shadow);
}

.login {
  width: 100%;
  max-width: 430px;
  background: rgba(255,255,255,.96);
  padding: 34px;
  border-radius: 30px;
}

.login h1 {
  font-size: 42px;
  margin-bottom: 10px;
}

.login h1::after {
  margin-top: 12px;
}

.login p {
  margin-top: 0;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 15px;
  margin-bottom: 12px;
  font-size: 16px;
  color: var(--text);
  background: rgba(255,255,255,.92);
  outline: none;
  transition: all .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20,184,166,.13);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button,
.button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: 0;
  border-radius: 15px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 22px rgba(15,118,110,.22);
  transition: all .18s ease;
}

button:hover,
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(15,118,110,.30);
}

button:active,
.button:active {
  transform: translateY(0);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
}

.actions .button:nth-child(2n),
.actions button:nth-child(2n) {
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  box-shadow: 0 10px 22px rgba(37,99,235,.22);
}

.actions .button:nth-child(3n),
.actions button:nth-child(3n) {
  background: linear-gradient(135deg, #334155, #0f172a);
  box-shadow: 0 10px 22px rgba(15,23,42,.22);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 18px 0 26px;
}

.grid .card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
}

.grid .card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--blue));
}

.grid .card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 110px;
  height: 110px;
  background: var(--primary-soft);
  border-radius: 999px;
  opacity: .85;
}

.grid .card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.grid .card b {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 42px;
  margin-top: 12px;
  letter-spacing: -.05em;
  color: #0f172a;
}

.table {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(226,232,240,.95);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
}

.row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 14px;
  align-items: center;
  padding: 17px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  background: rgba(255,255,255,.72);
  transition: all .15s ease;
}

.row:last-child {
  border-bottom: 0;
}

.row:hover {
  background: #f8fafc;
}

.row strong {
  color: #0f172a;
}

.badge {
  background: var(--blue-soft);
  color: #1e40af;
  border: 1px solid rgba(37,99,235,.18);
  border-radius: 999px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.badge:contains("Payé") {
  background: var(--green-soft);
  color: #166534;
}

.form h2 {
  margin-top: 26px;
  font-size: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.form h2:first-child {
  margin-top: 0;
}

.error {
  background: var(--red-soft);
  color: #991b1b;
  padding: 13px;
  border-radius: 15px;
  margin-bottom: 12px;
  border: 1px solid rgba(220,38,38,.16);
  font-weight: 700;
}

.hero {
  background:
    linear-gradient(135deg, rgba(15,23,42,.96), rgba(15,118,110,.92)),
    radial-gradient(circle at top right, rgba(45,212,191,.5), transparent 35%);
  color: white;
  padding: 34px;
  border-radius: 30px;
  margin-bottom: 22px;
  box-shadow: 0 24px 55px rgba(15,23,42,.22);
}

.hero h1,
.hero p {
  color: white;
}

.hero h1::after {
  background: white;
  opacity: .75;
}

.photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.photo {
  background: rgba(255,255,255,.94);
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.photo img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

#signaturePad {
  width: 100%;
  max-width: 650px;
  height: 240px;
  display: block;
  background: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: 20px;
  margin: 14px 0;
  touch-action: none;
  box-shadow: inset 0 0 0 4px #f8fafc;
}

.gps-live-box {
  border: 2px solid rgba(20,184,166,.35);
  background:
    linear-gradient(135deg, rgba(236,253,245,.92), rgba(255,255,255,.95));
}

#gpsLiveStatus {
  font-weight: 900;
  color: var(--primary-dark);
}

.planning-row {
  grid-template-columns: 1.5fr 1fr 1.3fr 1.5fr;
}

.mini-form,
.mini-planning-form {
  display: grid;
  gap: 6px;
}

.mini-form select,
.mini-form input,
.mini-planning-form select,
.mini-planning-form input {
  padding: 9px;
  margin-bottom: 5px;
  font-size: 13px;
}

input[readonly] {
  background: #f8fafc;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-dark);
}

a {
  color: var(--primary);
  font-weight: 700;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* Page sections */
main > .card:first-of-type {
  border-top: 5px solid var(--primary);
}

/* Premium quick access */
.card h2 + .actions {
  margin-top: 10px;
}

/* Mobile */
@media(max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .row,
  .planning-row {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 700px) {
  nav {
    padding: 12px;
    gap: 6px;
  }

  nav strong {
    width: 100%;
    font-size: 17px;
    margin-bottom: 4px;
  }

  nav a {
    font-size: 13px;
    padding: 8px 10px;
    background: rgba(255,255,255,.07);
  }

  main {
    margin: 20px auto;
    padding: 0 13px 50px;
  }

  h1 {
    font-size: 34px;
  }

  .grid,
  .photos {
    grid-template-columns: 1fr;
  }

  .card {
    border-radius: 20px;
    padding: 18px;
  }

  .login {
    padding: 24px;
  }

  button,
  .button {
    width: 100%;
    text-align: center;
    margin-bottom: 7px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .photo img {
    height: 230px;
  }
}

.card,
.table,
.hero {
  animation: riseIn .34s ease both;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
