@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=DM+Serif+Display&display=swap');

:root {
  --green: #1d4e3a;
  --green-dark: #123a2a;
  --green-light: #e8f0ea;
  --amber: #b8722a;
  --red: #a53f3f;
  --ink: #1f2620;
  --paper: #fbfaf7;
  --line: #dde3dd;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
}

h1, h2, h3 {
  font-family: 'DM Serif Display', serif;
  color: var(--green-dark);
  margin: 0 0 0.4em;
}

a { color: var(--green); }

.topbar {
  background: var(--green);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar .brand {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem;
}

.topbar nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 16px;
  font-size: 0.95rem;
  opacity: 0.9;
}
.topbar nav a:hover, .topbar nav a.active { opacity: 1; text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat {
  background: var(--green-light);
  border-radius: var(--radius);
  padding: 16px;
}
.stat .value { font-size: 1.8rem; font-weight: 700; color: var(--green-dark); }
.stat .label { font-size: 0.85rem; color: #4a564d; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #4a564d; font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #f6f8f5; }

button, .btn {
  font-family: inherit;
  background: var(--green);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
}
button:hover, .btn:hover { background: var(--green-dark); }
button.secondary { background: #fff; color: var(--green); border: 1px solid var(--green); }
button.danger { background: var(--red); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
}
label { display: block; font-size: 0.85rem; font-weight: 500; margin: 10px 0 4px; color: #4a564d; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.green { background: #e0f0e5; color: var(--green-dark); }
.badge.amber { background: #f7e9d8; color: var(--amber); }
.badge.red { background: #f5e0e0; color: var(--red); }
.badge.grey { background: #ececec; color: #666; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.muted { color: #6b756c; font-size: 0.88rem; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,30,22,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 22px; max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}

/* Driver mobile view */
.driver-body { background: var(--green-dark); min-height: 100vh; }
.driver-wrap { max-width: 480px; margin: 0 auto; padding: 16px; }
.driver-card {
  background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.driver-card h3 { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 1.1rem; margin-bottom: 2px; }
.driver-card .addr { font-size: 0.95rem; color: #333; margin-bottom: 8px; }
.driver-card .flags { margin: 8px 0; }
.driver-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.driver-actions button { flex: 1 1 auto; min-width: 100px; }
.driver-header { text-align: center; color: #fff; padding: 18px 0 8px; }
.driver-header h1 { color: #fff; font-size: 1.4rem; }

/* A confirmed/locked stop dims slightly so a driver can see at a glance
   which stops on their round are done and signed off. */
.driver-card.confirmed { opacity: 0.65; }

@media (max-width: 640px) {
  .topbar nav a { margin-left: 10px; font-size: 0.85rem; }
}
