:root {
    --navy: #0b1f3b;
    --blue: #0c6efd;
    --sky: #3bb3ff;
    --ice: #7dd9ff;
    --blue-soft: color-mix(in srgb, var(--ice) 20%, white);
    --hover-surface: color-mix(in srgb, var(--ice) 10%, white);
    --text: var(--navy);
    --muted: #39485d;
    --border: #6b7c98;
    --card-border: #d9dee4;
    --page: #f6f7fb;
    --danger: #b3261e;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 14px/1.9 "Yekan Bakh", Tahoma, Arial, sans-serif; }
main { width: 78%; max-width: 1040px; margin: 24px auto; padding: 0; }
.page-title { margin: 0 0 6px; color: var(--navy); font-size: 24px; line-height: 1.7; text-align: right; }
.card > .muted { margin: 0 0 12px; text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.form-section { margin: 0 0 20px; padding: 16px 24px 20px; background: #fff; border: 1px solid var(--card-border); border-radius: 20px; box-shadow: 0 2px 4px #0b1f3b08, 0 6px 18px #0b1f3b0b; }
.section-heading { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; color: var(--navy); font-size: 18px; line-height: 1.6; font-weight: 700; }
.section-heading > span { display: inline-flex; align-items: center; justify-content: center; order: -1; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; }
.full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; }
.field { position: relative; display: block; min-width: 0; }
.field-label { position: absolute; z-index: 1; top: 28px; inset-inline-start: 16px; max-width: calc(100% - 32px); margin: 0; padding: 0; transform: translateY(-50%); background: transparent; color: var(--muted); font-size: 16px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: top .15s ease, font-size .15s ease, line-height .15s ease, color .15s ease; }
#intake-form .field > input { display: block; width: 100%; height: 56px; min-height: 56px; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); caret-color: var(--blue); font-family: inherit; font-size: 16px; line-height: 24px; transition: border-color .15s ease, box-shadow .15s ease; }
#intake-form .field > input::placeholder { color: transparent; opacity: 1; }
#intake-form .field > input:focus::placeholder { color: var(--muted); }
.field:has(input:focus, input:not(:placeholder-shown), input:-webkit-autofill) > .field-label { top: 0; inset-inline-start: 12px; max-width: calc(100% - 24px); padding-inline: 4px; background: #fff; font-size: 12px; line-height: 16px; }
#intake-form .field > input:focus { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); outline: none; }
.field:has(input:focus) > .field-label { color: var(--blue); }
.button:focus-visible, #form-feedback:focus { outline: 2px solid var(--blue); outline-offset: 3px; }
#intake-form [aria-invalid=true] { border-color: var(--danger) !important; }
#intake-form .field > input[aria-invalid=true] { caret-color: var(--danger); }
#intake-form .field > input[aria-invalid=true]:focus { box-shadow: inset 0 0 0 1px var(--danger); }
.field:has([aria-invalid=true]) > .field-label { color: var(--danger); }
#intake-form .field > input:disabled { border-color: color-mix(in srgb, var(--navy) 12%, transparent); color: color-mix(in srgb, var(--navy) 38%, transparent); background: #fff; cursor: not-allowed; }
.field:has(input:disabled) > .field-label { color: color-mix(in srgb, var(--navy) 38%, white); }
.choices { min-width: 0; margin: 0 0 24px; padding: 0; border: 0; }
.choices > legend { margin-bottom: 12px; padding: 0; color: var(--navy); font-size: 13px; font-weight: 600; }
.options { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 0 8px; }
.options label { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 32px; margin-block: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 500; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
.options label::before { content: ''; flex-shrink: 0; width: 0; height: 18px; }
.options label::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.options input { position: absolute; z-index: 1; inset: -8px 0; width: 100%; height: 48px; margin: 0; opacity: 0; cursor: pointer; }
.options label:has(input:checked) { padding-inline-start: 8px; border-color: transparent; background: var(--blue-soft); color: var(--navy); }
.options label:has(input:checked)::before { width: 18px; margin-inline-end: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m4 9 3 3 7-7' fill='none' stroke='%230b1f3b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px 18px no-repeat; }
.options label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; }
.options label:has(input:focus-visible)::after, .options label:active:not(:has(input:disabled))::after { opacity: .12; }
.options label:has(input:disabled) { opacity: .38; cursor: not-allowed; }
.options label:has(input:disabled) input { cursor: not-allowed; }
.options .rating-number { display: inline-flex; flex: 0 0 20px; align-items: center; justify-content: center; width: 20px; height: 20px; margin-inline-end: 6px; border-radius: 50%; background: var(--page); color: var(--navy); font-size: 12px; line-height: 1; font-weight: 700; }
.options label:has(input:checked) .rating-number { background: var(--navy); color: #fff; }
.upload-field { margin-bottom: 24px; }
.control-heading { margin-bottom: 12px; }
.control-title { display: block; margin: 0 0 4px; color: var(--navy); font-size: 14px; font-weight: 600; }
.control-help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.upload-control { position: relative; border: 1px dashed var(--border); border-radius: 12px; background: var(--page); transition: background-color .15s ease, border-color .15s ease; }
.upload-control input[type=file] { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.upload-label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 16px; text-align: center; cursor: pointer; }
.upload-preview { display: block; width: 100%; max-height: 220px; margin-block: 4px 8px; border-radius: 8px; object-fit: contain; }
.upload-preview[hidden], .upload-control.has-preview .upload-label svg { display: none; }
.upload-label svg { width: 24px; height: 24px; color: var(--navy); }
.upload-action { display: inline-block; min-height: 40px; padding: 6px 20px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 13px; transition: background-color .15s ease; }
.upload-filename { max-width: 100%; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; line-height: 1.5; }
.upload-control.has-file { border-style: solid; border-color: var(--blue); background: var(--blue-soft); }
.upload-control:focus-within { outline: 2px solid var(--blue); outline-offset: 3px; }
.upload-control:has([aria-invalid=true]) { border-color: var(--danger); background: #fff3f2; }
#intake-form .button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 16px; padding: 12px 20px; border: 1px solid transparent; border-radius: 8px; background: var(--navy); color: #fff; font: inherit; font-size: 14px; line-height: 1.6; font-weight: 600; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
#intake-form .button--secondary { border-color: var(--border); background: #fff; color: var(--navy); }
#intake-form .button--text { width: auto; min-height: 44px; margin: 0 0 8px; padding: 8px 12px; background: transparent; color: var(--navy); font-size: 12px; font-weight: 400; }
#intake-form .button--primary > span { position: absolute; inset-inline-end: 20px; }
#intake-form .button:disabled { opacity: .6; cursor: wait; }
.captcha-prompt { direction: ltr; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 56px; margin: 0; padding: 6px 12px; background: var(--page); border-radius: 8px; color: var(--navy); font-size: 14px; white-space: nowrap; }
.captcha-field { width: 160px; max-width: 100%; margin: 0; }
#map { height: 300px; border: 1px solid var(--card-border); border-radius: 12px; direction: ltr; }
#map .leaflet-bar { border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 8px #0b1f3b15; overflow: hidden; }
#map .leaflet-bar a { color: var(--navy); }
#map .leaflet-bar a:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
#map .leaflet-control-attribution { font: 11px/1.6 Tahoma, Arial, sans-serif; color: var(--muted); background: #fffffff0; padding: 2px 6px; }
#map .leaflet-control-attribution a { color: inherit; text-decoration: underline; }
.map-field { margin-bottom: 24px; }
.coordinate-grid { margin-top: 0; }
#intake-form .coordinate-grid input { text-align: left; appearance: textfield; -moz-appearance: textfield; }
.coordinate-grid input::-webkit-inner-spin-button, .coordinate-grid input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field-error { display: block; margin: 4px 0 0; padding-inline: 16px; color: var(--danger); font-size: 12px; line-height: 16px; }
.errors, .success { padding: 16px; margin: 20px 0; border: 1px solid; border-radius: 12px; font-size: 13px; }
.errors { border-color: var(--danger); background: #fff3f2; color: var(--danger); }
.success { border-color: var(--blue); background: var(--blue-soft); color: var(--navy); }
#form-feedback[hidden] { display: none; }
@media (hover: hover) {
    #intake-form .button:not(.button--text):hover:not(:disabled) { border-color: var(--blue); background: var(--blue); color: #fff; }
    #intake-form .button--text:hover:not(:disabled) { background: var(--blue-soft); }
    .upload-control:hover { border-color: var(--blue); background: var(--blue-soft); }
    .upload-control:hover .upload-action { background: var(--blue); }
    .options label:hover:not(:has(input:disabled))::after { opacity: .08; }
    #intake-form .field > input:hover:not(:focus):not(:disabled):not([aria-invalid=true]) { border-color: var(--navy); }
    #map .leaflet-bar a:hover:not(.leaflet-disabled) { background: var(--blue); color: #fff; }
}
#intake-form .button:not(.button--text):active:not(:disabled) { border-color: var(--navy); background: var(--navy); color: #fff; }
#intake-form .button--text:active:not(:disabled) { background: var(--blue-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.choice-row { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 8px; }
.choice-label { padding-top: 9px; font-size: 13px; font-weight: 600; }
.map-stage { position: relative; isolation: isolate; }
#intake-form #locate { position: absolute; z-index: 500; inset-inline-start: 8px; bottom: 8px; width: auto; max-width: calc(100% - 16px); min-height: 44px; margin: 0; padding: 8px 12px; border-radius: 8px; background: #fff; box-shadow: 0 2px 6px #0b1f3b14; font-size: 12px; }

.captcha-row { display: grid; grid-template-columns: minmax(0, 160px) max-content max-content; justify-content: start; gap: 12px; align-items: start; }

#intake-form .captcha-field > input { min-height: 56px; text-align: center; }
#intake-form #refresh-captcha { min-height: 56px; margin: 0; padding: 8px 0; color: var(--blue); white-space: nowrap; }
@media (hover: hover) { #intake-form #locate:hover:not(:disabled) { background: var(--blue); color: #fff; } }
@media (max-width: 900px) {
    main { width: calc(100% - 40px); }
    .choice-row { grid-template-columns: 120px minmax(0, 1fr); }
    .captcha-row { grid-template-columns: minmax(0, 160px) max-content; }
    #intake-form #refresh-captcha { grid-column: 1 / -1; justify-self: end; }
}
@media (max-width: 600px) {
    main { width: calc(100% - 24px); margin: 20px auto; padding: 0; }
    .page-title { font-size: 22px; }
    .form-section { padding: 20px; }
    .section-heading { font-size: 17px; }
}
@media (max-width: 460px) {
    main { padding: 0; }
    .grid { grid-template-columns: 1fr; gap: 16px; }
    .full { grid-column: auto; }
    .form-section { padding: 20px 16px; border-radius: 16px; }

    #map { height: 300px; }
}
@media (max-width: 600px) {
    .choice-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .choice-label { padding: 0; }
    #map { height: 300px; }
    .captcha-row { grid-template-columns: minmax(0, 160px) max-content; gap: 8px; }

    #intake-form #refresh-captcha { grid-column: 1 / -1; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
    #intake-form .button, #intake-form input, .field-label, .upload-control, .upload-action, .options label, .options label::after { transition: none; }
}
