/* IBEW Local 649 registration — public pages. Mobile first. Navy accent, amber warnings, never red. */

:root {
  --navy: #1e3a5f;
  --navy-2: #2b4d7a;
  --navy-tint: #e8eef6;
  --amber: #a86c0c;
  --amber-fill: #fff6e0;
  --amber-line: #d9a63a;
  --green: #1e6b3a;
  --green-fill: #e9f4ec;
  --ink: #1a2330;
  --muted: #5c6675;
  --line: #d5dce6;
  --bg: #eef1f5;
  --card: #ffffff;
  --focus: #2b6cb0;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.45; color: var(--ink); background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Layout */
#app, .wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 32px; }
.narrow { max-width: 520px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; object-fit: contain; flex: 0 0 auto; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { font-size: 16px; color: var(--navy); }
.brand small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lang-link { font-size: 14px; font-weight: 600; color: var(--navy); text-decoration: underline; white-space: nowrap; }
.btn.sm-btn { font-size: 14px; padding: 8px 14px; min-height: 38px; }
.toplinks { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (min-width: 520px) { .toplinks { flex-direction: row; gap: 16px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; }
.card + .card { margin-top: 14px; }

/* Progress */
.progress { height: 6px; background: var(--navy-tint); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--navy); transition: width .25s; }
.step-count { font-size: 13px; color: var(--muted); margin-top: 8px; letter-spacing: .04em; text-transform: uppercase; }
.step-title { font-size: 22px; line-height: 1.25; margin: 4px 0 6px; color: var(--navy); text-wrap: balance; }
.step-intro { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.notice { background: var(--navy-tint); color: var(--navy); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 6px 0 10px; }

/* Fields */
.field { margin-top: 18px; }
.label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.label .opt { font-weight: 400; color: var(--muted); }
.help { font-size: 14px; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 17px; /* 16px minimum: iOS zooms below that */
  color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 13px 14px; min-height: 50px; appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.has-error input, .has-error select, .has-error textarea, .has-error .sig-box { border-color: var(--amber-line); }
.field-error { margin-top: 6px; font-size: 14px; color: var(--amber); font-weight: 600; background: var(--amber-fill); border-left: 4px solid var(--amber-line); padding: 8px 10px; border-radius: 6px; }

.date-row { display: grid; gap: 8px; }
.date-row.three { grid-template-columns: 1.4fr 1fr 1.1fr; }
.date-row.two { grid-template-columns: 1.4fr 1fr; }

.radio-group { border: none; margin: 0; padding: 0; }
.radio-group legend { padding: 0; }
.choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px; border: 1.5px solid var(--line); border-radius: 10px; margin-top: 8px; cursor: pointer; font-size: 16px; background: #fff; }
.choice input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--navy); }
.choice:has(input:checked) { border-color: var(--navy); background: var(--navy-tint); }
.choice.strong { font-weight: 600; }

.read-h { font-size: 16px; color: var(--navy); margin: 0 0 8px; }
.read-box { background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; max-height: 40vh; overflow-y: auto; }
.read-box p { margin: 0 0 10px; } .read-box p:last-child { margin-bottom: 0; }

/* Photos */
.photo-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.photo-status { font-size: 14px; color: var(--green); font-weight: 600; margin-top: 8px; min-height: 1.2em; }
.photo-preview { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f4f6fa; }
.photo-preview img { display: block; width: 100%; max-height: 320px; object-fit: contain; }

/* Signature */
.sig-box { position: relative; height: 180px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.sig-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.sig-hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #b7bfcb; font-size: 15px; pointer-events: none; }
.sig-tools { display: flex; justify-content: space-between; margin-top: 6px; }
.sig-typed { margin-top: 10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 17px; font-weight: 700; border-radius: 10px; padding: 14px 18px; min-height: 50px; border: 2px solid transparent; cursor: pointer; text-decoration: none; text-align: center; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:active { background: var(--navy-2); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-warn { background: var(--amber); color: #fff; }
.linkbtn { background: none; border: none; font: inherit; font-size: 14px; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 6px 0; }
.nav { display: flex; gap: 10px; margin-top: 24px; }
.nav .btn { flex: 1; }
.nav .btn-primary { flex: 2; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1 1 auto; }
.foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px; font-size: 13px; color: var(--muted); }
.draft-status { font-size: 13px; }

/* Panels */
.panel { text-align: left; }
.panel.gate { text-align: center; padding-top: 26px; }
.panel.gate .panel-body { margin: 0 auto; max-width: 34em; }
.panel.gate .actions { justify-content: center; }
.panel.gate .actions .btn { flex: 0 1 auto; min-width: 220px; }
.panel.gate .spinner { margin: 6px auto 10px; }
.gate-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; }
.gate-logo img { width: 96px; height: 96px; border-radius: 50%; background: #fff; object-fit: contain; }
.gate-logo span { font-size: 15px; font-weight: 800; letter-spacing: .18em; color: var(--navy); }
.gate-pin { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.gate-help { margin: 14px 2px 0; font-size: 15px; color: var(--ink); }
.gate-help a { color: var(--navy); font-weight: 700; }
.panel-title { font-size: 21px; margin: 6px 0 8px; color: var(--navy); }
.panel-body { margin: 0; font-size: 16px; }
.panel-warn { border-left: 6px solid var(--amber-line); }
.panel-ok { border-left: 6px solid var(--green); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--navy-tint); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .progress-bar { transition: none; } }

/* Dialog */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 45, .5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.dialog { width: 100%; max-width: 420px; }
.dialog h2 { margin: 0 0 6px; font-size: 19px; color: var(--navy); }

/* Staff menu (index) */
.menu { display: grid; gap: 12px; margin-top: 12px; }
.menu a { display: block; padding: 16px 18px; border: 2px solid var(--navy); border-radius: 10px; color: var(--navy); font-weight: 700; text-decoration: none; background: #fff; }
.menu a small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.menu a.quiet { border-color: var(--line); color: var(--muted); }

h1 { font-size: 22px; color: var(--navy); margin: 0 0 8px; }
p { margin: 0 0 10px; }

/* Help chat widget (js/chat-widget.js). --c649-kb tracks the iOS keyboard via visualViewport. */
:root { --c649-kb: 0px; }
#c649-btn { position: fixed; right: 16px; bottom: calc(16px + var(--c649-kb) + env(safe-area-inset-bottom, 0px)); z-index: 9998; background: var(--navy); color: #fff; border: none; border-radius: 999px; padding: 13px 18px; font: 700 15px -apple-system, "Segoe UI", Roboto, Arial, sans-serif; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; }
#c649-panel { position: fixed; right: 16px; bottom: calc(16px + var(--c649-kb) + env(safe-area-inset-bottom, 0px)); z-index: 9999; width: min(380px, calc(100vw - 32px)); height: min(540px, calc(100vh - 32px - var(--c649-kb))); display: none; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); overflow: hidden; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
#c649-panel.on { display: flex; }
@media (max-width: 480px) { #c649-panel { top: 0; left: 0; right: 0; bottom: var(--c649-kb); width: auto; height: auto; border-radius: 0; } }
#c649-head { background: var(--navy); color: #fff; padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; }
#c649-head strong { font-size: 15px; }
#c649-x { background: transparent; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
#c649-note { background: var(--amber-fill); color: #7a5b00; font-size: 12px; padding: 8px 14px; border-bottom: 1px solid var(--amber-line); line-height: 1.4; }
#c649-log { flex: 1; overflow-y: auto; padding: 14px; background: #f4f6fa; }
#c649-intro { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.c649-m { margin-bottom: 11px; max-width: 86%; }
.c649-m .w { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 700; }
.c649-m .t { padding: 9px 12px; border-radius: 12px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.c649-m.me { margin-left: auto; } .c649-m.me .w { text-align: right; }
.c649-m.me .t { background: var(--navy); color: #fff; border-bottom-right-radius: 3px; }
.c649-m.them .t { background: #fff; color: var(--ink); border: 1px solid #d8dee8; border-bottom-left-radius: 3px; }
#c649-sys { font-size: 12px; color: var(--muted); text-align: center; margin: 8px 0; }
#c649-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e2e6ee; background: #fff; }
#c649-in { flex: 1; border: 1.5px solid #cbd3e0; border-radius: 10px; padding: 10px; font-size: 16px; font-family: inherit; resize: none; height: 46px; min-height: 46px; }
#c649-send { background: var(--navy); color: #fff; border: none; border-radius: 10px; padding: 0 16px; font-size: 15px; font-weight: 700; cursor: pointer; }
#c649-send:disabled { opacity: .5; }
@media print { #c649-btn, #c649-panel { display: none !important; } }

@media (min-width: 700px) {
  body { font-size: 17px; }
  #app, .wrap { padding-top: 12px; }
  .card { padding: 26px 26px; }
}
