/* =========================================================
   ZAGA SOLUTIONS — Client Forms (/forms)
   The access-code screen reuses the .pay layout from styles.css.
   The form itself is a light "sheet" so long answers are easy to
   read, type and print.
   ========================================================= */

.cform {
  --navy: #01235f;
  --teal: #02557d;
  --ink: #1b2433;
  --ink-muted: #5a6678;
  --rule: #c4cedb;
  --field: #f1f5f9;
  --example: #e6eef4;
  position: relative; z-index: 1;
  padding: calc(var(--nav-h) + 2rem) clamp(0.75rem, 2.5vw, 2rem) 4rem;
}
.cform[hidden] { display: none; }
.cform__wrap { max-width: 1320px; margin-inline: auto; }
.cform__sheet {
  background: #fff; color: var(--ink);
  border-radius: 14px; border-top: 6px solid var(--navy);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  padding: clamp(1.25rem, 3vw, 2.75rem);
  font-family: var(--font-body); font-size: 0.95rem; line-height: 1.5;
}

/* ---- Sheet header ---- */
.cform__top { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 1.1rem; border-bottom: 2px solid var(--teal); margin-bottom: 1.2rem; }
.cform__top img { height: 54px; width: auto; }
.cform__titles { text-align: right; margin-left: auto; }
.cform__titles h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.35rem, 2.6vw, 1.9rem); color: var(--navy); line-height: 1.15; letter-spacing: -0.01em; }
.cform__titles p { color: var(--teal); font-weight: 700; font-size: 1rem; margin-top: 0.15rem; }
.cform__intro { max-width: 95ch; color: var(--ink); }

/* ---- Sections ---- */
.cform__section { margin-top: 2.4rem; }
.cform__section > header { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; }
.cform__num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center;
  background: var(--teal); color: #fff; font-family: var(--font-display); font-weight: 700; }
.cform__section h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--navy); letter-spacing: -0.01em; }
.cform__section > p { max-width: 110ch; margin-bottom: 0.9rem; }
.cform__sub { font-family: var(--font-display); font-weight: 700; color: var(--navy); font-size: 1.05rem; margin: 1.6rem 0 0.6rem; }

