.tfe-estimator {
  --tfe-navy: #071a36;
  --tfe-red: #e30620;
  --tfe-red-dark: #bd061b;
  --tfe-off: #f7f8fa;
  --tfe-border: #dfe4ea;
  --tfe-text: #172033;
  --tfe-muted: #5e6673;
  margin: 2rem 0 4rem;
  color: var(--tfe-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tfe-app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding: 1.6rem 1.8rem;
  background: var(--tfe-navy);
  color: #fff;
  border-bottom: 3px solid var(--tfe-red);
}

.tfe-app-header h1 {
  margin: 0.1rem 0 0.35rem;
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.tfe-app-header p {
  margin: 0;
  max-width: 760px;
  color: #dce5ef;
}

.tfe-estimator .tfe-eyebrow {
  margin: 0;
  color: #ff5062;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tfe-form .tfe-eyebrow {
  color: var(--tfe-red);
}

.tfe-header-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.tfe-header-badges span {
  padding: 0.4rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tfe-app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 260px;
  min-height: 650px;
  border: 1px solid var(--tfe-border);
  border-top: 0;
  background: var(--tfe-off);
}

.tfe-controls {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: linear-gradient(180deg, var(--tfe-navy), #06162c);
  color: #fff;
}

.tfe-step {
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tfe-step:first-child {
  padding-top: 0.25rem;
}

.tfe-step:last-child {
  border: 0;
}

.tfe-step-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tfe-step-title > span {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--tfe-red);
  font-weight: 800;
}

.tfe-step-title strong {
  font-size: 0.9rem;
}

.tfe-help {
  margin: 0.35rem 0 0.8rem;
  color: #c4cfdd;
  font-size: 0.82rem;
  line-height: 1.5;
}

.tfe-field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.tfe-field > span,
.tfe-field > label,
.tfe-small-label {
  color: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tfe-controls .tfe-field > span,
.tfe-controls .tfe-field > label {
  color: #cbd5e1;
}

.tfe-field input,
.tfe-field select,
.tfe-field textarea {
  width: 100%;
  padding: 0.72rem 0.78rem;
  border: 1px solid var(--tfe-border);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--tfe-text);
  font: inherit;
}

.tfe-field input:focus,
.tfe-field select:focus,
.tfe-field textarea:focus {
  border-color: var(--tfe-red);
  box-shadow: 0 0 0 3px rgba(227, 6, 32, 0.12);
}

.tfe-search-row {
  display: flex;
  gap: 0.4rem;
}

.tfe-search-row input {
  min-width: 0;
}

.tfe-search-button {
  flex: none;
  padding: 0 0.85rem;
  border: 0;
  border-radius: 7px;
  background: var(--tfe-red);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.tfe-search-button:hover {
  background: var(--tfe-red-dark);
}

.tfe-search-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.tfe-stack {
  display: grid;
  gap: 0.55rem;
}

.tfe-action {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.tfe-action > span {
  min-width: 1.2rem;
  font-size: 1.15rem;
  text-align: center;
}

.tfe-action:hover,
.tfe-action.is-active {
  border-color: var(--tfe-red);
  background: rgba(227, 6, 32, 0.12);
}

.tfe-action:disabled {
  opacity: 0.4;
  cursor: default;
}

.tfe-action:disabled:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: transparent;
}

.tfe-action-primary {
  border-color: var(--tfe-red);
  background: var(--tfe-red);
}

.tfe-action-primary:hover,
.tfe-action-primary.is-active {
  background: var(--tfe-red-dark);
}

.tfe-gate-button {
  margin-top: 0.75rem;
}

.tfe-map-wrap {
  position: relative;
  isolation: isolate;
  min-width: 0;
  background: #d7dde3;
}

.tfe-map {
  height: 100%;
  min-height: 650px;
  background: #d7dde3;
  font-family: inherit;
}

.tfe-map.is-drawing,
.tfe-map.is-drawing .leaflet-interactive,
.tfe-map.is-gating,
.tfe-map.is-gating .leaflet-interactive {
  cursor: crosshair;
}

.tfe-map-status {
  position: absolute;
  left: 1rem;
  bottom: 1.6rem;
  z-index: 1000;
  max-width: min(540px, calc(100% - 2rem));
  padding: 0.58rem 0.8rem;
  border-radius: 6px;
  background: rgba(7, 26, 54, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.tfe-map-status.is-gate-mode {
  background: rgba(227, 6, 32, 0.95);
}

.tfe-summary {
  align-self: start;
  margin: 1rem;
  overflow: hidden;
  border: 1px solid var(--tfe-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 9px 28px rgba(7, 26, 54, 0.12);
}

.tfe-summary-heading {
  margin: 0;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--tfe-border);
  color: var(--tfe-red);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tfe-summary-main {
  padding: 1.15rem 1.1rem;
}

.tfe-summary-main > span {
  display: block;
  color: var(--tfe-muted);
  font-size: 0.82rem;
}

.tfe-summary-main strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--tfe-navy);
  font-size: 2rem;
}

.tfe-summary-list {
  margin: 0;
  padding: 0 1.1rem;
}

.tfe-summary-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0;
  border-top: 1px solid var(--tfe-border);
}

.tfe-summary-list dt {
  color: var(--tfe-muted);
  font-size: 0.8rem;
}

.tfe-summary-list dd {
  margin: 0;
  color: var(--tfe-navy);
  font-weight: 850;
}

.tfe-summary > .tfe-field,
.tfe-gate-list-wrap {
  margin: 1rem 1.1rem;
}

.tfe-summary .tfe-field > span,
.tfe-small-label {
  color: var(--tfe-muted);
}

.tfe-gate-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.tfe-gate-list em {
  color: #88909b;
  font-size: 0.78rem;
}

.tfe-gate-list-item {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border-radius: 5px;
  background: var(--tfe-off);
  font-size: 0.76rem;
}

.tfe-gate-list-item span {
  color: var(--tfe-muted);
}

.tfe-gate-list-item strong {
  color: var(--tfe-navy);
  font-size: 0.74rem;
}

.tfe-review-button {
  width: calc(100% - 2.2rem);
  margin: 0.35rem 1.1rem 1rem;
  padding: 0.8rem 0.9rem;
  border: 0;
  border-radius: 7px;
  background: var(--tfe-red);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
}

.tfe-review-button:hover {
  background: var(--tfe-red-dark);
}

.tfe-disclaimer {
  margin: 0;
  padding: 0.8rem 1.1rem 1.05rem;
  border-top: 1px solid var(--tfe-border);
  color: var(--tfe-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

/* Map overlays. Leaflet positions the zero-size .tfe-icon; the child is centred on it. */

.tfe-icon {
  background: none;
  border: 0;
}

.tfe-segment-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0.26rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 5px;
  background: rgba(7, 26, 54, 0.92);
  color: #fff;
  font: 800 11px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.tfe-gate-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.3rem 0.45rem;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--tfe-red);
  color: #fff;
  font: 800 11px/1 Inter, system-ui, sans-serif;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.tfe-gate-marker:hover {
  background: var(--tfe-red-dark);
}

.tfe-gate-marker span {
  font-size: 13px;
}

.tfe-vertex {
  border: 2px solid var(--tfe-red);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.tfe-vertex.is-draggable {
  cursor: move;
}

.tfe-midpoint {
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(227, 6, 32, 0.75);
  cursor: copy;
}

.tfe-map-error {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 650px;
  padding: 2rem;
  background: #edf1f5;
  color: var(--tfe-text);
  text-align: center;
}

/* Request form */

.tfe-form {
  margin-top: 1.5rem;
  padding: 1.35rem 1.5rem 1.5rem;
  border: 1px solid var(--tfe-border);
  border-top: 4px solid var(--tfe-red);
  background: #fff;
}

.tfe-form-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--tfe-border);
}

.tfe-form-header h2 {
  margin: 0.1rem 0 0;
  color: var(--tfe-navy);
  font-size: 1.6rem;
}

.tfe-form-header > p {
  max-width: 480px;
  margin: 0;
  color: var(--tfe-muted);
  font-size: 0.85rem;
}

.tfe-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tfe-form .tfe-field > span {
  color: var(--tfe-muted);
}

.tfe-span-2 {
  grid-column: 1 / -1;
}

.tfe-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.tfe-submit {
  padding: 0.85rem 1.15rem;
  border: 0;
  border-radius: 7px;
  background: var(--tfe-red);
  color: #fff;
  font: inherit;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
}

.tfe-submit:hover {
  background: var(--tfe-red-dark);
}

.tfe-status {
  font-weight: 750;
}

.tfe-status.is-error {
  color: #a32121;
}

@media (max-width: 1100px) {
  .tfe-app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .tfe-summary {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    align-items: center;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .tfe-summary-heading,
  .tfe-review-button,
  .tfe-disclaimer {
    grid-column: 1 / -1;
  }

  .tfe-summary-list {
    border-left: 1px solid var(--tfe-border);
  }

  .tfe-summary > .tfe-field,
  .tfe-gate-list-wrap {
    margin: 0.8rem 1rem;
  }

  .tfe-review-button {
    width: auto;
    margin: 0.4rem 1rem 1rem;
  }
}

@media (max-width: 760px) {
  .tfe-estimator {
    margin: 1rem 0 2rem;
  }

  .tfe-app-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.2rem;
  }

  .tfe-header-badges {
    justify-content: flex-start;
  }

  .tfe-app-shell {
    display: block;
  }

  .tfe-controls {
    padding: 1rem;
  }

  .tfe-step {
    padding: 0.85rem 0;
  }

  .tfe-map {
    height: 500px;
    min-height: 500px;
  }

  .tfe-summary {
    display: block;
    margin: 0;
    border: 0;
    border-top: 1px solid var(--tfe-border);
  }

  .tfe-form {
    margin-top: 1rem;
    padding: 1.1rem;
  }

  .tfe-form-header {
    display: block;
  }

  .tfe-form-header > p {
    margin-top: 0.55rem;
  }

  .tfe-form-grid {
    grid-template-columns: 1fr;
  }

  .tfe-span-2 {
    grid-column: auto;
  }
}
