:root {
  --gd: #006e2e; --gm: #2d7a4f; --gl: #e8f4ee; --gll: #f2f9f5;
  --gold: #c8973a; --gold-l: #fdf5e6;
  --n100: #f5f5f3; --n200: #e8e8e5; --n400: #9a9a96; --n700: #3d3d3a; --n900: #1a1a18;
  --red: #c0392b; --red-l: #fdf2f2;
  --white: #fff;
  --r4: 4px; --r8: 8px; --r12: 12px;
  --sh: 0 1px 6px rgba(0,0,0,.09);
  --sh2: 0 4px 18px rgba(0,0,0,.13);
  --font: 'Segoe UI', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--n100); color: var(--n700); font-size: 14.5px; line-height: 1.6; }

/* ── HEADER ── */
header { background: var(--gd); color: #fff; }
.hdr-top { display: flex; align-items: center; gap: 14px; padding: 14px clamp(16px, 4vw, 40px); border-bottom: 3px solid var(--gold); }
.hdr-logo img { height: 48px; width: auto; display: block; }
.hdr-banner { padding: 16px clamp(16px, 4vw, 40px) 20px; display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.badge { background: var(--gold); color: #fff; font-size: .6rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 3px 9px; border-radius: 2px; flex-shrink: 0; margin-top: 5px; }
.hdr-banner h2 { font-size: clamp(1rem, 3vw, 1.3rem); font-weight: 700; }
.hdr-banner p  { font-size: .82rem; color: rgba(255,255,255,.68); margin-top: 3px; }

/* ── PROGRESS ── */
.progress-bar { background: var(--white); border-bottom: 1px solid var(--n200); padding: 0 clamp(16px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 0; }
.sp { display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600; color: var(--n400); white-space: nowrap; padding: 10px 0; }
.sp + .sp::before { content: '›'; margin: 0 8px; color: var(--n200); font-size: .9rem; }
.sp .sn { width: 18px; height: 18px; border-radius: 50%; background: var(--n200); color: var(--n400); display: flex; align-items: center; justify-content: center; font-size: .6rem; font-weight: 800; }
.sp.on { color: var(--gm); }
.sp.on .sn { background: var(--gm); color: #fff; }
@media(max-width:400px) { .sp .sp-label { display: none; } }

/* ── LAYOUT ── */
.outer { max-width: 1160px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; display: grid; grid-template-columns: 270px 1fr; gap: 24px; align-items: start; }
@media(max-width:860px) { .outer { grid-template-columns: 1fr; } }

/* ── SIDEBAR ── */
.sidebar { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
@media(max-width:860px) { .sidebar { position: static; } }
.info-card { background: var(--white); border-radius: var(--r12); box-shadow: var(--sh); overflow: hidden; }
.ic-head { background: var(--gd); color: #fff; padding: 11px 15px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; display: flex; align-items: center; gap: 7px; }
.ic-body { padding: 13px 15px; }
.ic-body p { font-size: .78rem; line-height: 1.55; }
.ic-body ul { margin: 9px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ic-body li { font-size: .76rem; display: flex; align-items: flex-start; gap: 7px; }
.ic-body li::before { content: '✓'; color: var(--gm); font-weight: 800; flex-shrink: 0; }
.contact-card { background: var(--gold-l); border: 1px solid #e8d09a; border-radius: var(--r12); padding: 13px 15px; }
.contact-card .ct { font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #7a5a1a; margin-bottom: 7px; }
.contact-card p { font-size: .76rem; color: #5a3d0a; line-height: 1.6; }
.examples-card { background: var(--white); border-radius: var(--r12); box-shadow: var(--sh); overflow: hidden; }
.ex-head { background: var(--gl); border-left: 4px solid var(--gm); padding: 9px 13px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--gd); }
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; }
.ex-item { padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 5px; border-bottom: 1px solid var(--n200); border-right: 1px solid var(--n200); transition: background .15s; }
.ex-item:hover { background: var(--gll); }
.ex-item:nth-child(2n) { border-right: none; }
.ex-item:nth-last-child(-n+2) { border-bottom: none; }
.ex-icon  { width: 50px; height: 38px; }
.ex-label { font-size: .65rem; font-weight: 600; color: var(--n700); text-align: center; line-height: 1.3; }

/* ── FORM ── */
.form-col { display: flex; flex-direction: column; gap: 18px; }
.fsec { background: var(--white); border-radius: var(--r12); box-shadow: var(--sh); overflow: hidden; margin-top: 1rem; }
.fsec-head { background: var(--gl); border-left: 4px solid var(--gm); padding: 11px 20px; display: flex; align-items: center; gap: 9px; }
.fsec-head .ico { font-size: 1rem; color: var(--gm); }
.fsec-head h3 { font-size: .75rem; font-weight: 800; color: var(--gd); text-transform: uppercase; letter-spacing: .07em; }
.fsec-body { padding: 20px; }

/* fields */
.frow { display: grid; gap: 13px; margin-bottom: 13px; }
.frow:last-child { margin-bottom: 0; }
.frow.c1 { grid-template-columns: 1fr; }
.frow.c2 { grid-template-columns: 1fr 1fr; }
.frow.c3 { grid-template-columns: 2fr 1fr 1fr; }
@media(max-width:560px) { .frow.c2, .frow.c3 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; }
label { font-size: .67rem; font-weight: 800; color: var(--n700); text-transform: uppercase; letter-spacing: .04em; }
label .req { color: var(--gold); margin-left: 2px; }
input[type=text], input[type=email], input[type=tel], input[type=number], textarea, select {
  border: 1.5px solid var(--n200); border-radius: var(--r4); padding: 8px 11px;
  font-family: var(--font); font-size: .87rem; color: var(--n900); background: var(--white);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gm); box-shadow: 0 0 0 3px rgba(45,122,79,.1); }
textarea { resize: vertical; min-height: 70px; }
.hint { font-size: .67rem; color: var(--n400); margin-top: 2px; }
.field-err input, .field-err textarea { border-color: var(--red) !important; }
.field-err .hint { color: var(--red); }

/* chips */
.chip-wrap { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.chip input { display: none; }
.chip label { display: flex; align-items: center; gap: 5px; padding: 5px 12px; border: 1.5px solid var(--n200); border-radius: 20px; cursor: pointer; font-size: .75rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--n700); background: var(--white); transition: all .15s; user-select: none; }
.chip label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--n200); transition: background .15s; flex-shrink: 0; }
.chip input:checked + label { background: var(--gl); border-color: var(--gm); color: var(--gd); }
.chip input:checked + label .dot { background: var(--gm); }

/* items table */
.warn-box { background: var(--gold-l); border: 1px solid #e8d09a; border-radius: var(--r4); padding: 9px 12px; font-size: .76rem; color: #7a5a1a; display: flex; gap: 7px; margin-bottom: 14px; }
.items-tbl { width: 100%; border-collapse: collapse; }
.items-tbl thead tr { background: var(--n100); }
.items-tbl th { padding: 8px 13px; text-align: left; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--n400); border-bottom: 1px solid var(--n200); }
.items-tbl th:last-child { text-align: center; width: 90px; }
.items-tbl td { padding: 9px 13px; border-bottom: 1px solid var(--n200); vertical-align: middle; }
.items-tbl tr:last-child td { border-bottom: none; }
.items-tbl tbody tr:hover { background: var(--n100); }
.ichk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ichk input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--gm); cursor: pointer; flex-shrink: 0; }
.iname { font-size: .84rem; }
.qty-cell { text-align: center; }
.qty-inp { width: 68px !important; text-align: center; font-weight: 700; opacity: .3; pointer-events: none; transition: opacity .2s; padding: 5px 7px; }
.qty-inp.on { opacity: 1; pointer-events: auto; border-color: var(--gm); }

/* map */
.local-divider {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: .76rem; font-weight: 800; color: var(--gd); text-transform: uppercase;
  letter-spacing: .05em; margin: 6px 0 12px; padding-top: 12px;
  border-top: 1px dashed var(--n200);
}
.local-divider-hint { font-size: .72rem; font-weight: 400; text-transform: none; color: var(--n400); letter-spacing: 0; }

.same-addr-card {
  background: var(--gll); border: 1.5px solid var(--gl); border-radius: var(--r12);
  padding: 16px 18px; margin-bottom: 18px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px;
}
.same-addr-label {
  font-size: .85rem; font-weight: 700; color: var(--gd);
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px;
}
.same-addr-toggle {
  display: inline-flex; gap: 8px; flex-shrink: 0;
}
.same-addr-btn {
  border: 2px solid var(--n200); border-radius: var(--r8); background: var(--white);
  color: var(--n700); font-family: var(--font); font-size: .85rem; font-weight: 800;
  padding: 10px 28px; cursor: pointer; transition: all .15s; min-width: 90px;
}
.same-addr-btn:hover { border-color: var(--gm); background: var(--gl); }
.same-addr-btn.active[data-val="sim"] {
  background: var(--gm); border-color: var(--gm); color: #fff;
  box-shadow: 0 2px 8px rgba(45,122,79,.35);
}
.same-addr-btn.active[data-val="nao"] {
  background: var(--gold); border-color: var(--gold); color: #fff;
  box-shadow: 0 2px 8px rgba(200,151,58,.35);
}

/* Secção inteira (campos + mapa + observações) só aparece depois
   de o utilizador responder Sim/Não à pergunta acima */
#locSection {
  max-height: 3000px;
  opacity: 1;
  transition: opacity .25s ease, max-height .25s ease;
  overflow: hidden;
}
#locSection.loc-section-hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

#locFieldsWrap { margin-top: 16px; }

/* Quando "Sim": campos ficam visíveis mas só de leitura (auto-preenchidos) */
#locFieldsWrap.readonly-fill input {
  background: var(--n100); color: var(--n400); cursor: not-allowed;
}

.map-hint { font-size: .76rem; color: var(--n400); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }

.map-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.map-layer-toggle {
  display: inline-flex; border: 1.5px solid var(--n200); border-radius: var(--r8);
  overflow: hidden; flex-shrink: 0;
}
.map-layer-btn {
  border: none; background: var(--white); color: var(--n700);
  font-family: var(--font); font-size: .76rem; font-weight: 700;
  padding: 7px 13px; cursor: pointer; transition: background .15s, color .15s;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
}
.map-layer-btn + .map-layer-btn { border-left: 1.5px solid var(--n200); }
.map-layer-btn:hover { background: var(--gll); }
.map-layer-btn.active { background: var(--gm); color: #fff; }

.map-locate-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--n200); border-radius: var(--r8); background: var(--white);
  color: var(--gd); font-family: var(--font); font-size: .76rem; font-weight: 700;
  padding: 7px 13px; cursor: pointer; transition: border-color .15s, background .15s;
  white-space: nowrap;
}
.map-locate-btn:hover:not(:disabled) { border-color: var(--gm); background: var(--gll); }
.map-locate-btn:disabled { opacity: .6; cursor: not-allowed; }
.map-locate-btn.loading .locate-icon { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.map-locate-status {
  font-size: .72rem; color: var(--n400); margin-top: 6px; min-height: 1em;
}
.map-locate-status.err { color: var(--red); }
.map-locate-status.ok  { color: var(--gm); }

#map { height: 300px; border-radius: var(--r8); border: 1.5px solid var(--n200); }
.coords-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media(max-width:400px) { .coords-row { grid-template-columns: 1fr; } }

/* ── ANEXOS ── */
.upload-zone {
  border: 2px dashed var(--n200); border-radius: var(--r8);
  padding: 24px 18px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; position: relative;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--gm); background: var(--gll); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload-icon { font-size: 2rem; margin-bottom: 6px; }
.upload-main { font-size: .84rem; font-weight: 700; color: var(--gd); }
.upload-sub  { font-size: .72rem; color: var(--n400); margin-top: 3px; }

.file-list { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--n100); border: 1px solid var(--n200);
  border-radius: var(--r4); padding: 7px 12px; font-size: .8rem;
}
.file-icon { font-size: 1.2rem; flex-shrink: 0; }
.file-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.file-size { color: var(--n400); white-space: nowrap; font-size: .72rem; }
.file-remove { background: none; border: none; cursor: pointer; color: var(--red); font-size: 1rem; padding: 0 2px; line-height: 1; flex-shrink: 0; }
.file-remove:hover { opacity: .7; }
.file-err { background: var(--red-l); border-color: #f5c6c2; }
.file-err .file-name { color: var(--red); }

/* progress bar upload */
.upload-progress { display: none; margin-top: 6px; }
.upload-progress.show { display: block; }
.uprog-bar { height: 4px; background: var(--n200); border-radius: 2px; overflow: hidden; }
.uprog-fill { height: 100%; background: var(--gm); width: 0; transition: width .3s; border-radius: 2px; }
.uprog-label { font-size: .68rem; color: var(--n400); margin-top: 3px; text-align: right; }

/* ── AUTORIZAÇÕES / RGPD ── */
.consent-block { display: flex; flex-direction: column; gap: 12px; }
.consent-item {
  display: flex; align-items: flex-start; gap: 11px; cursor: pointer;
  padding: 12px 14px; border: 1.5px solid var(--n200); border-radius: var(--r8);
  transition: border-color .15s, background .15s;
}
.consent-item:hover { border-color: var(--gm); background: var(--gll); }
.consent-item input[type=checkbox] {
  width: 18px; height: 18px; accent-color: var(--gm); cursor: pointer;
  flex-shrink: 0; margin-top: 1px;
}
.consent-item.optional { border-style: dashed; }
.consent-text { font-size: .82rem; line-height: 1.55; color: var(--n700); }
.consent-link, .rgpd-info a {
  display: inline-block; margin-left: 4px; color: var(--gm); font-weight: 700;
  text-decoration: none; font-size: .78rem;
}
.consent-link:hover, .rgpd-info a:hover { text-decoration: underline; }
.consent-item input:invalid { outline: none; }
.consent-item.field-err { border-color: var(--red); background: var(--red-l); }

.rgpd-info {
  margin-top: 14px; background: var(--gll); border-left: 3px solid var(--gm);
  border-radius: var(--r4); padding: 10px 14px; font-size: .74rem;
  color: var(--n700); line-height: 1.6;
}

/* submit */
.submit-area { background: var(--white); border-radius: var(--r12); box-shadow: var(--sh); margin-top: 1rem; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 11px; text-align: center; }
.submit-note { font-size: .74rem; color: var(--n400); max-width: 460px; }
.btn-sub { background: var(--gd); color: #fff; border: none; border-radius: var(--r8); padding: 12px clamp(20px, 6vw, 40px); font-family: var(--font); font-size: .95rem; font-weight: 700; letter-spacing: .04em; cursor: pointer; transition: background .17s, box-shadow .17s; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn-sub:hover:not(:disabled) { background: var(--gm); box-shadow: var(--sh2); }
.btn-sub:disabled { opacity: .55; cursor: not-allowed; }

/* spinner */
.spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-sub.loading .spinner { display: block; }
.btn-sub.loading .btn-txt { opacity: .7; }

/* global error */
.global-err { display: none; background: var(--red-l); border: 1px solid #f5c6c2; border-radius: var(--r4); padding: 10px 14px; font-size: .82rem; color: var(--red); text-align: center; }
.global-err.show { display: block; }

/* overlay */
#ovl { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9999; align-items: center; justify-content: center; padding: 20px; }
#ovl.show { display: flex; }
.ovl-card { background: #fff; border-radius: var(--r12); padding: clamp(24px,5vw,38px) clamp(20px,6vw,46px); max-width: 420px; width: 100%; text-align: center; box-shadow: var(--sh2); }
.ovl-icon { font-size: 2.6rem; margin-bottom: 10px; }
.ovl-card h2 { font-size: 1.2rem; color: var(--gd); margin-bottom: 6px; }
.ovl-card p  { color: var(--n400); font-size: .84rem; line-height: 1.6; }
.ovl-ref { margin: 13px 0; background: var(--gl); border-radius: var(--r4); padding: 10px 16px; font-weight: 800; color: var(--gd); font-size: 1.1rem; letter-spacing: .06em; }
.ovl-meta { font-size: .75rem; color: var(--n400); margin-top: 6px; }
.btn-ok { margin-top: 14px; background: var(--gd); color: #fff; border: none; border-radius: var(--r4); padding: 9px 26px; font-family: var(--font); font-size: .86rem; font-weight: 700; cursor: pointer; }
.btn-ok:hover { background: var(--gm); }

footer { background: var(--gd); color: rgba(255,255,255,.5); text-align: center; font-size: .7rem; padding: 14px clamp(16px,4vw,40px); }
footer strong { color: rgba(255,255,255,.8); }