:root {
  --navy: #0b2138;
  --navy-light: #163657;
  --orange: #ed642f;
  --orange-dark: #cf5122;
  --ink: #102337;
  --muted: #647384;
  --line: #dfe4e9;
  --bg: #f6f8fa;
  --green: #278a50;
  --green-light: #eef8f2;
  --red: #c8473b;
  --shadow: 0 4px 18px rgba(11, 33, 56, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.page-shell {
  max-width: 1340px;
  margin: auto;
  padding: 28px 20px 60px;
}

.hero {
  background: var(--navy);
  color: #fff;
  border-radius: 20px;
  padding: 28px 32px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.brand, .proposal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-dot {
  width: 16px;
  height: 16px;
  background: var(--orange);
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.brand-name {
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: 22px;
}
.brand-sub {
  opacity: 0.75;
  font-size: 12px;
  margin-top: 2px;
}
.hero-copy {
  max-width: 840px;
  margin-top: 24px;
}
.hero h1 {
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.1;
  margin: 0 0 10px;
  font-weight: 800;
}
.hero p {
  margin: 0;
  max-width: 780px;
  opacity: 0.85;
  line-height: 1.6;
  font-size: 15px;
}

.steps {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 18px;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.step span {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.step.active { color: var(--navy); }
.step.active span {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.step.done { color: var(--green); }
.step.done span {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}
.main-column {
  display: grid;
  gap: 18px;
}
.panel, .summary-card, .proposal-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}
.panel-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
  color: var(--navy);
}
.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.split-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.head-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  font-size: 11px;
  font-weight: 700;
  background: #eef3f6;
  color: var(--navy);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.btn-text-badge {
  font-size: 11px;
  font-weight: 700;
  background: #fdf3ed;
  color: var(--orange);
  border: 1px solid #fedccb;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-text-badge:hover {
  background: var(--orange);
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 22px;
}
.form-grid label {
  font-size: 13px;
  font-weight: 700;
}
.form-grid .full { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11, 33, 56, 0.08);
}
.req {
  color: var(--red);
  font-weight: 900;
  margin-left: 2px;
}
.field-hint {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 11px;
}
.input-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(200, 71, 59, 0.15) !important;
}
.input-error-msg {
  color: var(--red) !important;
  font-weight: 600;
}


.btn {
  min-height: 42px;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13.5px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn.primary {
  background: var(--orange);
  color: #fff;
}
.btn.primary:hover { background: var(--orange-dark); }
.btn.primary.active {
  background: #b83a0e;
  box-shadow: 0 0 0 3px rgba(237, 100, 47, 0.3);
}
.btn.success {
  background: var(--green);
  color: #fff;
}
.btn.success:hover { background: #1f6e40; }
.btn.dark {
  background: var(--navy);
  color: #fff;
}
.btn.dark:hover { background: var(--navy-light); }
.btn.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--navy);
}
.btn.secondary:hover {
  background: #f3f6f9;
  border-color: var(--navy);
}
.btn.danger-hover:hover {
  border-color: var(--red);
  color: var(--red);
  background: #fff5f5;
}
.btn.small {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}
.btn.large {
  font-size: 15px;
  margin: 16px 22px 22px;
  min-height: 46px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.loading {
  opacity: 1;
  pointer-events: none;
}
.btn-loader {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: currentColor;
  border-radius: 50%;
  display: inline-block;
  animation: btn-spin 0.75s linear infinite;
  flex-shrink: 0;
}
.btn.secondary.loading .btn-loader {
  border-color: rgba(16, 35, 55, 0.28);
  border-top-color: var(--navy);
}
@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}
.btn-icon { font-size: 14px; }

.action-processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 33, 56, 0.48);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.action-processing-card {
  width: min(390px, 100%);
  padding: 28px;
  border: 1px solid rgba(237, 100, 47, 0.7);
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 20px 55px rgba(11, 33, 56, 0.35);
  text-align: center;
}

.action-processing-title {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

.action-processing-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.action-processing-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  animation: action-progress 1.15s ease-in-out infinite;
}

@keyframes action-progress {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(135%); }
  100% { transform: translateX(250%); }
}

.action-message {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  width: min(360px, calc(100vw - 48px));
  padding: 16px 18px;
  border: 1px solid var(--orange);
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 14px 32px rgba(16, 40, 64, 0.18);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.45;
  animation: action-message-in 0.25s ease-out;
}

.action-message-close {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.action-message-close:hover,
.action-message-close:focus-visible {
  color: #fff;
}

.action-message-text {
  display: block;
  padding-right: 22px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

@keyframes action-message-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .action-message {
    top: 16px;
    right: 16px;
    width: calc(100vw - 32px);
  }
}

.otp-box, .verified-box {
  grid-column: 1 / -1;
  padding: 14px;
  border-radius: 12px;
}
.otp-box {
  background: #fff7f2;
  border: 1px solid #efd3c6;
}
.verified-box {
  background: var(--green-light);
  border: 1px solid #cfe8d8;
  color: var(--green);
  font-weight: 800;
}
.hidden { display: none !important; }

/* Map & Toolbar Styles */
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.map-search-wrap {
  flex: 1 1 260px;
}
.map-search-wrap input {
  margin-top: 0;
  font-size: 13.5px;
  padding: 9px 12px;
  background: #fff;
}
.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-status {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.map-status.status-info {
  background: #f0f6fc;
  color: #1a4f7c;
  border-color: #d2e3f5;
}
.map-status.status-success {
  background: var(--green-light);
  color: #1a6337;
  border-color: #cde6d6;
}
.map-status.status-warning {
  background: #fff7f2;
  color: #8c4323;
  border-color: #f7dcd0;
}

.map-container-relative {
  position: relative;
  width: 100%;
}
#map {
  height: 520px;
  background: #e8edf2;
  width: 100%;
}
.map-overlay-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 33, 56, 0.88);
  color: #fff;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.area-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.area-summary div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.area-summary span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.area-summary strong {
  font-size: 22px;
  color: var(--navy);
  font-weight: 800;
}
.area-summary small {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

/* Points Inspector */
.points-inspector-box {
  margin: 0 20px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  overflow: hidden;
}
.points-inspector-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #f3f6f9;
  user-select: none;
}
.inspector-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--navy);
}
.indicator-icon {
  font-size: 10px;
  transition: transform 0.2s ease;
}
.points-inspector-body.collapsed {
  display: none;
}
.points-inspector-body {
  padding: 12px 16px;
  max-height: 240px;
  overflow-y: auto;
}
.empty-points-notice {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 0;
  text-align: center;
}
.coords-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.coords-table th, .coords-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.coords-table th {
  color: var(--muted);
  font-weight: 700;
}
.coords-table code {
  background: #edf2f7;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.pt-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.btn-icon-danger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-icon-danger:hover {
  background: #fee2e2;
}

