/* Consultation application form, apply.html only.
   Kept out of styles.css so no other page's cached stylesheet changes.
   Every colour comes from the tokens in styles.css, so both themes work. */

.afm-sec{padding-top:clamp(36px,5vw,64px)}
.afm-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);gap:clamp(28px,5vw,64px);align-items:start}
@media(max-width:900px){.afm-grid{grid-template-columns:minmax(0,1fr)}.afm-aside{order:-1}}

/* ---------- steps ---------- */
.afm fieldset{border:0;margin:0;padding:0;min-width:0}
.afm .afm-step{padding:clamp(24px,3.5vw,34px) 0;border-top:1px solid var(--line)}
.afm .afm-step:first-child{border-top:0;padding-top:0}
.afm-step>legend{display:flex;align-items:baseline;gap:14px;float:left;width:100%;
  font-family:var(--serif);font-weight:600;font-size:clamp(1.25rem,2.6vw,1.6rem);line-height:1.2;letter-spacing:-.018em;color:var(--fg);margin-bottom:18px}
.afm-step>legend+*{clear:both}
.afm-step>legend .idx{font-size:1rem}
.afm-hint{color:var(--fg-55);font-size:.9rem;margin:-8px 0 14px}

/* ---------- fields ---------- */
.afm-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 18px}
@media(max-width:560px){.afm-row{grid-template-columns:minmax(0,1fr)}}
.afm .afm-field{margin-bottom:18px}
.afm-field>label,.afm-pills>legend{display:block;font-weight:600;font-size:.9rem;color:var(--fg);margin-bottom:8px;padding:0}
.afm-opt{font-weight:500;color:var(--fg-55);margin-left:6px}
.afm input[type="text"],.afm input[type="email"],.afm input[type="tel"],.afm input[type="date"],.afm select,.afm textarea{
  display:block;width:100%;font-family:var(--sans);font-size:1rem;color:var(--fg);
  background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:13px 16px;
  outline:none;min-width:0;transition:border-color .22s ease,box-shadow .22s ease;-webkit-appearance:none;appearance:none}
.afm input[type="date"]{min-height:50px}
.afm textarea{resize:vertical;min-height:132px;line-height:1.5}
.afm select{padding-right:40px;cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,var(--fg-55) 50%),linear-gradient(135deg,var(--fg-55) 50%,transparent 50%);
  background-position:calc(100% - 21px) 50%,calc(100% - 16px) 50%;background-size:5px 5px;background-repeat:no-repeat}
.afm input::placeholder,.afm textarea::placeholder{color:var(--fg-38)}
.afm input:focus,.afm select:focus,.afm textarea:focus{border-color:var(--fg);box-shadow:0 0 0 3px var(--glow-soft)}
[data-theme="dark"] .afm input[type="date"]{color-scheme:dark}

.afm-phone{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.4fr);gap:10px}
@media(max-width:420px){.afm-phone{grid-template-columns:minmax(0,1fr)}}