/* ---- Inputs ---- */
.cform textarea, .cform input[type="text"], .cform input[type="email"] {
  width: 100%; display: block; border: 0; border-radius: 0; background: var(--field); color: var(--ink);
  font: inherit; font-size: 0.92rem; line-height: 1.4; padding: 0.55rem 0.6rem;
  outline: 2px solid transparent; outline-offset: -2px; transition: outline-color 0.15s, background 0.15s;
}
.cform textarea { resize: none; overflow: hidden; min-height: 2.5rem; }
.cform textarea:focus, .cform input:focus { outline-color: var(--teal); background: #fff; }
.cform .is-invalid { outline-color: #c0392b !important; background: #fdf1f0 !important; }

.cform__who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-top: 1.4rem; }
.cform__who label, .cform__label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--navy); margin-bottom: 0.3rem; }
.cform__who .req { color: #c0392b; }
.cform__who input { border: 1px solid var(--rule); border-radius: 6px; }
.cform__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Tables ---- */
.ftable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ftable th { background: var(--navy); color: #fff; text-align: left; vertical-align: top; font-size: 0.78rem; font-weight: 600;
  line-height: 1.3; padding: 0.55rem 0.6rem; border: 1px solid var(--navy); border-right-color: rgba(255, 255, 255, 0.35); }
.ftable th:last-child { border-right-color: var(--navy); }
.ftable td { border: 1px solid var(--rule); padding: 0; vertical-align: top; background: var(--field); }
.ftable td.ftable__q { background: #fff; padding: 0.6rem 0.7rem; font-size: 0.9rem; width: 42%; vertical-align: middle; }
.ftable tr.is-example td { background: var(--example); color: var(--ink-muted); font-style: italic; font-size: 0.82rem; padding: 0.5rem 0.6rem; }
.ftable .ftable__step { width: 52px; text-align: center; background: #fff; }
.ftable td.ftable__step { font-family: var(--font-display); font-weight: 700; color: var(--navy); padding-top: 0.6rem; }
.ftable tr.is-example td.ftable__step { font-weight: 400; font-family: inherit; color: var(--ink-muted); }
.ftable .ftable__tools { width: 38px; background: #fff; text-align: center; vertical-align: middle; border-left: 0; }
.ftable th.ftable__tools, .ftable th.ftable__step { background: var(--navy); }
.row-remove { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule); background: #fff; color: var(--ink-muted);
  cursor: pointer; font-size: 1rem; line-height: 1; display: inline-grid; place-items: center; transition: all 0.15s; }
.row-remove:hover, .row-remove:focus-visible { border-color: #c0392b; color: #c0392b; background: #fdf1f0; }
.row-add { margin-top: 0.6rem; display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer;
  border: 1.5px dashed var(--teal); background: #fff; color: var(--teal); font: inherit; font-weight: 700; font-size: 0.88rem;
  padding: 0.5rem 0.95rem; border-radius: 8px; transition: all 0.15s; }
.row-add:hover, .row-add:focus-visible { background: var(--teal); color: #fff; border-style: solid; }

/* ---- Checklist ---- */
.fcheck { list-style: none; padding: 0; display: grid; gap: 0.55rem; margin-top: 0.3rem; }
.fcheck label { display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer; }
.fcheck input { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 0.15rem; accent-color: var(--teal); cursor: pointer; }

/* ---- Uploads ---- */
.fdrop { margin-top: 1.2rem; border: 2px dashed var(--rule); border-radius: 12px; background: var(--field); text-align: center;
  padding: 1.6rem 1rem; transition: all 0.15s; }
.fdrop.is-over { border-color: var(--teal); background: #e3f0f6; }
.fdrop strong { display: block; color: var(--navy); font-size: 1rem; }
.fdrop p { color: var(--ink-muted); font-size: 0.84rem; margin-top: 0.3rem; }
.fdrop button { margin-top: 0.8rem; cursor: pointer; border: 0; background: var(--navy); color: #fff; font: inherit; font-weight: 700;
  font-size: 0.9rem; padding: 0.6rem 1.2rem; border-radius: 8px; }
.fdrop button:hover { background: var(--teal); }
.ffiles { list-style: none; padding: 0; margin-top: 0.8rem; display: grid; gap: 0.5rem; }
.ffiles li { display: grid; grid-template-columns: 1fr auto auto; gap: 0.8rem; align-items: center; border: 1px solid var(--rule);
  border-radius: 8px; padding: 0.55rem 0.8rem; background: #fff; position: relative; overflow: hidden; }
.ffiles .ffile__name { font-weight: 600; overflow-wrap: anywhere; }
.ffiles .ffile__meta { color: var(--ink-muted); font-size: 0.82rem; white-space: nowrap; }
.ffiles .is-error .ffile__meta { color: #c0392b; white-space: normal; }
.ffiles .is-done .ffile__meta { color: #1b7f4c; }
.ffile__bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--teal); transition: width 0.2s; }

/* ---- Footer bar ---- */
.cform__actions { margin-top: 2.4rem; padding-top: 1.3rem; border-top: 2px solid var(--teal); display: flex; flex-wrap: wrap;
  align-items: center; gap: 1rem; justify-content: space-between; }
.cform__status { color: var(--ink-muted); font-size: 0.86rem; }
.cform__buttons { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }
.cbtn { cursor: pointer; font: inherit; font-weight: 700; border-radius: 9px; padding: 0.8rem 1.5rem; border: 1.5px solid var(--navy);
  background: var(--navy); color: #fff; transition: all 0.15s; }
.cbtn:hover { background: var(--teal); border-color: var(--teal); }
.cbtn:disabled { opacity: 0.55; cursor: wait; }
.cbtn--ghost { background: #fff; color: var(--ink-muted); border-color: var(--rule); font-weight: 600; }
.cbtn--ghost:hover { background: #fff; color: #c0392b; border-color: #c0392b; }
.cform__error { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 8px; background: #fdf1f0; border: 1px solid #e6b0aa; color: #922b21; }
.cform__error[hidden] { display: none; }

/* ---- Confirmation ---- */
.cform__done { text-align: center; padding: 1rem 0 1.6rem; border-bottom: 2px solid var(--teal); margin-bottom: 1.6rem; }
.cform__done svg { width: 52px; height: 52px; color: #1b7f4c; }
.cform__done h2 { font-family: var(--font-display); color: var(--navy); font-size: 1.6rem; margin-top: 0.4rem; }
.cform__done p { max-width: 62ch; margin: 0.5rem auto 0; }
.cform__done .cform__ref { display: inline-block; margin-top: 0.9rem; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  color: var(--navy); background: var(--field); border: 1px solid var(--rule); border-radius: 8px; padding: 0.45rem 1rem; }
.cform__done .cbtn { margin-top: 1.1rem; }
.is-submitted .row-add, .is-submitted .row-remove, .is-submitted .fdrop, .is-submitted .ffile__remove,
.is-submitted .cform__actions { display: none; }

/* ---- Small screens: each table row becomes a card ---- */
@media (max-width: 860px) {
  .cform__who { grid-template-columns: 1fr; }
  .cform__titles { text-align: left; margin-left: 0; }
  .ftable, .ftable tbody, .ftable tr, .ftable td { display: block; width: 100% !important; }
  .ftable thead { display: none; }
  .ftable tr { border: 1px solid var(--rule); border-radius: 10px; margin-bottom: 0.8rem; overflow: hidden; position: relative; }
  .ftable td { border: 0; border-bottom: 1px solid var(--rule); }
  .ftable td:last-child { border-bottom: 0; }
  .ftable td[data-label]::before { content: attr(data-label); display: block; font-size: 0.74rem; font-weight: 700; font-style: normal;
    color: var(--navy); padding: 0.45rem 0.6rem 0; }
  .ftable tr.is-example td { padding-top: 0.2rem; }
  .ftable tr.is-example td[data-label]::before { padding: 0.25rem 0 0.1rem; }
  .ftable td.ftable__step { text-align: left; padding: 0.4rem 0.6rem; background: var(--navy); color: #fff; }
  .ftable td.ftable__step::before { content: "Step "; }
  .ftable tr.is-example td.ftable__step { background: var(--example); color: var(--ink-muted); }
  .ftable tr.is-example td.ftable__step::before { content: "Example step "; }
  .ftable td.ftable__tools { padding: 0.4rem; text-align: right; }
  .ftable td.ftable__q { padding-bottom: 0.3rem; font-weight: 600; }
  .ffiles li { grid-template-columns: 1fr auto; }
  .ffiles .ffile__meta { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- Print / Save as PDF ---- */
@media print {
  @page { size: landscape; margin: 0.45in; }
  body { background: #fff !important; }
  .nav, .footer, #formGate, .row-add, .row-remove, .fdrop, .ffile__remove, .cform__actions, .cform__done .cbtn,
  .ftable .ftable__tools { display: none !important; }
  .cform { padding: 0; }
  .cform__sheet { box-shadow: none; border-radius: 0; border-top: 0; padding: 0; font-size: 10pt; }
  .cform textarea, .cform input { background: #fff !important; }
  .ftable th, .ftable tr.is-example td, .cform__num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ftable tr, .cform__section > header { break-inside: avoid; }
}

#formGate[hidden] { display: none; }
