:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17221b;
  background: #dfe7df;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 420px; }
.map-stage { position: relative; min-width: 0; height: 100vh; overflow: hidden; background: #cfd8cf; }
.map { position: absolute; inset: 0; min-width: 0; height: 100%; background: #cfd8cf; }
.panel { height: 100vh; overflow-y: auto; padding: 22px; background: rgba(245, 244, 238, .97); border-left: 1px solid rgba(23,34,27,.12); box-shadow: -14px 0 30px rgba(22,37,28,.12); z-index: 900; }
.brand, .section-head, .totals, .metrics, .cost-table { display: flex; align-items: center; }
.brand { justify-content: space-between; margin-bottom: 16px; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.eyebrow, .muted, small { color: #6c756e; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.badge { border: 1px solid #7f8e82; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 700; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.mode { border: 1px solid #cdd3cd; background: #eceeea; color: #445047; border-radius: 12px; padding: 10px; font-weight: 700; }
.mode.active { background: #1f5d3f; color: #fff; border-color: #1f5d3f; }
.card { background: #fff; border: 1px solid #d9ded8; border-radius: 18px; padding: 16px; margin-bottom: 12px; box-shadow: 0 6px 18px rgba(23,34,27,.04); }
.card.compact { padding-bottom: 14px; }
.section-head { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 15px; }
.link-button { border: 0; background: transparent; color: #5d6a60; font-size: 12px; padding: 0; }
.point-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.point-button { display: grid; grid-template-columns: 30px 1fr; gap: 2px 8px; text-align: left; align-items: center; border: 1px solid #d8ded8; background: #f7f7f3; border-radius: 12px; padding: 10px; color: inherit; }
.point-button.active { border-color: #1f5d3f; box-shadow: inset 0 0 0 1px #1f5d3f; }
.point-button span { grid-row: 1 / 3; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #23372a; color: #fff; font-weight: 800; }
.point-button strong { font-size: 12px; }
.point-button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.primary { width: 100%; border: 0; border-radius: 12px; background: #d9783d; color: #fff; padding: 11px 14px; font-weight: 800; }
.primary:disabled { background: #c9ccc8; cursor: not-allowed; }
.status { margin: 10px 0 0; font-size: 11px; color: #667069; line-height: 1.4; }
.status[data-kind="error"] { color: #a3392f; }
.status[data-kind="ok"] { color: #1f6f46; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 5px; font-size: 11px; color: #5b675e; }
input { width: 100%; min-width: 0; border: 1px solid #d9ded8; background: #fafaf7; border-radius: 9px; padding: 8px 9px; color: #17221b; }
input:focus { outline: 2px solid rgba(31,93,63,.18); border-color: #1f5d3f; }
.cost-table { display: grid; grid-template-columns: 1.3fr .85fr .85fr; gap: 8px; margin: 7px 0; font-size: 11px; }
.cost-table.header { color: #7b837d; border-bottom: 1px solid #e4e7e3; padding-bottom: 7px; }
.cost-table input { padding: 7px; text-align: right; }
.cost-table output { align-self: center; text-align: right; padding-right: 7px; font-weight: 700; }
.totals { gap: 8px; border-top: 1px solid #e4e7e3; margin-top: 12px; padding-top: 12px; }
.totals > div { flex: 1; min-width: 0; }
.totals small, .totals strong { display: block; }
.totals strong { margin-top: 2px; font-size: 14px; white-space: nowrap; }
#variance[data-kind="over"] { color: #a13c32; }
#variance[data-kind="under"] { color: #1f6f46; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metrics > div { background: #f4f6f2; border-radius: 12px; padding: 10px; }
.metrics small, .metrics strong { display: block; }
.metrics strong { margin-top: 4px; font-size: 16px; }
.hint { margin: 12px 0 0; color: #6f7971; font-size: 10px; line-height: 1.5; }
.stop-list { display: grid; gap: 7px; }
.stop-item { width: 100%; display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 9px; text-align: left; border: 1px solid #e0e4df; background: #fafbf8; border-radius: 11px; padding: 8px; color: inherit; }
.stop-item strong, .stop-item small { display: block; }
.stop-item strong { font-size: 11px; }
.stop-item small { font-size: 9px; margin-top: 2px; }
.stop-item b { font-size: 10px; color: #667069; }
.stop-dot { width: 9px; height: 9px; border-radius: 50%; background: #667; }
.stop-dot.fuel { background: #b04b3e; }.stop-dot.meal { background: #c7932e; }.stop-dot.sleep { background: #4f5ca8; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .app-shell { min-height: 100vh; height: auto; grid-template-columns: 1fr; grid-template-rows: 52vh auto; }
  .map-stage { height: 52vh; position: sticky; top: 0; z-index: 1; }
  .map { height: 100%; position: absolute; inset: 0; }
  .panel { height: auto; overflow: visible; border-left: 0; border-top: 1px solid #ccd3cc; padding: 16px; z-index: 2; }
}

.brand-actions { display: flex; align-items: center; gap: 8px; }
.language-switch { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid #d4d9d4; border-radius: 999px; background: #f7f8f4; }
.lang-button { width: 32px; height: 25px; border: 0; border-radius: 999px; padding: 0; background: transparent; font-size: 15px; line-height: 1; opacity: .5; }
.lang-button.active { opacity: 1; background: #fff; box-shadow: 0 2px 8px rgba(23,34,27,.1); }

body[data-auth="pending"] .app-shell { visibility: hidden; }
.brand-actions { max-width: 250px; }
.user-email { min-width: 0; max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #687069; font-size: 10px; }
.logout-button { border: 1px solid #d1d7d1; border-radius: 999px; padding: 5px 9px; background: #fff; color: #475249; font-size: 10px; font-weight: 700; }
.logout-button:hover { border-color: #98a69b; background: #f7f8f4; }
.logout-button:disabled { opacity: .55; cursor: wait; }


.map-toolbar {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.map-layer-switch,
.map-tool-toggle {
  pointer-events: auto;
  border: 1px solid rgba(23,34,27,.18);
  background: rgba(250,250,246,.94);
  box-shadow: 0 8px 24px rgba(22,34,27,.12);
  backdrop-filter: blur(12px);
}

.map-layer-switch {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 14px;
}

.map-layer-button {
  min-width: 72px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  color: #526057;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.map-layer-button.active {
  color: #fff;
  background: #1f5d3f;
}

.map-tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  border-radius: 14px;
  padding: 0 11px 0 8px;
  color: #364239;
  font-size: 10px;
  font-weight: 800;
}

.map-tool-toggle:hover {
  border-color: rgba(31,93,63,.4);
}

.map-tool-toggle.active {
  color: #fff;
  border-color: #1f5d3f;
  background: rgba(31,93,63,.95);
}

.map-tool-icon,
.terrain-chip {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  color: #fff;
  background: #273b2f;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.map-tool-toggle.active .map-tool-icon,
.map-tool-toggle.active .terrain-chip {
  color: #1f5d3f;
  background: #fff;
}

.map-point-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #f3f1e8;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 5px 14px rgba(20,31,24,.28);
  font-size: 11px;
  font-weight: 900;
}

.map-point-marker.start { background: #277c50; }
.map-point-marker.end { background: #c8683a; }

.map-stop-marker {
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(20,31,24,.24);
}

.map-stop-marker.fuel { background: #b04b3e; }
.map-stop-marker.meal { background: #c7932e; }
.map-stop-marker.sleep { background: #4f5ca8; }

.maplibregl-popup-content {
  border-radius: 10px;
  padding: 10px 12px;
  color: #17221b;
  font-size: 11px;
  box-shadow: 0 8px 28px rgba(20,31,24,.18);
}

.maplibregl-popup-content strong {
  display: block;
  margin-bottom: 3px;
}

.maplibregl-ctrl-group,
.maplibregl-ctrl-attrib {
  border-radius: 10px !important;
  overflow: hidden;
}

.maplibregl-ctrl-attrib {
  color: #56615a;
  background: rgba(255,255,255,.88) !important;
}

.role-badge {
  border: 1px solid #b9c7bd;
  border-radius: 999px;
  padding: 4px 7px;
  color: #1f5d3f;
  background: #eef4ef;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .map-toolbar { top: 10px; left: 10px; }
  .terrain-toggle { border-radius: 12px; }
  .user-email { display: none; }
  .role-badge { display: none; }
}

.map-toolbar { flex-wrap: wrap; max-width: calc(100% - 32px); }
@media (max-width: 680px) {
  .map-layer-button { min-width: 62px; padding-inline: 9px; }
  .map-tool-toggle { height: 40px; padding-inline: 7px 9px; }
  .map-tool-icon, .terrain-chip { width: 26px; height: 26px; }
}