/* ---------- choice cards ---------- */
.afm-cards{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
@media(max-width:560px){.afm-cards{grid-template-columns:minmax(0,1fr)}}
.afm-card{position:relative;display:flex;gap:14px;align-items:flex-start;cursor:pointer;
  background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:16px 18px;
  transition:border-color .22s ease,background .22s ease,box-shadow .22s ease}
.afm-card:hover{border-color:var(--fg-38)}
.afm-card input,.afm-pill input{position:absolute;opacity:0;width:1px;height:1px;margin:0}
.afm-card::before{content:"";flex:0 0 20px;height:20px;margin-top:1px;border-radius:6px;border:1.5px solid var(--fg-38);
  background:transparent center/12px 12px no-repeat;transition:background-color .2s ease,border-color .2s ease}
.afm-card span{display:flex;flex-direction:column;gap:4px}
.afm-card b{font-weight:600;font-size:.98rem;color:var(--fg)}
.afm-card small{font-size:.86rem;line-height:1.4;color:var(--fg-72)}
.afm-card:has(input:checked){border-color:var(--fg);box-shadow:0 0 0 1px var(--fg)}
.afm-card:has(input:checked)::before{background-color:var(--fg);border-color:var(--fg);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23F6EFE0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
[data-theme="dark"] .afm-card:has(input:checked)::before{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%2300092C' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
.afm-card:has(input:focus-visible),.afm-pill:has(input:focus-visible){outline:2px solid var(--bar-b);outline-offset:3px}

/* ---------- pills ---------- */
.afm-pillrow{display:flex;gap:10px;flex-wrap:wrap}
.afm-pill{position:relative;cursor:pointer}
.afm-pill span{display:inline-flex;align-items:center;padding:11px 26px;border-radius:var(--rb);border:1px solid var(--line);
  background:var(--surface);font-weight:600;font-size:.94rem;color:var(--fg);transition:background .22s ease,color .22s ease,border-color .22s ease}
.afm-pill:hover span{border-color:var(--fg-38)}
.afm-pill input:checked+span{background:var(--btn-bg);color:var(--btn-fg);border-color:var(--btn-bg)}

/* ---------- notes, errors ---------- */
.afm-note{margin:14px 0 4px;padding:14px 16px;border-radius:14px;background:var(--glow-bg);border:1px solid var(--glow-line);
  color:var(--fg);font-size:.92rem;line-height:1.5;max-width:none}
.afm-note[hidden]{display:none}
.afm-msg{display:none;margin-top:8px;font-size:.86rem;font-weight:500;color:var(--red)}
.afm .err>.afm-msg{display:block}
.afm .err input,.afm .err select,.afm .err textarea,.afm .err .afm-card,.afm .err .afm-pill span{border-color:var(--red)}
.afm-trap{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}

/* ---------- send ---------- */
.afm-send{padding-top:clamp(20px,3vw,28px);border-top:1px solid var(--line);display:flex;flex-direction:column;align-items:flex-start;gap:12px}
.afm-send .btn[disabled]{opacity:.6;cursor:progress}
.afm-status{color:var(--red);font-weight:500;font-size:.92rem;min-height:1px}
.afm-status:empty{display:none}
@media(max-width:520px){.afm-send .btn{width:100%}}

/* ---------- aside ---------- */
.afm-aside{position:sticky;top:calc(var(--navh) + 24px);display:flex;flex-direction:column;gap:14px}
@media(max-width:900px){.afm-aside{position:static}}
.afm-panel{background:var(--tint);border:1px solid var(--line-soft);border-radius:18px;padding:clamp(18px,2.4vw,24px)}
.afm-panel h3{font-family:var(--serif);font-weight:600;font-size:1.12rem;margin-bottom:10px;color:var(--fg)}
.afm-panel p{font-size:.93rem;line-height:1.55;color:var(--fg-72)}
.afm-panel p+p{margin-top:10px}
.afm-panel b{color:var(--fg)}

/* ---------- result states ---------- */
.afm-done,.afm-fail{display:none;padding:clamp(28px,4vw,44px);border:1px solid var(--line);border-radius:20px;background:var(--surface);outline:none}
.afm-box[data-state="done"] .afm,.afm-box[data-state="fail"] .afm{display:none}
.afm-box[data-state="done"] .afm-done,.afm-box[data-state="fail"] .afm-fail{display:block}
.afm-done h2,.afm-fail h2{font-size:clamp(1.5rem,3.4vw,2.1rem);margin-bottom:12px}
.afm-done p,.afm-fail p{color:var(--fg-72)}
.afm-done p+p{margin-top:10px}
.afm-done b{color:var(--fg);word-break:break-all}
.afm-fail .actions{margin-top:22px}
.afm-fail .tlink{background:none;border-top:0;border-left:0;border-right:0;cursor:pointer;font-family:var(--sans)}
.afm-tick{width:46px;height:46px;border-radius:999px;background:var(--green);color:#fff;display:flex;align-items:center;justify-content:center;margin-bottom:18px;font-size:1.3rem}
