:root {
  --ink: #172620;
  --muted: #718078;
  --line: #dde3de;
  --paper: #f5f7f3;
  --white: #fff;
  --green: #b9f227;
  --deep-green: #174d3b;
  --blue: #2874d0;
  --orange: #ff7548;
  --shadow: 0 16px 40px rgb(26 49 40 / 10%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
}
button, input, select { font: inherit; }

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  color: white;
  background: var(--ink);
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}
.brand { display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; font: 800 21px Manrope, sans-serif; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; color: var(--ink); background: var(--green); border-radius: 12px 4px 12px 4px; font-size: 15px; }
.topbar-copy { display: flex; flex-direction: column; gap: 2px; padding-left: 28px; border-left: 1px solid rgb(255 255 255 / 20%); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.topbar .eyebrow { color: #a7b3ad; }
.topbar-copy strong { font-size: 14px; }
.main-nav { align-self: stretch; display: flex; align-items: stretch; gap: 4px; }
.main-nav a { position: relative; display: flex; align-items: center; padding: 0 14px; color: #bfcac4; font-size: 12px; font-weight: 700; text-decoration: none; }
.main-nav a:hover { color: white; }
.main-nav a.is-active { color: white; }
.main-nav a.is-active::after { content: ""; position: absolute; right: 14px; bottom: 0; left: 14px; height: 3px; background: var(--green); border-radius: 3px 3px 0 0; }
.admin-link { margin-left: auto; color: #dce4df; font-size: 13px; text-decoration: none; }
.admin-link span { color: var(--green); margin-left: 5px; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-identity { display: flex; flex-direction: column; align-items: flex-end; }
.user-identity strong { color: white; font-size: 11px; }
.user-identity small { color: #9fada5; font-size: 8px; }
.logout-button { padding: 5px 0 5px 12px; color: #bfcac4; background: none; border: 0; border-left: 1px solid rgb(255 255 255 / 18%); font-size: 10px; cursor: pointer; }
.logout-button:hover { color: white; }

.workspace { height: calc(100vh - 78px); min-height: 650px; display: grid; grid-template-columns: minmax(520px, 58%) minmax(390px, 42%); grid-template-rows: auto minmax(0, 1fr); }
.prepare-panel, .schedule { min-width: 0; background: white; }
.prepare-panel { position: relative; z-index: 2; grid-column: 1 / -1; display: grid; grid-template-columns: 135px minmax(0, 1fr) 285px; gap: 20px; align-items: stretch; padding: 16px 24px; border-bottom: 1px solid var(--line); box-shadow: 0 10px 30px rgb(18 39 31 / 5%); }
.panel-heading { display: flex; gap: 12px; align-items: center; padding-right: 18px; border-right: 1px solid var(--line); }
.step { display: grid; place-items: center; width: 30px; height: 30px; color: var(--deep-green); background: #eaf3ed; border-radius: 50%; font-size: 11px; font-weight: 800; }
h1, h2, h3 { margin: 2px 0 0; font-family: Manrope, sans-serif; }
h1 { font-size: 24px; }
h2 { font-size: 25px; }

.filter-form { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px 12px; align-content: center; }
.filter-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-field > label { overflow: hidden; color: #65736c; font-size: 10px; font-weight: 700; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.filter-form input[type="date"], .filter-form input[type="number"], .filter-form select { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); background: #f8faf7; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.filter-form input:focus, .filter-form select:focus { border-color: var(--deep-green); box-shadow: 0 0 0 3px rgb(23 77 59 / 10%); }
.field-help { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.number-with-suffix { position: relative; }
.number-with-suffix input { padding-right: 40px !important; }
.number-with-suffix span { position: absolute; top: 50%; right: 11px; color: var(--muted); font-size: 10px; font-weight: 700; transform: translateY(-50%); pointer-events: none; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; min-width: 0; height: 42px; align-self: end; padding: 0 11px; background: #f8faf7; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.toggle-row span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.toggle-row small { color: var(--muted); }
.toggle-row input { width: 38px; height: 20px; accent-color: var(--deep-green); }
.form-actions { display: grid; grid-template-columns: 1fr 1.15fr; gap: 7px; align-self: end; }
.button { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
.button-quiet { color: var(--ink); background: #edf1ed; }
.button-dark { color: white; background: var(--ink); }
.button-accent { width: 100%; color: var(--ink); background: var(--green); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.route-card { max-height: 166px; margin: 0; padding: 14px 15px; overflow-y: auto; color: white; background: var(--deep-green); border-radius: 12px; box-shadow: var(--shadow); }
.route-card .eyebrow { color: #b7cabf; }
.route-card > strong { display: block; margin-top: 4px; font: 700 21px Manrope, sans-serif; }
.route-card p { margin: 6px 0 10px; color: #c5d4cc; font-size: 11px; line-height: 1.35; }
.route-card > small { display: block; margin-top: 10px; color: #a7beb2; font-size: 10px; line-height: 1.35; }
.route-results { margin-top: 14px; padding-top: 13px; border-top: 1px solid rgb(255 255 255 / 18%); }
.route-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-bottom: 10px; }
.route-summary span { display: flex; flex-direction: column; padding: 6px; color: #bcd0c5; background: rgb(0 0 0 / 14%); border-radius: 6px; font-size: 8px; }
.route-summary strong { color: white; font: 700 13px Manrope, sans-serif; }
.route-stop { display: grid; grid-template-columns: 25px 1fr; gap: 7px; padding: 7px 0; border-top: 1px solid rgb(255 255 255 / 10%); }
.route-stop > b { display: grid; place-items: center; width: 21px; height: 21px; color: var(--ink); background: var(--green); border-radius: 50%; font-size: 9px; }
.route-stop span { display: flex; flex-direction: column; font-size: 10px; }
.route-stop small { color: #a7beb2; }
.route-stop.is-mandatory > b { color: white; background: var(--blue); }
.route-stop.has-conflict { margin-inline: -5px; padding-inline: 5px; background: rgb(255 117 72 / 12%); border-radius: 5px; }
.route-stop.has-conflict > b { color: white; background: var(--orange); }
.match-card.is-optimal::after { content: "RUTA"; position: absolute; top: 8px; right: 8px; color: var(--deep-green); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.planning-alert { margin: 10px 0; padding: 9px; color: #ffe2d8; background: rgb(128 28 0 / 30%); border: 1px solid rgb(255 117 72 / 45%); border-radius: 7px; font-size: 10px; line-height: 1.4; }
.planning-alert strong, .planning-alert span { display: block; }
.planning-alert span { margin-top: 3px; }
.discarded-list { margin-top: 10px; color: #d5e1da; font-size: 10px; }
.discarded-list summary { cursor: pointer; font-weight: 700; }
.discarded-list p { display: flex; flex-direction: column; gap: 2px; margin: 7px 0; padding-left: 8px; border-left: 2px solid #809d8e; }
.discarded-list p span { color: #a7beb2; }
.save-route-action { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgb(255 255 255 / 18%); }
.save-route-action small { color: #b7cabf; font-size: 9px; text-align: center; }

.schedule { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); }
.section-head { min-height: 104px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; border-bottom: 1px solid var(--line); }
.future-actions { display: flex; gap: 6px; margin-top: 8px; }
.future-actions button { padding: 4px 7px; color: #87928c; background: #f2f5f2; border: 1px solid var(--line); border-radius: 5px; font-size: 8px; font-weight: 700; }
.schedule-actions { display: flex; align-items: center; gap: 10px; }
.select-all-control { display: flex; align-items: center; gap: 7px; color: var(--deep-green); font-size: 10px; font-weight: 700; cursor: pointer; }
.select-all-control input { position: absolute; opacity: 0; pointer-events: none; }
.select-all-control span { display: block; width: 17px; height: 17px; border: 2px solid #a7b0ab; border-radius: 4px; background: white; }
.select-all-control input:checked + span { border-color: var(--deep-green); background: var(--deep-green); box-shadow: inset 0 0 0 3px white; }
.select-all-control input:indeterminate + span { border-color: var(--deep-green); background: linear-gradient(var(--deep-green), var(--deep-green)) center / 8px 2px no-repeat white; }
.select-all-control input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }
.select-all-control:has(input:disabled) { opacity: .45; cursor: default; }
.result-count { padding: 7px 10px; color: var(--deep-green); background: #edf5ef; border-radius: 20px; font-size: 11px; font-weight: 700; }
.match-columns { display: grid; grid-template-columns: 40px 92px minmax(175px, 1fr) 82px 100px; gap: 8px; padding: 12px 16px; color: #89948e; background: #f7f9f6; border-bottom: 1px solid var(--line); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.match-list { overflow-y: auto; }
.match-card { position: relative; display: grid; grid-template-columns: 40px 92px minmax(175px, 1fr) 82px 100px; gap: 8px; align-items: center; min-height: 116px; padding: 16px; border-bottom: 1px solid var(--line); transition: background .18s ease, box-shadow .18s ease; }
.match-card:hover { z-index: 1; background: #fbfcfa; box-shadow: 0 4px 16px rgb(23 38 32 / 6%); }
.match-card.is-selected { background: #f2fae4; box-shadow: inset 3px 0 var(--green); }
.match-card.is-rejected { background: #fafafa; box-shadow: inset 3px 0 #c9cecb; }
.match-card.is-alternative { background: #fff9e8; box-shadow: inset 3px 0 #e5b93f; }
.match-card.is-mandatory { background: #edf5ff; box-shadow: inset 3px 0 var(--blue); }
.match-card.is-conflicted { background: #fff0eb; box-shadow: inset 3px 0 var(--orange); }
.match-card.is-unavailable { background: #f7f8f7; color: #68736d; }
.match-card.is-unavailable:hover { background: #f7f8f7; box-shadow: none; }
.match-controls { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.match-check input { position: absolute; opacity: 0; }
.match-check span { display: block; width: 20px; height: 20px; border: 2px solid #a7b0ab; border-radius: 5px; cursor: pointer; }
.match-check input:checked + span { border-color: var(--deep-green); background: var(--deep-green); box-shadow: inset 0 0 0 4px #f2fae4; }
.match-check input:disabled + span { border-color: #cdd3cf; background: #e8ebe9; cursor: not-allowed; }
.mandatory-toggle { display: grid; place-items: center; width: 23px; height: 23px; padding: 0; color: #7d8982; background: white; border: 1px solid #b8c1bc; border-radius: 50%; font-size: 14px; font-weight: 800; cursor: pointer; }
.mandatory-toggle[aria-pressed="true"] { color: white; background: var(--blue); border-color: var(--blue); }
.mandatory-toggle:disabled { color: #adb5b0; background: #eef0ef; border-color: #d4d9d6; cursor: not-allowed; }
.is-conflicted .mandatory-toggle[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); }
.match-time { display: flex; flex-direction: column; gap: 2px; }
.match-time > strong { font: 800 20px Manrope, sans-serif; }
.match-time > span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.venue-focus { width: fit-content; margin-top: 5px; padding: 0; color: var(--deep-green); background: none; border: 0; border-bottom: 1px dotted var(--deep-green); font-size: 11px; font-weight: 700; cursor: pointer; }
.teams { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.teams > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.teams strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.teams small { color: var(--muted); font-size: 10px; padding-left: 29px; }
.team-dot { width: 21px; height: 21px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--deep-green); border-radius: 50%; color: var(--deep-green); font-size: 8px; font-style: normal; font-weight: 800; }
.team-dot.home { color: var(--ink); background: var(--green); border-color: var(--green); }
.match-travel, .match-status { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.match-travel strong { font: 800 15px Manrope, sans-serif; }
.match-travel span { color: var(--muted); font-size: 9px; }
.travel-placeholder { line-height: 1.25; }
.travel-missing { color: #a84d32; font-size: 9px; }
.badge { max-width: 105px; padding: 5px 7px; overflow: hidden; color: var(--deep-green); background: #edf5ef; border-radius: 5px; font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.badge-priority { color: #8e351b; background: #fff0e9; }
.badge-approved { color: #8d2f24; background: #ffebe7; }
.badge-pending { color: #765a0a; background: #fff5ce; }
.badge-scope { color: var(--deep-green); background: #e6efe8; }
.badge-outside-scope { color: #765a0a; background: #fff5ce; }
.unassigned { color: #929c96; font-size: 10px; }
.decision-explanation { width: 100%; margin-top: 3px; padding-top: 6px; border-top: 1px solid var(--line); }
.decision-explanation strong, .decision-explanation span { display: block; }
.decision-explanation strong { color: var(--deep-green); font-size: 9px; }
.decision-explanation span { margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.3; }
.decision-explanation.reason-time_conflict strong,
.decision-explanation.reason-missing_travel_time strong,
.decision-explanation.reason-scout_restriction strong,
.decision-explanation.reason-mandatory_conflict strong { color: #a84d32; }
.decision-explanation.reason-mandatory strong { color: var(--blue); }
.decision-explanation.reason-alternative_optimum strong { color: #9b7410; }
.empty-state { margin: 34px; padding: 42px 24px; text-align: center; background: #f7f9f6; border: 1px dashed #bdc8c0; border-radius: 14px; }
.empty-state span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.empty-state p { color: var(--muted); font-size: 13px; }
.empty-state code { display: inline-block; padding: 8px; color: var(--deep-green); background: #e7eee9; border-radius: 5px; }

.map-panel { position: relative; grid-column: 2; grid-row: 2; min-height: 400px; background: #dce5df; }
#map { width: 100%; height: 100%; z-index: 0; }
.map-overlay { position: absolute; z-index: 500; top: 18px; left: 18px; display: flex; flex-direction: column; gap: 3px; min-width: 220px; padding: 14px 16px; background: rgb(255 255 255 / 94%); border: 1px solid rgb(255 255 255 / 70%); border-radius: 10px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.map-overlay strong { font: 700 16px Manrope, sans-serif; }
.map-overlay small { color: var(--muted); font-size: 10px; }
.map-legend { position: absolute; z-index: 500; left: 18px; bottom: 20px; display: flex; gap: 14px; padding: 9px 12px; color: #526159; background: rgb(255 255 255 / 92%); border-radius: 8px; box-shadow: var(--shadow); font-size: 10px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; background: var(--deep-green); border-radius: 50%; }
.legend-dot.selected { background: var(--orange); }
.scout-marker { display: grid; place-items: center; width: 29px; height: 29px; color: white; background: var(--deep-green); border: 3px solid white; border-radius: 50% 50% 50% 10%; box-shadow: 0 4px 10px rgb(13 57 43 / 30%); transform: rotate(-45deg); font: 800 10px Manrope, sans-serif; }
.scout-marker span { transform: rotate(45deg); }
.scout-marker.is-selected { color: var(--ink); background: var(--orange); transform: rotate(-45deg) scale(1.18); }
.origin-marker { display: grid; place-items: center; width: 35px; height: 35px; color: var(--ink); background: var(--green); border: 4px solid var(--ink); border-radius: 50%; box-shadow: 0 5px 15px rgb(13 57 43 / 35%); font: 800 11px Manrope, sans-serif; }
.leaflet-popup-content-wrapper { border-radius: 8px; box-shadow: var(--shadow); }
.popup-match strong { display: block; margin-bottom: 4px; }
.popup-match span { color: var(--muted); font-size: 11px; }

.page-shell { min-height: calc(100vh - 78px); padding: 38px clamp(22px, 5vw, 72px) 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; max-width: 1280px; margin: 0 auto 38px; }
.page-heading h1 { margin-top: 7px; font-size: clamp(30px, 4vw, 48px); }
.page-heading p { margin: 9px 0 0; color: var(--muted); }
.page-heading .button { min-width: 190px; }
.routes-section { max-width: 1280px; margin: 0 auto 40px; }
.routes-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.routes-section-heading > div { display: flex; align-items: center; gap: 10px; }
.routes-section-heading h2 { margin: 0; font-size: 18px; }
.routes-section-heading > span { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; color: var(--deep-green); background: #e6efe8; border-radius: 20px; font-size: 11px; font-weight: 800; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-dot.approved { background: #cb4535; }
.status-dot.pending { background: #e0ae24; }
.routes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr)); gap: 18px; }
.route-overview-card { overflow: hidden; background: white; border: 1px solid var(--line); border-top: 3px solid #cb4535; border-radius: 14px; box-shadow: 0 12px 34px rgb(26 49 40 / 7%); }
.route-overview-card.is-pending { border-top-color: #e0ae24; }
.route-overview-card > header { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.route-scout-avatar { display: grid; place-items: center; width: 43px; height: 43px; color: var(--ink); background: var(--green); border-radius: 12px 4px 12px 4px; font: 800 16px Manrope, sans-serif; }
.route-overview-card header div:nth-child(2) { min-width: 0; }
.route-overview-card header span, .route-overview-card header small { display: block; color: var(--muted); font-size: 9px; }
.route-overview-card header h3 { overflow: hidden; margin: 2px 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.route-status { padding: 5px 7px; color: #8d2f24 !important; background: #ffebe7; border-radius: 5px; font-weight: 800; }
.is-pending .route-status { color: #765a0a !important; background: #fff5ce; }
.route-conflicts { display: flex; flex-direction: column; gap: 4px; padding: 11px 18px; color: #8d2f24; background: #fff0eb; border-bottom: 1px solid #ffd7ca; font-size: 9px; line-height: 1.4; }
.route-conflicts span { color: #a84d32; }
.route-scope-warnings { display: flex; flex-direction: column; gap: 4px; padding: 11px 18px; color: #765a0a; background: #fff5ce; border-bottom: 1px solid #eddc99; font-size: 9px; line-height: 1.4; }
.route-scope-warnings span { color: #89722e; }
.route-match-list { margin: 0; padding: 4px 18px; list-style: none; }
.route-match-list li { display: grid; grid-template-columns: 47px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf0ed; }
.route-match-list li:last-child { border-bottom: 0; }
.route-match-list time { display: flex; flex-direction: column; }
.route-match-list time strong { font: 800 15px Manrope, sans-serif; }
.route-match-list time span, .route-match-list li div > span, .route-match-list li div > small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.route-match-list li div > strong { font-size: 11px; }
.mandatory-chip { padding: 4px 6px; color: var(--blue); background: #edf5ff; border-radius: 5px; font-size: 8px; font-weight: 800; }
.route-overview-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 55px; padding: 10px 18px; color: var(--muted); background: #f8faf7; border-top: 1px solid var(--line); font-size: 9px; }
.route-overview-card footer .button { min-height: 34px; padding: 0 12px; }
.routes-empty { max-width: none; margin: 0; }
.routes-empty .button { width: fit-content; margin: 18px auto 0; padding: 0 18px; }
.profile-warning { max-width: 1280px; display: flex; flex-direction: column; gap: 3px; margin: -18px auto 30px; padding: 13px 16px; color: #765a0a; background: #fff5ce; border: 1px solid #eddc99; border-radius: 9px; font-size: 11px; }
.profile-warning span { color: #89722e; }
.coming-soon-page { min-height: calc(100vh - 78px); display: grid; place-items: center; padding: 30px; }
.coming-soon-page section { position: relative; width: min(620px, 100%); padding: 58px; overflow: hidden; text-align: center; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.coming-soon-mark { position: absolute; top: -28px; right: -8px; color: #ecf2ed; font: 800 150px Manrope, sans-serif; }
.coming-soon-page h1 { position: relative; margin-top: 10px; font-size: 36px; }
.coming-soon-page p { position: relative; margin: 14px auto 24px; color: var(--muted); line-height: 1.6; }
.development-chip { position: relative; display: block; width: fit-content; margin: 0 auto 22px; padding: 7px 11px; color: #765a0a; background: #fff5ce; border-radius: 20px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.coming-soon-page a { position: relative; color: var(--deep-green); font-size: 12px; font-weight: 700; }
.login-page { min-height: calc(100vh - 78px); display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 50% 20%, #e7f0e9, var(--paper) 48%); }
.login-card { width: min(430px, 100%); padding: 40px; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.login-brand-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 24px; color: var(--ink); background: var(--green); border-radius: 15px 5px 15px 5px; font: 800 17px Manrope, sans-serif; }
.login-card h1 { margin-top: 7px; font-size: 31px; }
.login-card > p { margin: 10px 0 25px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card label { margin-top: 5px; color: #65736c; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.login-card input { height: 46px; padding: 0 13px; color: var(--ink); background: #f8faf7; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.login-card input:focus { border-color: var(--deep-green); box-shadow: 0 0 0 3px rgb(23 77 59 / 10%); }
.login-card .button { margin-top: 12px; }
.login-card > small { display: block; margin-top: 20px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.login-error { margin-bottom: 12px; padding: 10px 12px; color: #8d2f24; background: #ffebe7; border-radius: 7px; font-size: 11px; }

.message-stack { position: fixed; z-index: 1200; top: 90px; right: 20px; width: min(420px, calc(100vw - 40px)); }
.app-message { margin-bottom: 8px; padding: 12px 14px; color: var(--deep-green); background: #edf5ef; border: 1px solid #c8dfcd; border-radius: 9px; box-shadow: var(--shadow); font-size: 11px; }
.app-message.error { color: #8d2f24; background: #ffebe7; border-color: #efc2bc; }
.app-message.info { color: #765a0a; background: #fff5ce; border-color: #eddc99; }
.documents-page { min-height: calc(100vh - 78px); padding: 34px clamp(18px, 4vw, 58px) 60px; }
.documents-heading { max-width: 1440px; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(520px, 1.2fr); gap: 42px; align-items: end; margin: 0 auto 30px; }
.documents-heading h1 { margin-top: 5px; font-size: 42px; }
.documents-heading p { max-width: 620px; margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.document-upload { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; align-items: end; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 22px rgb(26 49 40 / 6%); }
.document-upload > div { min-width: 0; }
.document-upload label, .proposal-fields label { display: flex; flex-direction: column; gap: 4px; color: #65736c; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.document-upload input[type="file"], .document-upload textarea, .document-field { width: 100%; min-height: 38px; padding: 8px 9px; color: var(--ink); background: #f8faf7; border: 1px solid var(--line); border-radius: 7px; font-size: 10px; }
.document-upload textarea { height: 38px; resize: vertical; }
.document-upload small { grid-column: 1 / -1; color: var(--muted); font-size: 8px; }
.document-upload .errorlist, .proposal-errors .errorlist { margin: 4px 0 0; padding: 0; color: #a84d32; font-size: 9px; list-style: none; }
.documents-layout { max-width: 1440px; display: grid; grid-template-columns: 275px minmax(0, 1fr); min-height: 580px; margin: 0 auto; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.document-list { background: #f8faf7; border-right: 1px solid var(--line); }
.document-list > header { display: flex; align-items: center; justify-content: space-between; padding: 17px; border-bottom: 1px solid var(--line); font-size: 11px; }
.document-list > header span { display: grid; place-items: center; min-width: 25px; height: 25px; background: #e6efe8; border-radius: 20px; font-size: 9px; }
.document-list-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; padding: 14px 15px; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.document-list-item:hover, .document-list-item.is-active { background: white; box-shadow: inset 3px 0 var(--green); }
.document-list-item > span:last-child { min-width: 0; }
.document-list-item strong, .document-list-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-list-item strong { font-size: 10px; }
.document-list-item small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.document-icon { display: grid; place-items: center; width: 38px; height: 38px; color: var(--deep-green); background: #e6efe8; border-radius: 9px; font-size: 8px; font-weight: 800; }
.document-list-empty { padding: 28px 17px; color: var(--muted); font-size: 10px; text-align: center; }
.document-review { min-width: 0; padding: 24px; }
.document-review-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.document-review-heading h2 { margin-top: 4px; font-size: 22px; }
.document-review-heading p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.document-actions { display: flex; gap: 7px; }
.document-actions form { margin: 0; }
.document-actions .button { min-width: 105px; padding: 0 12px; }
.document-error { display: flex; flex-direction: column; gap: 4px; margin: 16px 0; padding: 12px; color: #8d2f24; background: #ffebe7; border-radius: 8px; font-size: 10px; }
.proposal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 14px; margin-top: 18px; }
.proposal-card { overflow: hidden; border: 1px solid var(--line); border-top: 3px solid #e0ae24; border-radius: 11px; }
.proposal-card.status-ready { border-top-color: var(--deep-green); }
.proposal-card.status-rejected { opacity: .72; border-top-color: #adb5b0; }
.proposal-card > header { display: flex; justify-content: space-between; gap: 12px; padding: 13px 14px; background: #f8faf7; border-bottom: 1px solid var(--line); }
.proposal-card header strong, .proposal-card header small { display: block; }
.proposal-card header strong { margin-top: 3px; font-size: 11px; }
.proposal-card header small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.proposal-position { color: var(--deep-green); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.confidence-chip { flex: 0 0 auto; height: fit-content; padding: 4px 6px; color: var(--deep-green); background: #e6efe8; border-radius: 12px; font-size: 8px; font-weight: 800; }
.proposal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
.proposal-fields label:has(select[multiple]), .discard-field { grid-column: 1 / -1; }
.document-field { font-size: 9px; }
.discard-field { flex-direction: row !important; align-items: center; }
.discard-field input { width: auto; min-height: auto; }
.proposal-warnings { margin: 10px 14px 0; padding: 9px 9px 9px 25px; color: #765a0a; background: #fff5ce; border-radius: 6px; font-size: 8px; }
.proposal-missing { margin: 10px 14px 0; color: #a84d32; font-size: 9px; }
.proposal-errors { margin: 10px 14px 0; color: #a84d32; font-size: 9px; }
.proposal-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
.proposal-summary div { min-width: 0; }
.proposal-summary dt { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.proposal-summary dd { margin: 3px 0 0; font-size: 10px; }
.review-actions { display: flex; justify-content: flex-end; margin-top: 15px; }
.review-actions .button { min-width: 170px; }
.locked-proposals { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.locked-proposals h3 { font-size: 14px; }
.locked-proposals > div { display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0ed; font-size: 9px; }
.locked-proposals span, .locked-proposals small { color: var(--muted); }
.import-ready-action { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 16px; color: white; background: var(--deep-green); border-radius: 10px; }
.import-ready-action strong, .import-ready-action small { display: block; }
.import-ready-action small { margin-top: 3px; color: #b7cabf; font-size: 8px; }
.import-ready-action .button { width: auto; min-width: 190px; padding: 0 14px; }
.document-welcome { margin-top: 90px; }

@media (max-width: 1050px) {
  .main-nav a { padding-inline: 9px; }
  .workspace { height: auto; grid-template-columns: 1fr; grid-template-rows: auto; }
  .prepare-panel { grid-column: 1; grid-template-columns: 120px minmax(0, 1fr); }
  .filter-form { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .route-card { grid-column: 1 / -1; max-height: 220px; }
  .schedule { grid-column: 1; grid-row: auto; border-right: 0; }
  .map-panel { grid-column: 1; grid-row: auto; height: 480px; }
  .schedule { height: calc(100vh - 78px); min-height: 620px; }
  .documents-heading { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 700px) {
  .topbar { height: 68px; padding: 0 16px; }
  .topbar-copy { display: none; }
  .brand > span:last-child { display: none; }
  .main-nav { flex: 1; justify-content: center; }
  .main-nav a { padding-inline: 7px; font-size: 10px; }
  .main-nav a.is-active::after { right: 7px; left: 7px; }
  .admin-link { font-size: 0; }
  .admin-link span { font-size: 18px; }
  .user-identity { display: none; }
  .user-menu { margin-left: 0; gap: 8px; }
  .logout-button { padding-left: 8px; }
  .workspace { display: flex; flex-direction: column; }
  .prepare-panel { display: flex; flex-direction: column; gap: 16px; padding: 20px 16px; }
  .panel-heading { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .filter-form { grid-template-columns: 1fr 1fr; }
  .filter-field-origin, .filter-field-scout { grid-column: 1 / -1; }
  .route-card { display: block; max-height: 260px; }
  .schedule { height: auto; min-height: 500px; }
  .section-head { height: 82px; padding: 0 16px; }
  .schedule-actions { align-items: flex-end; flex-direction: column-reverse; gap: 5px; }
  h2 { font-size: 21px; }
  .match-columns { display: none; }
  .match-card { grid-template-columns: 42px 84px 1fr; min-height: 112px; padding: 14px 12px; }
  .match-travel { grid-column: 2; }
  .match-status { grid-column: 3; flex-direction: row; flex-wrap: wrap; }
  .match-time > strong { font-size: 17px; }
  .map-panel { height: 330px; flex: 0 0 auto; }
  .map-overlay { top: 12px; left: 12px; min-width: 200px; }
  .page-shell { min-height: calc(100vh - 68px); padding: 28px 16px 50px; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 28px; }
  .page-heading .button { width: 100%; }
  .coming-soon-page { min-height: calc(100vh - 68px); padding: 16px; }
  .coming-soon-page section { padding: 42px 22px; }
  .coming-soon-page h1 { font-size: 28px; }
  .login-page { min-height: calc(100vh - 68px); padding: 16px; }
  .login-card { padding: 30px 22px; }
  .documents-page { min-height: calc(100vh - 68px); padding: 22px 12px 40px; }
  .documents-heading h1 { font-size: 32px; }
  .document-upload { grid-template-columns: 1fr; }
  .document-upload small { grid-column: 1; }
  .documents-layout { display: block; }
  .document-list { max-height: 230px; overflow-y: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .document-review { padding: 17px; }
  .document-review-heading, .import-ready-action { align-items: stretch; flex-direction: column; }
  .document-actions .button, .import-ready-action .button { width: 100%; }
  .proposal-fields { grid-template-columns: 1fr; }
  .proposal-fields label:has(select[multiple]), .discard-field { grid-column: 1; }
}
