/* ---------------- AirLock signing form, iPad-portrait first ---------- */

:root {
  --bg: #0e0e10;
  --surface: #1a1a1d;
  --border: #2a2a30;
  --text: #f1f1f3;
  --muted: #9a9aa3;
  --accent: #ff9447;        /* AirLock amber */
  --accent-dark: #cf6f25;
  --danger: #d83a4c;
  --ok: #50c87d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- top bar ---- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .title {
  font-weight: 600;
  letter-spacing: 0.3px;
}

.lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.lang-btn {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--accent);
  color: #0e0e10;
}

/* ---- main two-pane layout ---- */

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;       /* allow flex children to shrink and scroll */
  padding: 0 20px;
}

/* Agreement pane sits on top, scrolls; form pane below, fixed height. */
.agreement-pane {
  flex: 1 1 45%;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.agreement-pane h2 {
  margin: 0 0 8px 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}

.agreement-body {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
  font-size: 14px;
  line-height: 1.5;
}

.agreement-body h1 { font-size: 18px; margin: 0 0 12px 0; }
.agreement-body h2 { font-size: 15px; margin: 14px 0 6px 0; color: var(--text); text-transform: none; letter-spacing: 0; }
.agreement-body p  { margin: 6px 0; }
.agreement-body ul { margin: 6px 0; padding-left: 20px; }
.agreement-body li { margin: 3px 0; }
.agreement-body table { font-size: 12px; border-collapse: collapse; margin: 6px 0; }
.agreement-body td { border: 1px solid var(--border); padding: 4px 8px; }
.agreement-body strong { color: var(--accent); font-weight: 600; }
.agreement-body code { background: var(--bg); padding: 1px 4px; border-radius: 3px; }

.fields-pane {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0 20px 0;
}

.fields-pane h2 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}

/* ---- fields ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.field input {
  appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 18px;
  font-family: inherit;
  min-height: 48px;       /* Apple HIG minimum tap target */
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.row { display: flex; gap: 12px; }
.row .grow { flex: 1 1 0; }

/* ---- signature ---- */

.sig-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 4px 0 0 0;
  background: var(--surface);
}

.sig-block legend {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
  padding: 0 6px;
}

#sig {
  width: 100%;
  height: 220px;
  background: #f8f8f4;     /* off-white so a black stroke is visible & PDF-friendly */
  border-radius: 8px;
  touch-action: none;       /* prevent scroll while signing */
  display: block;
}

.sig-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.sig-hint { font-size: 12px; color: var(--muted); }

/* ---- buttons ---- */

button {
  font-family: inherit;
}

.btn-primary, .btn-secondary, .btn-danger {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: var(--accent);
  color: #0e0e10;
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* ---- done view ---- */

#done-view {
  display: flex;
  align-items: center;
  justify-content: center;
}

.done-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 40px 32px 40px;
  max-width: 460px;
  text-align: center;
}

.done-card h2 {
  color: var(--ok);
  margin: 0 0 10px 0;
  font-size: 28px;
}

.done-time { color: var(--muted); margin: 4px 0 12px 0; }
.done-msg  { margin: 0 0 12px 0; font-size: 18px; line-height: 1.4; }
.done-note { color: var(--muted); font-size: 14px; margin: 0 0 16px 0; }

/* ---- admin bar ---- */

.admin-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.admin-count {
  font-size: 13px;
  color: var(--muted);
}

.admin-bar button {
  padding: 8px 14px;
  font-size: 14px;
  min-height: 36px;
}
