* { box-sizing: border-box; }
body { margin: 0; background: #fff; color: #222; font: 14px Arial, sans-serif; }
header { padding: 16px 24px; border-bottom: 1px solid #bbb; background: #f3f3f3; }
header a { color: #222; font-size: 20px; font-weight: bold; text-decoration: none; }
main { max-width: 1250px; margin: auto; padding: 20px; }
h2 { font-size: 17px; margin: 0 0 8px; }
p { line-height: 1.5; margin: 8px 0; }
.workspace { display: block; }
.summary { margin-top: 20px; }
.workspace > *, .right-column { min-width: 0; }
.panel { padding: 16px; border: 1px solid #bbb; background: #fff; }
.section-heading { margin-bottom: 16px; }
.inputs .section-heading { margin-bottom: 8px; }
.inputs fieldset { padding: 8px; margin-bottom: 8px; }
.inputs .help { margin-top: 4px; }
.inputs .tier-options { margin-top: 8px; }
.inputs button { margin-top: 4px; }
.tier-row { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.section-heading p, .help { color: #555; font-size: 12px; }
fieldset { margin: 0 0 16px; padding: 12px; border: 1px solid #ccc; min-width: 0; }
legend { padding: 0 5px; font-weight: bold; font-size: 13px; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-size: 13px; }
input[type="text"], textarea { width: 100%; padding: 7px; margin-top: 5px; border: 1px solid #999; border-radius: 0; background: #fff; color: #222; font: inherit; }
textarea { font: 13px/1.5 monospace; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid #245caa; outline-offset: 2px; }
.tier-options label { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.tier-options input { margin: 0; width: 15px; height: 15px; }
.tier-options strong { font-weight: normal; }
.tier-config { padding: 8px; border: 1px solid #ddd; min-width: 200px; flex: 1; }
.tier-options .tier-select { padding: 0 0 6px; }
.tier-fields { display: flex; gap: 12px; }
.tier-options .tier-fields label { display: block; padding: 0; flex: 1; }
.tier-options .tier-fields input[type="number"] { display: block; width: 100%; min-width: 75px; height: auto; margin-top: 4px; padding: 7px; border: 1px solid #999; border-radius: 0; font: inherit; background: #fff; color: #222; }
.tier-options small { margin-left: 8px; color: #555; }
.trail-label { font-weight: bold; }
.trail-label span { font-weight: normal; color: #555; margin-left: 8px; }
.help { line-height: 1.5; margin: 8px 0 0; }
form button { padding: 8px 18px; margin-top: 14px; border: 1px solid #888; border-radius: 2px; background: #eee; color: #111; font: bold 14px Arial, sans-serif; cursor: pointer; }
form button:hover { background: #ddd; }
.right-column { display: grid; gap: 20px; }
.formula { padding: 10px; background: #f5f5f5; border: 1px solid #ddd; }
.formula span { display: block; margin-bottom: 5px; font-size: 12px; }
.formula strong { font-size: 13px; }
.rule { margin: 16px 0; }
.rule strong { font-size: 13px; }
.rule p, .note { font-size: 12px; }
.rule .dot { display: none; }
.note { border-top: 1px solid #ddd; padding-top: 10px; color: #555; }
.metrics { display: flex; flex-wrap: wrap; gap: 18px; }
.metrics span { display: block; font-size: 12px; margin-bottom: 5px; }
.metrics strong { font-size: 18px; }
.metrics small { font-size: 12px; font-weight: normal; }
.results { margin-top: 20px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; white-space: nowrap; }
th, td { padding: 8px; border: 1px solid #ccc; }
th { background: #eee; }
tbody tr:nth-child(even) { background: #fafafa; }
td small { display: block; margin-top: 4px; font-size: 11px; color: #555; }
.badge { font-weight: bold; }
.normal { color: #21632d; }
.flag { color: #9a4d00; }
.raise { color: #a11724; }
.waiting { color: #555; }
.suppressed { color: #555; }
.result-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.result-filters select { display: block; min-width: 150px; padding: 7px; margin-top: 5px; font: inherit; border: 1px solid #999; background: #fff; color: #222; }
.result-filters button { padding: 7px 12px; cursor: pointer; }
.dt-container { width: 100%; font-size: 13px; }
.dt-container .dt-layout-row { gap: 10px; flex-wrap: wrap; }
.dt-container .dt-input { padding: 6px; border: 1px solid #999; background: #fff; color: #222; }
.dt-container .dt-search input { width: auto; max-width: 100%; }
.dt-container .dt-paging button { cursor: pointer; }
.result-filters [data-filter-count] { font-size: 12px; color: #555; padding-bottom: 7px; }
pre { max-width: 100%; overflow-x: auto; }
.error { padding: 10px; border: 1px solid #b42b2b; background: #fff4f4; color: #8b1414; margin-bottom: 14px; }
footer { color: #666; font-size: 11px; border-top: 1px solid #ddd; margin-top: 20px; padding-top: 12px; }
.map-panel { margin-bottom: 20px; }
#trip-map { height: 400px; background: #eee; z-index: 0; border: 1px solid #bbb; }
#map-fallback { padding: 16px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; font-size: 12px; }
.map-legend span { display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.green { background: #087660; }.red { background: #c34334; }.destination { background: #6845a1; }.trail { background: #167c99; }
.map-popup { white-space: pre-line; line-height: 1.6; }
@media (max-width: 700px) {
    header { padding: 14px; }
    main { padding: 12px; }
    .workspace { grid-template-columns: 1fr; gap: 12px; }
    .right-column { gap: 12px; }
    .panel { padding: 12px; }
    .tier-options small { display: block; margin: 3px 0 0; }
    #trip-map { height: 320px; }
}
.examples { margin-bottom: 12px; }
.examples > strong { display: block; font-size: 13px; margin-bottom: 6px; }
.example-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid #aaa; }
.example-tabs button { padding: 8px 14px; border: 1px solid #aaa; border-bottom: 0; background: #f3f3f3; color: #222; font: 13px Arial, sans-serif; cursor: pointer; }
.example-tabs button[aria-pressed="true"] { background: #ddd; font-weight: bold; }
[hidden] { display: none !important; }

.map-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.map-heading h2 { margin: 0; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; }
body.map-is-expanded { overflow: hidden; }
.map-panel.map-expanded { position: fixed; inset: 0; z-index: 10000; box-sizing: border-box; margin: 0; padding: 16px; background: white; display: flex; flex-direction: column; }
.map-panel.map-expanded #trip-map { flex: 1; min-height: 0; height: auto; }
.map-panel.map-expanded .map-legend { flex-shrink: 0; }
