:root {
  --green: #0f3d2e;
  --green-light: #1c6b4f;
  --bg: #f6f7f6;
  --border: #d9ddd9;
  --text: #1a1a1a;
}
* { box-sizing: border-box; }
/* Never let a page exceed the phone's width (no awkward horizontal scrolling). */
html, body { max-width: 100%; overflow-x: hidden; }
img, canvas, video, table { max-width: 100%; }
.legal-box, .qual-doc { overflow-wrap: break-word; }
body { margin: 0; font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.45; }
.site-header { background: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 14px;
               border-bottom: 1px solid var(--border); }
.brand { text-decoration: none; display: inline-flex; align-items: center; }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-mark { font-weight: 800; font-size: 19px; color: var(--green); letter-spacing: .01em; }
.tag { color: #8a8f8c; font-size: 13px; margin-left: auto; font-weight: 600; }
.container { max-width: 860px; margin: 0 auto; padding: 28px 20px 60px; }
h1 { color: var(--green); margin: 0 0 6px; }
h2 { color: var(--green); font-size: 17px; margin: 0 0 10px; }
.lead { color: #555; margin: 0 0 22px; }
.muted { color: #999; } .small { font-size: 13px; }
.req { color: #b42d2d; font-style: normal; }
.help { display: block; color: #888; font-size: 12px; margin-top: 3px; }
a { color: var(--green-light); }

/* form */
/* min-width:0 overrides the browser default (fieldsets are min-width:min-content), which otherwise
   stops them shrinking below their content and causes horizontal overflow on narrow phones. */
fieldset { border: 1px solid var(--border); border-radius: 12px; background: #fff;
           padding: 18px 18px 6px; margin: 0 0 18px; min-width: 0; }
legend { font-weight: 700; color: var(--green); padding: 0 8px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
/* min-width:0 lets grid/flex items shrink below their content's intrinsic width — without it a
   wide native control (e.g. an iOS date input) forces its column wider and overlaps the neighbor. */
.field { display: flex; flex-direction: column; margin-bottom: 12px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.lbl { font-size: 13px; font-weight: 600; color: #3a4a44; margin-bottom: 5px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--border);
       border-radius: 8px; background: #fff; width: 100%; min-width: 0; max-width: 100%; }
/* Native date/time inputs ignore width:100% on iOS Safari without an appearance reset. */
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"] {
       -webkit-appearance: none; appearance: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-light);
       box-shadow: 0 0 0 3px rgba(28,107,79,.15); }
textarea { resize: vertical; }
.check { flex-direction: row; display: flex; gap: 9px; align-items: flex-start; font-size: 14px; }
.check input { width: 17px; height: 17px; margin-top: 2px; flex-shrink: 0; }
.yesno { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.yesno label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.yesno input { width: auto; }

/* buttons */
.btn { display: inline-block; background: var(--green); color: #fff; padding: 10px 18px;
       border-radius: 7px; text-decoration: none; font-weight: 600; border: none; cursor: pointer; font-size: 15px; }
.btn:hover { background: var(--green-light); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--green); border: 1px solid var(--border, #d9ddd9); }
.btn.ghost:hover { background: #f0f4f2; }
.who { display: flex; align-items: center; gap: 10px; }

/* Disclosure / authorization box on the form */
.legal-box { max-height: 320px; overflow-y: auto; border: 1px solid #d9ddd9; border-radius: 8px;
             padding: 14px 18px; background: #fbfcfb; font-size: 12.5px; line-height: 1.5; color: #333; }
.legal-box h3.lt { font-size: 15px; font-weight: 800; color: #222; margin: 4px 0 8px; }
.legal-box h4.lh { font-size: 13.5px; font-weight: 700; color: #222; margin: 16px 0 6px; }
.legal-box p { margin: 0 0 8px; }

input.locked { background: #eef0ee; color: #666; cursor: not-allowed; }

/* per-field validation errors */
.field.has-error .lbl { color: #b42d2d; }
.field.has-error input:not([type=radio]):not([type=checkbox]),
.field.has-error select, .field.has-error textarea { border-color: #d98b8b; }
.field-error { display: block; color: #b42d2d; font-size: 12px; font-weight: 700;
               font-style: italic; margin-top: 4px; }

/* document uploads */
.doc-list { margin-top: 6px; }
.doc-slot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
            gap: 12px; padding: 14px 4px; border-top: 1px solid var(--border); }
.doc-error-msg { flex-basis: 100%; color: #b42d2d; font-size: 13px; font-weight: 600; margin-top: 4px; }
.doc-slot.doc-error { background: #fff6f6; }
.doc-slot:last-child { border-bottom: 1px solid var(--border); }
.doc-info { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.doc-check { color: #168c64; font-weight: 800; width: 14px; display: inline-block; }
.doc-label { font-size: 16px; font-weight: 600; color: #2a3a34; }
.doc-req { color: #8a8f8c; font-size: 13px; font-weight: 400; }
.doc-name { color: var(--green-light); font-size: 13px; }
.doc-actions { display: flex; gap: 8px; flex-shrink: 0; }
[hidden] { display: none !important; }

/* payment */
.pay-summary { max-width: 360px; margin: 0 0 22px; }
.pay-summary-title { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: #8a8f8c;
                     border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 6px; }
.pay-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.pay-table td { padding: 6px 0; color: #3a4a44; }
.pay-table .pay-amt { text-align: right; font-variant-numeric: tabular-nums; }
.pay-table .pay-total td { border-top: 1px solid var(--border); font-weight: 800; color: var(--green); padding-top: 9px; }
.pay-methods { gap: 22px; margin: 4px 0 10px; }
.pay-instr { display: none; background: #f3f8fd; border: 1px solid #d6e4f2; border-radius: 8px;
             padding: 12px 16px; margin: 6px 0 4px; font-size: 14px; line-height: 1.5; }
.pay-instr .btn { margin-left: 8px; }

/* Wizard (multi-step form) */
.wizard-progress { margin: 0 0 22px; }
.wizard-step-label { font-size: 13px; color: #5a6460; margin-bottom: 7px; }
.wizard-step-label strong { color: var(--green); }
.wizard-bar { height: 8px; background: #e6eae7; border-radius: 99px; overflow: hidden; }
.wizard-bar-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s ease; }
.wizard-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.wizard-nav .btn { padding: 11px 26px; font-size: 15px; }
.repeat-entry legend { display: flex; align-items: center; gap: 12px; }
.repeat-entry .repeat-remove { font-weight: 600; }
.repeat-group { margin-top: 8px; }
.repeat-heading { color: var(--green); font-size: 16px; margin: 18px 0 4px; }
.repeat-add { margin: 0 0 18px; }

/* Email-verification flow */
.verify-form { max-width: 380px; margin: 8px 0 4px; }
.verify-form .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.verify-form input { width: 100%; }
.verify-form .btn.submit { margin-top: 14px; width: 100%; }
.code-input { font-size: 28px; letter-spacing: 12px; text-align: center; font-weight: 700;
              padding: 12px; font-variant-numeric: tabular-nums; }
.resume-card { max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 12px;
               padding: 22px 22px 24px; margin-top: 8px; }
.resume-card .btn { width: 100%; }
.verify-alt { display: flex; align-items: center; gap: 16px; margin-top: 14px; max-width: 380px; }
.verify-alt form { margin: 0; }
.notice-ok { background: #eafaf3; color: #146a4d; border: 1px solid #b6e3cf; border-radius: 8px;
             padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.notice-warn { background: #fff7e6; color: #7a5212; border: 1px solid #f1d18a; border-radius: 8px;
               padding: 12px 16px; margin-bottom: 16px; line-height: 1.5; }
.qual-label { font-weight: 700; color: var(--green); margin: 16px 0 6px; }
.qual-doc { max-height: 560px; overflow-y: auto; border: 1px solid #d9ddd9; border-radius: 8px;
            background: #f4f5f4; padding: 8px; }
.qual-pg { width: 100%; display: block; margin: 0 auto 8px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* Signature pad */
.sigpad { width: 100%; }
.sig-canvas { width: 100%; height: 170px; border: 1.5px dashed #c7ccc8; border-radius: 8px;
             background: #fff; touch-action: none; display: block; cursor: crosshair; }
.sig-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.sig-img { max-width: 260px; max-height: 90px; border: 1px solid var(--border, #d9ddd9);
           border-radius: 6px; background: #fff; padding: 4px; }
.btn.submit { margin-top: 6px; padding: 13px 28px; font-size: 16px; }
.btn.danger { background: #b42d2d; margin-top: 14px; }
.btn.danger:hover { background: #962323; }

/* messages + confirm */
.errors { background: #fff2f2; border: 1px solid #f3c2c2; color: #a12c2c; padding: 12px 16px;
          border-radius: 8px; margin-bottom: 20px; }
.notice-ok { background: #eafaf3; color: #146a4d; border: 1px solid #b6e3cf; border-radius: 8px;
             padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.confirm { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 40px; text-align: center; }
.check-badge { width: 56px; height: 56px; line-height: 56px; margin: 0 auto 14px; border-radius: 50%;
               background: #eafaf3; color: #168c64; font-size: 30px; font-weight: 800; border: 2px solid #bfe3d4; }

/* admin */
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip-link { font-size: 13px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
             background: #fff; text-decoration: none; color: #555; }
.chip-link.active { background: var(--green); color: #fff; border-color: var(--green); }
table.admin { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border);
              border-radius: 8px; overflow: hidden; }
table.admin th, table.admin td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
              vertical-align: top; }
table.admin th { background: var(--green); color: #fff; font-size: 13px; }
table.admin td.ck, table.admin th.ck { width: 34px; text-align: center; }
.row-ck, #check-all { width: 16px; height: 16px; }
.chip { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-new { color: #14788c; background: #d8eef3; }
.s-inreview { color: #b07814; background: #fbf0d6; }
.s-approved { color: #168c64; background: #dff4eb; }
.s-declined { color: #b42d2d; background: #fadede; }

.back { margin: 0 0 6px; font-size: 13px; }
.status-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; background: #fff;
               border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 22px; }
.status-form label { font-size: 13px; font-weight: 600; color: #3a4a44; }
.status-form select { margin-top: 5px; }
.status-form .notes { flex: 1; min-width: 220px; }
.detail { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.detail dl { margin: 0; }
.dl-row { display: grid; grid-template-columns: 230px 1fr; gap: 8px 16px; padding: 6px 0; border-bottom: 1px solid #eef1ef; }
.dl-row:last-child { border-bottom: none; }
.detail dt { color: #6a726e; font-size: 13px; } .detail dd { margin: 0; }
.pre { white-space: pre-wrap; }

.login-card { max-width: 360px; margin: 30px auto; background: #fff; border: 1px solid var(--border);
              border-radius: 12px; padding: 26px 24px; }
.login-card label, .pw-form label { display: block; font-size: 14px; font-weight: 600; color: #444; margin-bottom: 12px; }
.login-card input { margin-top: 5px; }
.pw-change { margin-top: 22px; border: 1px solid var(--border); border-radius: 10px; padding: 4px 16px; background: #fff; }
.pw-change summary { cursor: pointer; padding: 12px 0; font-weight: 700; color: var(--green); }
.pw-form { max-width: 340px; padding: 4px 0 16px; }
.site-footer { text-align: center; color: #999; padding: 24px; font-size: 13px; }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .dl-row { grid-template-columns: 1fr; gap: 2px; }
}