.distance-note {
  margin: 0 20px 20px;
  padding: 12px 16px;
  background: #f3f6f8;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* Pricing Section & Tier Matrix */
.pricing-content {
  padding: 0;
}
.pricing-callout {
  margin: 20px 22px;
  padding: 16px;
  border-radius: 12px;
  background: var(--green-light);
  border: 1px solid #cfe8d8;
  color: #285e3c;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.callout-icon { font-size: 24px; }
.pricing-callout strong { display: block; font-size: 14px; margin-bottom: 3px; }
.pricing-callout span { font-size: 12.5px; line-height: 1.5; color: #356d4b; }

.tier-matrix-wrap {
  margin: 0 22px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.tier-matrix-title {
  padding: 10px 16px;
  background: #f7f9fb;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--navy);
  border-bottom: 1px solid var(--line);
}
.tier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tier-table th, .tier-table td {
  padding: 9px 16px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
}
.tier-table th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 700;
}
.tier-table tr.active-tier {
  background: #eef8f2;
  font-weight: 800;
  color: #1b5b33;
}
.tier-table tr.active-tier td:first-child {
  border-left: 4px solid var(--green);
}
.tier-status {
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
}

/* Summary Card Sidebar */
.summary-card {
  position: sticky;
  top: 16px;
}
.summary-head {
  background: var(--navy);
  color: #fff;
  padding: 22px;
}
.summary-head small {
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}
.summary-head div {
  font-size: 32px;
  font-weight: 900;
  margin: 6px 0;
}
.summary-head span {
  font-size: 11.5px;
  opacity: 0.7;
}
.summary-body { padding: 0 20px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.summary-row span { color: var(--muted); }
.summary-row strong { color: var(--ink); }
.summary-actions {
  padding: 18px 20px;
  display: grid;
  gap: 8px;
}
.legal-mini {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  padding: 0 20px 18px;
  margin: 0;
}

/* Proposal Preview Document */
.proposal-preview {
  margin-top: 22px;
  position: relative;
  background: #fff;
}
.draft-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 68px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: rgba(11, 33, 56, 0.04);
  transform: rotate(-28deg);
}
.proposal-header {
  position: relative;
  z-index: 1;
  background: var(--navy);
  color: #fff;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.proposal-brand strong {
  font-size: 22px;
  letter-spacing: 0.06em;
}
.proposal-brand small { color: rgba(255, 255, 255, 0.7); }
.proposal-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}
.proposal-meta strong { font-size: 14px; }
.proposal-section {
  position: relative;
  z-index: 1;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.proposal-section h3 {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 16px;
}
.proposal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.proposal-grid div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.proposal-grid span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.map-snapshot {
  width: 100%;
  max-height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.snapshot-fallback {
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  background: #fafbfc;
  font-size: 13px;
}
.proposal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.proposal-table th, .proposal-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}
.proposal-table th {
  background: var(--navy);
  color: #fff;
}
.proposal-table td:last-child {
  white-space: nowrap;
  text-align: right;
}
.total-row {
  font-weight: 900;
  background: #fff7f2;
}
.methodology-list {
  padding-left: 20px;
  line-height: 1.7;
  font-size: 13px;
}
.methodology-list li { margin-bottom: 6px; }
.method-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
.proposal-coords-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pt-pill {
  display: inline-block;
  padding: 4px 10px;
  background: #eef3f7;
  color: var(--navy);
  font-size: 11px;
  font-family: monospace;
  border-radius: 6px;
}
.terms ul {
  font-size: 13px;
  line-height: 1.7;
  padding-left: 20px;
}
.proposal-footer {
  position: relative;
  z-index: 1;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  background: #f7f9fb;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 33, 56, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 20px;
}
.modal-card {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.modal-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--navy);
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
}
.modal-body {
  padding: 20px;
}
.modal-body p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.modal-body label {
  font-size: 13px;
  font-weight: 700;
}
.modal-actions {
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}

@media (max-width: 960px) {
  .grid-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .proposal-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .page-shell { padding: 14px 10px 40px; }
  .steps { gap: 6px; }
  .step { font-size: 0; }
  .step span { font-size: 12px; }
  .area-summary { grid-template-columns: 1fr; }
  .proposal-grid { grid-template-columns: 1fr; }
  .proposal-header { flex-direction: column; }
  .proposal-meta { text-align: left; }
  .phone-row { flex-direction: column; }
  #map { height: 420px; }

  /* Disable sticky summary on small screens */
  .summary-card { position: static; }
}

/* Force desktop-style proposal rendering when generating PDF on mobile devices. */
.pdf-desktop-layout .proposal-preview {
  width: 1000px;
  max-width: 1000px;
  margin: 22px auto 0;
}
.pdf-desktop-layout .proposal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.pdf-desktop-layout .proposal-header {
  flex-direction: row;
}
.pdf-desktop-layout .proposal-meta {
  text-align: right;
}
.pdf-desktop-layout .workflow-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.pdf-desktop-layout .methodology-card {
  align-items: center;
}

/* Print Media Styles - PDF Page Breaks */
@media print {
  .proposal-section { break-inside: avoid; }
  
  /* Page break before Proposed Methodology section */
  .proposed-methodology {
    break-before: page !important;
    page-break-before: always !important;
  }
  
  /* Page break before Typical Equipment section */
  .equipment-workflow {
    break-before: page !important;
    page-break-before: always !important;
  }
  
  /* Page break before GPS Coordinates section - it's the 6th proposal-section */
  .proposal-section:nth-of-type(6) {
    break-before: page !important;
    page-break-before: always !important;
  }
  
  /* Page break before Commercial Terms section - it's the 7th proposal-section */
  .proposal-section:nth-of-type(7) {
    break-before: page !important;
    page-break-before: always !important;
  }
}

