
:root { --panel-w: 380px; --fab-size: 44px; }
html, body { height: 100%; margin: 0; }
body {
  background:#fafafa;
  padding:0;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
.curve-app {
  flex:1;
  display:flex;
  min-height:0;
}
.curve-app .wrap {
  flex:1;
  display:grid;
  grid-template-columns: var(--panel-w) 1fr;
  min-height:0;
  height:100%;
}
.panel, .input-stack, .card { min-width:0; }
.panel [hidden] { display:none !important; }
.panel select { width:100%; min-width:0; }
.rcoc-sizing-input { min-width:0; margin:18px 0 0; padding:12px; border:1px solid #cbd5df; border-radius:8px; background:#f7f9fb; }
.rcoc-sizing-input legend { padding:0 5px; font-size:13px; font-weight:600; color:#344b60; }
.rcoc-sizing-input select { margin:6px 0 8px; }
.roadway-definition { color:#526575; line-height:1.45; }
.roadway-definition summary { cursor:pointer; color:#1f78b4; padding:6px 0; font-weight:600; }
.roadway-definition p { margin:8px 0; }
.panel .step-title { display:flex; align-items:center; gap:9px; margin:0 0 14px; text-align:left; font-size:1rem; color:#243b53; opacity:1; }
.step-number { display:inline-flex; align-items:center; justify-content:center; flex:0 0 26px; height:26px; border-radius:50%; background:#1f78b4; color:#fff; font-size:13px; }
.section-instructions, .section-results { border-top:1px solid #dce3e9; padding-top:18px; }
.layout-comparison { background:#fff7e6; border-left:3px solid #d68b00; padding:10px 12px; font-size:13px; line-height:1.5; }
.primary-action { background:#1f78b4; color:#fff; border-color:#1f78b4; }
.primary-action:hover { background:#185f8f; }
.result-summary { border:1px solid #c9dce9; border-radius:10px; padding:12px; background:#f5faff; }
.summary-method { color:#47667c; font-size:12px; margin-bottom:10px; }
.panel .results-subheading { margin:0 0 8px; font-size:16px; color:#243b53; }
.status-key { font-size:12px; line-height:1.5; color:#526575; margin:0 0 12px; }
.treatment-list { display:grid; gap:8px; }
.treatment-card { display:grid; grid-template-columns:56px minmax(0,1fr); gap:12px; padding:12px 10px; border:1px solid #d7e0e7; border-radius:8px; background:#fff; }
.treatment-picture { display:flex; flex-direction:column; align-items:center; gap:4px; padding-top:2px; }
.panel .treatment-picture .sign-image { width:56px; height:56px; }
.treatment-card[data-treatment="delineators"] { grid-template-columns:80px minmax(0,1fr); }
.panel .delineator-preview .sign-image { width:80px; height:auto; border-radius:3px; }
.delineator-preview { display:block; text-align:center; font-size:11px; line-height:1.5; }
.delineator-preview span { display:block; margin-top:4px; }
.delineator-preview:focus-visible { outline:2px solid #1f78b4; outline-offset:3px; }
.treatment-body h4 { margin:0 0 6px; font-size:14px; color:#243b53; line-height:1.35; }
.treatment-status { display:inline-block; padding:3px 8px; border-radius:4px; font-size:12px; font-weight:700; line-height:1.4; }
.status-required { color:#922329; background:#fce8e8; }
.status-recommended { color:#175085; background:#e5f0fb; }
.status-optional { color:#5a4282; background:#efe9fa; }
.status-neutral { color:#4e5e68; background:#edf1f4; }
.treatment-detail { margin-top:7px; font-size:12px; font-weight:600; line-height:1.4; }
.treatment-body p { margin:5px 0 0; color:#526575; font-size:12px; line-height:1.45; }
.treatment-explanation { margin:8px 0 16px; font-size:12px; line-height:1.5; }
.treatment-explanation summary { cursor:pointer; padding:8px 0; color:#1f78b4; font-weight:600; }
.panel .layout-heading { border-top:1px solid #c9dce9; padding-top:16px; }
.summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 12px; margin:14px 0 0; }
.summary-grid > div { min-width:0; }
.summary-grid dt { font-size:12px; color:#526575; margin-bottom:4px; }
.summary-grid dd { margin:0; font-size:15px; font-weight:600; line-height:1.4; }
.summary-grid small { display:block; margin-top:3px; font-size:11px; color:#526575; }
.summary-wide { grid-column:1 / -1; }
.summary-wide dd, .summary-pending { font-size:13px; }
.calculation-details { margin-top:12px; }
.calculation-details > summary { cursor:pointer; padding:12px 0; font-weight:600; font-size:14px; }
.method-card { margin:0 0 14px; background:#eef5fb; }
.method-card label, .method-card output { display:block; }
.method-card output { font-weight:600; margin-bottom:6px; }
.method-toggle { border:0; padding:0; margin:0 0 12px; min-width:0; }
.method-toggle-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px; border:1px solid #bdcddd; border-radius:12px; background:#e6edf4; }
.method-choice { position:relative; margin:0; cursor:pointer; }
.method-choice input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.method-choice span { display:flex; align-items:center; justify-content:center; min-height:44px; border-radius:8px; font-size:14px; font-weight:600; color:#344b60; }
.method-choice input:checked + span { background:#1f78b4; color:#fff; box-shadow:0 1px 3px rgba(0,0,0,.15); }
.method-choice input:focus-visible + span { outline:3px solid #111; outline-offset:2px; }
.method-choice input:hover:not(:checked) + span { background:#d7e3ed; }
.layout-options { margin-top:14px; }
.layout-options summary, .reference-details summary { cursor:pointer; padding:8px 0; font-weight:600; }
.check-label { display:flex; align-items:flex-start; gap:8px; margin:12px 0; line-height:1.4; }
.check-label input { flex-shrink:0; margin-top:3px; }
.source-link { display:block; font-size:0.8rem; margin:5px 0 10px; }
.source-link, .section-reference a { color:#1f78b4; overflow-wrap:anywhere; }
.reference-details { margin:10px 0; border-top:1px solid #ddd; }
.reference-details img { width:100%; height:auto; display:block; margin:8px 0; }
.reference-details p { font-size:0.85rem; line-height:1.4; }
.layout-note { font-size:0.85rem; line-height:1.4; margin:8px 0; }
.panel a:focus-visible, .panel input:focus-visible, .panel select:focus-visible, .panel summary:focus-visible { outline:2px solid #1f78b4; outline-offset:2px; }
  #map { width: 100%; height: 100%; isolation:isolate; }
  .panel {
    padding: 14px; overflow:auto; border-right: 1px solid #ddd;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background:#fff;
  }
  h1 { font-size: 1.1rem; margin: 0 0 10px; }
  h2 {
    font-size: 0.95rem;
    margin: 6px 0 10px;
    color: #444;
    font-weight: 600;
    letter-spacing: 0.2px;
    opacity: 0.95;
  }
  .small { color:#555; font-size: 0.9rem; }
.row {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap:8px;
  margin-top:10px;
}
.row > * {
  width:100%;
}
button, select {
    padding:10px 12px; border:1px solid #aaa; border-radius:10px; background:#fff;
    min-height:44px; font: 500 14px/1.2 inherit; cursor:pointer;
  }
input[type="number"] {
  width:100%;
  padding:10px 12px;
  border:1px solid #aaa;
  border-radius:10px;
  background:#fff;
  min-height:44px;
  font:500 14px/1.2 inherit;
  box-sizing:border-box;
  cursor:text;
}
  button:hover { background:#f3f3f3; }
  label { font-size: 13px; color:#333; }
  .stat { margin:4px 0; font-variant-numeric: tabular-nums; }
  .warn { color:#b00; font-weight:600; }
  .muted { color:#666; }
  .callout {
    background:#fff7e6; border:1px solid #ffd699; padding:8px 10px;
    border-radius:10px; margin:8px 0; line-height:1.35;
  }
  .callout .big { font-size: 1.05rem; }
  .num-marker {
    width:26px; height:26px; border-radius:50%; background:#fff; border:2px solid #111; color:#111;
    display:flex; align-items:center; justify-content:center; font:600 13px/1 system-ui, sans-serif;
    box-shadow:0 1px 3px rgba(0,0,0,.35); user-select:none;
  }
  .num-marker.dragging { opacity:.6; transform: scale(1.06); }
.leaflet-pane.chevrons-pane { z-index:650; }
.leaflet-pane.advance-pane  { z-index:660; }
.leaflet-pane.delineators-pane { z-index:645; pointer-events:none; }
.streetview-popup .leaflet-popup-content {
  margin:8px 10px;
}
.streetview-menu {
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:180px;
}
.streetview-menu .menu-title {
  font-weight:600;
  font-size:0.95rem;
}
.streetview-btn {
  background:#1a73e8;
  color:#fff;
  border:none;
  border-radius:6px;
  padding:8px 10px;
  font-size:0.9rem;
  cursor:pointer;
  transition:background 0.15s ease;
}
.streetview-btn:hover,
.streetview-btn:focus {
  background:#1558b0;
  outline:none;
}
.streetview-menu .coords {
  font-size:0.75rem;
  color:#607d8b;
}
#locateBtn.busy,
#locateBtn:disabled {
  opacity:0.65;
  cursor:progress;
}
#locateBtn {
  white-space:nowrap;
}
.grp {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap:8px;
  margin:8px 0 4px;
}
.grp > * { min-width:0; }
.grp-1 { display:grid; grid-template-columns: 1fr; gap:8px; }
.fab {
    position: fixed; left:12px; top: calc(env(safe-area-inset-top, 0) + 12px);
    width: var(--fab-size); height: var(--fab-size);
    border-radius:12px; background:#fff; border:1px solid #bbb;
    display:none; align-items:center; justify-content:center;
    box-shadow:0 2px 8px rgba(0,0,0,.25); z-index:1000;
  }
  .fab span { font-size:20px; line-height:1; }
  .closeRow { display:none; justify-content:flex-end; }
  .closeBtn { padding:8px 10px; min-height:36px; border-radius:8px; }
  @media (max-width: 900px) {
    .curve-app .wrap { grid-template-columns: 1fr; grid-template-rows: 1fr; height: 100%; }
    .panel {
      position: fixed; left:0; right:0; top:0; max-height:74vh;
      transform: translateY(calc(-100% - 12px)); transition: transform .25s ease;
      border-right:none; border-bottom:1px solid #ddd; box-shadow:0 6px 24px rgba(0,0,0,.18);
      padding-top: calc(14px + env(safe-area-inset-top, 0)); z-index:900;
    }
    .panel.open { transform: translateY(0); }
    .fab { display:flex; }
    .closeRow { display:flex; }
  }

.section{margin:10px 0}.section + .section{margin-top:12px}

.card{margin-top:10px;padding:10px;border:1px solid #e0e0e0;border-radius:10px;background:#fff}

/* Highlight advisory speed dropdown */
#advisorySel { background-color: #fff59d; }

/* Keep the close control clear of the method toggle and inputs. */
.panel-open .fab { top:auto; bottom:calc(env(safe-area-inset-bottom, 0px) + 12px); left:auto; right:12px; }

.instructions-header { display:flex; align-items:center; justify-content:flex-start; gap:12px; }
.instructions-header h2 { margin:0; font-size:1rem; }
.instructions-toggle {
  padding:10px 12px;
  border-radius:10px;
  min-height:44px;
  font:500 14px/1.2 inherit;
  cursor:pointer;
}
.instructions-toggle:focus-visible { outline:2px solid #1f78b4; outline-offset:2px; }
.instructions-body { margin-top:10px; font-size:13px; color:#333; }
.section-instructions ul { margin:0; padding-left:18px; }
.section-instructions li { margin:4px 0; line-height:1.35; }
.section-instructions .instructions-body[hidden] { display:none !important; }
.card-title { font-weight:600; margin-bottom:6px; }

@media (max-width: 900px) {
  .section-instructions .instructions-body { display:none; }
  .section-instructions.open .instructions-body { display:block; }
}
.speeds-card { margin-top:12px; }
.speeds-card .grp { margin-top:8px; }
.input-stack {
  margin-top:12px;
  display:grid;
  gap:6px;
}
.input-divider {
  margin:16px 0 12px;
  border:0;
  border-top:1px solid #e0e0e0;
}
.small-note {
  font-size:0.85rem;
}
.small-note a {
  color:#1f78b4;
}
.need-list {
  margin-top:4px;
  display:grid;
  gap:3px;
}
.need-item {
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.need-item.selected {
  background:#eaf2ff;
  border-radius:6px;
  padding:2px 6px;
}
.card-diagnostics {
  margin-top:6px;
}
.card-diagnostics:empty {
  display:none;
  padding:0;
  border:none;
}
.need-item.selected .need-road {
  font-weight:600;
}
.need-road {
  flex:1 1 220px;
}
.need-status {
  font-weight:600;
}
.need-status.need-required { color:#c62828; }
.need-status.need-recommended { color:#ef6c00; }
.need-status.need-optional { color:#546e7a; }
.delineator-dot {
  stroke:#90a4ae;
  stroke-width:1.2;
  fill:#fff;
}

.sign-heading { display:flex; align-items:center; gap:10px; }
.panel .sign-image { display:block; flex:none; width:64px; height:64px; object-fit:contain; margin:0; }
.panel .title-sign { width:40px; height:40px; }
.section-chevron-sizing .sign-image { width:48px; height:48px; }
.sign-credit { border-top:1px solid #ddd; padding-top:12px; line-height:1.5; }

.map-legend {
  width:230px;
  max-width:calc(100vw - 80px);
  max-height:60vh;
  overflow:auto;
  box-sizing:border-box;
  background:#fff;
  color:#333;
  border:1px solid #ccc;
  border-radius:10px;
  box-shadow:0 2px 8px rgba(0,0,0,.2);
  font:13px/1.4 system-ui, sans-serif;
}
.map-legend > summary { padding:12px; font-weight:650; cursor:pointer; }
.map-legend summary:focus-visible { outline:2px solid #1f78b4; outline-offset:-3px; }
.map-legend-body { padding:0 12px 12px; }
.map-legend ul { list-style:none; margin:0; padding:0; }
.map-legend li { display:flex; align-items:center; gap:9px; margin:8px 0; }
.map-legend p { font-size:12px; color:#555; margin:12px 0; }
.legend-geometry { border-top:1px solid #e0e0e0; }
.legend-geometry summary { padding:10px 0 2px; cursor:pointer; font-weight:600; }
.legend-symbol { position:relative; display:inline-block; flex:0 0 30px; height:18px; }
.legend-symbol::before, .legend-symbol::after { content:''; position:absolute; box-sizing:border-box; }
.legend-chevron::before { left:12px; top:1px; height:16px; border-left:6px solid #ff9800; border-radius:3px; }
.legend-delineator::before { left:11px; top:5px; width:8px; height:8px; border:1.2px solid #90a4ae; border-radius:50%; background:#fff; }
.legend-warning::before { left:0; right:0; top:7px; border-top:4px dashed #7b1fa2; }
.legend-warning::after { right:0; top:2px; height:14px; border-left:5px solid #7b1fa2; }
.legend-point { height:22px; text-align:center; font-size:12px; font-weight:600; line-height:22px; color:#111; }
.legend-point::before { inset:0 4px; border:2px solid #111; border-radius:50%; }
.legend-curve::before, .legend-tangent::before, .legend-extension::before, .legend-chord::before, .legend-segments::before { left:0; right:0; top:8px; border-top:3px solid #1f78b4; }
.legend-circle::before { left:6px; top:0; width:18px; height:18px; border:1px solid #1f78b4; border-radius:50%; }
.legend-circle::after { left:13px; top:7px; width:4px; height:4px; border-radius:50%; background:#1f78b4; }
.legend-tangent::before { border-color:#111; }
.legend-tangent::after { left:12px; top:5px; width:8px; height:8px; background:#fff; border:2px solid #111; border-radius:50%; }
.legend-extension::before { border-top:5px solid #e53935; }
.legend-chord::before { border-top:2px dashed #333; }
.legend-segments::before { border-top:2px solid #666; }
