/* Calm and minimal, per docs/SPEC.md "Visual style". The product shows as OpenNet, with its logo. */

:root {
  --bg: #FAFAF9;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2937;
  --muted: #6B7280;
  --accent: #3B6E8F;
  --accent-soft: #EAF1F5;
  --ok: #3F6F4E;
  --ok-soft: #EDF4EF;
  --warn: #8A6116;
  --warn-soft: #FBF4E6;
  --bad: #9B2C2C;
  --bad-soft: #FBEDED;
  --radius: 6px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
header.top .brand { font-weight: 600; color: var(--text); }
/* The OpenNet logo sits to the left of the name (header and login). */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { display: block; }
header.top nav { display: flex; gap: 18px; flex: 1; }
header.top form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 32px 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }

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

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat .value { font-size: 22px; font-weight: 600; }
.stat .label { color: var(--muted); font-size: 13px; }

.notice { border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; border: 1px solid; }
.notice.warn { background: var(--warn-soft); border-color: #EAD9B5; color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: #EDC9C9; color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: #C9DECF; color: var(--ok); }
.notice.info { background: var(--accent-soft); border-color: #CADCE7; color: var(--accent); }
.notice strong { display: block; margin-bottom: 2px; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; font-size: 13px; color: var(--muted); background: #F7F7F5; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap table { border: 0; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: #C9DECF; background: var(--ok-soft); }
.pill.warn { color: var(--warn); border-color: #EAD9B5; background: var(--warn-soft); }
.pill.bad { color: var(--bad); border-color: #EDC9C9; background: var(--bad-soft); }

form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
input[type=number] { width: 80px; }
.fields { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 12px; }

button, .button {
  font: inherit;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
button.danger { background: #fff; color: var(--bad); border-color: #EDC9C9; }
/* Unavailable (e.g. Afinar on a Barrido version): light grey, so it reads as off, not as a plain button. */
button:disabled, .button[aria-disabled="true"] {
  background: #F3F4F6; color: #9CA3AF; border-color: var(--border); cursor: not-allowed;
}

.login { max-width: 360px; margin: 10vh auto; }
.login input { width: 100%; margin-bottom: 12px; }

details summary { cursor: pointer; color: var(--accent); }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

footer.osm { color: var(--muted); font-size: 12px; margin-top: 40px; }

/* ---- the review screen (stage 5c) ---------------------------------------------------------- */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin: 16px 0; }
@media (max-width: 900px) { .review { grid-template-columns: minmax(0, 1fr); } }
.review-map { height: 70vh; min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); }
/* OpenStreetMap tiles, desaturated so the routes carry the colour -- SPEC "Visual style". */
.review-map .leaflet-tile-pane { filter: grayscale(0.85) saturate(0.5) brightness(1.05); }
.review-side { max-height: 70vh; overflow-y: auto; }
.stats.compact { grid-template-columns: repeat(2, 1fr); margin-bottom: 12px; }
.stats.compact .value { font-size: 18px; }
.vehicle-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 8px; }
.vehicle-list ol, .vehicle-list ul { margin: 8px 0 0; padding-left: 22px; font-size: 13px; }
.vehicle-list li { margin: 2px 0; }
/* The route list: each <li> is a block (a parking stop and its walked stops); the label carries the number. */
.vehicle-list ol.route-stops { list-style: none; padding-left: 4px; }
.route-stops .walked { padding-left: 16px; }
.route-stops.sorting li { cursor: grab; padding: 3px 6px; border: 1px dashed var(--border); border-radius: 6px; background: var(--card); }
.route-stops.sorting li.sortable-ghost { opacity: .4; }
.reorder-open { margin: 6px 0 0; }
button.small { padding: 4px 10px; font-size: 13px; }
.reorder-tools { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reorder-tools p { flex-basis: 100%; margin: 0; font-size: 13px; }
.mixto-zone .zone-postcodes { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 4px; }
.mixto-zone label { font-size: 13px; white-space: nowrap; }
.zone-map { height: 420px; border: 1px solid var(--border); border-radius: 6px; }
.zone-panel .leaflet-tile-pane { filter: grayscale(0.85) saturate(0.5) brightness(1.05); }
.fleet-order tr[data-vehicle] { cursor: grab; }
.fleet-order tr.sortable-ghost { opacity: .4; }
.fleet-order .drag-handle { color: var(--muted, #9CA3AF); width: 1.5em; user-select: none; }
#fleet-order-status { margin-left: 6px; }
tfoot tr.total td { font-weight: 600; border-top: 2px solid var(--border); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.stop-icon-wrap { background: none; border: 0; }
.stop-icon { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); color: #fff; font: 600 10px/1 Inter, system-ui, sans-serif; }
/* Several delivery rows at one stop (17a, 17b...): a black ring (operator, 2026-10-07). */
.stop-icon.multi { border-color: #000; }
/* Light fills (e.g. #17deee) get dark numbers; review.js decides. */
.stop-icon.dark-text { color: #111827; }
.stop-icon.unassigned { background: #fff; color: var(--bad); border-color: var(--bad); }
.stop-icon.merged { box-shadow: 0 0 0 2px var(--warn); }
.stop-icon.locked { outline: 2px dashed #1F2937; outline-offset: 1px; }
.stop-popup ul { margin: 6px 0; padding-left: 18px; }
.stop-popup .warn-line { color: var(--warn); margin-top: 4px; }
.stop-popup .lock-line { margin-top: 4px; }
.popup-form { display: flex; gap: 6px; margin-top: 8px; }
.map-caption { background: #fff; border: 1px solid #bbb; border-radius: 3px; padding: 4px 8px; font-size: 12px; color: #333; }
.reoptimize p { margin: 0 0 8px; }
.diff .stats { margin-top: 10px; }
.delta { font-size: 13px; font-weight: 500; }
.delta.better { color: var(--ok); }
.delta.worse { color: var(--bad); }

/* Stage 6: a stop whose position Google changed, and the map's before/after toggle. */
.stop-icon.moved { box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 5px #1F2937; }
.map-toggle { display: flex; background: #FFFFFF; }
.map-toggle button { border: 0; background: #FFFFFF; color: #374151; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.map-toggle button.active { background: #1F2937; color: #FFFFFF; }

/* 5d: buttons inside a notice (approved banner). */
form.inline { display: inline-block; margin: 0 0 0 8px; }

/* Stage 7: "Salida para conductores". */
.driver .sections li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.driver .sections input { flex: 1 1 260px; min-width: 0; font-size: 12px; }
.driver textarea.whatsapp { width: 100%; font-family: inherit; font-size: 13px; }

/* Stage 7: the download buttons on "Salida para conductores". */
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* The depot on the review map: the logo in a white disc with a thin navy ring. Qualified with
   .leaflet-marker-icon on purpose: Leaflet's own stylesheet loads after this one on the plan page and sets
   that class to display: block, which silently undid the centring (the logo sat in a corner). */
.leaflet-marker-icon.depot-marker { background: #FFFFFF; border: 2px solid #1F2A3C; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); box-sizing: border-box; display: flex;
  align-items: center; justify-content: center; }
.depot-marker .depot-logo { width: 22px; height: 22px; display: block; }
