/* Got capture and signing kit (got-kit.js): camera, signature pad, on-screen signing, QR scanner.
   Shared by /account/ and /admin/; its own colours so it looks the same on both. */
:root {
  --gk-bg: #05080c; --gk-surface: #111a24; --gk-surface-2: #16212d; --gk-line: #2a3a4d;
  --gk-text: #f2f7fc; --gk-muted: #9fb0c3; --gk-mint: #2fe0ad; --gk-ink: #04241b; --gk-danger: #ff7a7a;
  --gk-paper: #ffffff; --gk-paper-text: #14181d;
}
html.gk-locked, html.gk-locked body { overflow: hidden; overscroll-behavior: none; }

.gk-overlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column;
  background: var(--gk-bg); color: var(--gk-text);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
}
.gk-overlay [hidden] { display: none !important; }
.gk-overlay * { box-sizing: border-box; }
/* The page's own button look (shadows, margins) never leaks into the kit. */
.gk-overlay button, .gk-pad button, .gk-overlay label.gk-btn { box-shadow: none; margin: 0; letter-spacing: normal; text-transform: none; width: auto; }
.gk-overlay .gk-wide { width: 100%; }
/* The page's own element rules (account.css: sticky dark header, muted p, column labels, full-width inputs) stay outside. */
.gk-overlay header, .gk-agreement header, .gk-agreement .gk-agreement-head { position: static; top: auto; z-index: auto; display: block; padding: 0; margin: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; }
.gk-agreement p, .gk-agreement li, .gk-agreement td, .gk-agreement th { color: inherit; line-height: 1.6; }
.gk-agreement h1, .gk-agreement h2, .gk-agreement h3 { color: var(--gk-paper-text); letter-spacing: normal; font-weight: 700; }
.gk-overlay label.gk-check { flex-direction: row; color: var(--gk-text); font-weight: 400; font-size: 16px; }
.gk-overlay .gk-check input { width: 24px; height: 24px; padding: 0; border-radius: 4px; background: none; box-shadow: none; }
.gk-overlay .gk-sign-intro p, .gk-overlay .gk-small-text { color: var(--gk-muted); }
.gk-overlay .gk-state p { color: var(--gk-text); }
.gk-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex: none; }
.gk-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; min-width: 0; }
.gk-close { background: transparent; color: var(--gk-text); border: 1px solid var(--gk-line); border-radius: 10px; padding: 9px 14px; font: inherit; font-size: 15px; cursor: pointer; flex: none; }
.gk-close:disabled { opacity: .4; }

.gk-btn { font: inherit; font-size: 16px; font-weight: 600; border-radius: 12px; padding: 13px 20px; cursor: pointer; border: 1px solid transparent; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.gk-btn:disabled { opacity: .45; cursor: not-allowed; }
.gk-primary { background: linear-gradient(135deg, var(--gk-mint), #25c99a); color: var(--gk-ink); }
.gk-ghost { background: transparent; color: var(--gk-text); border-color: var(--gk-line); }
.gk-small { font-size: 14px; padding: 8px 13px; min-height: 40px; border-radius: 10px; }
.gk-wide { width: 100%; }

/* ── camera ── */
.gk-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; margin: 0 12px; border-radius: 18px; }
.gk-video, .gk-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gk-shot { object-fit: contain; background: #000; }
.gk-video.gk-mirror { transform: scaleX(-1); }
.gk-frame { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .55); pointer-events: none; border: 3px solid rgba(255, 255, 255, .95); }
.gk-oval { width: min(66%, 300px); aspect-ratio: 3 / 4; border-radius: 50%; }
.gk-card { width: min(88%, 520px); aspect-ratio: 85.6 / 54; border-radius: 14px; }
.gk-page { height: min(82%, 640px); aspect-ratio: 1 / 1.414; max-width: 86%; border-radius: 6px; }
.gk-qr { width: min(72%, 320px); aspect-ratio: 1; border-radius: 18px; border-style: solid; border-color: var(--gk-mint); }
.gk-card::after, .gk-page::after { content: ''; position: absolute; inset: 8px; border: 1px dashed rgba(255, 255, 255, .45); border-radius: inherit; }
.gk-hint { margin: 10px 18px 0; font-size: 15px; line-height: 1.45; color: var(--gk-muted); text-align: center; flex: none; }
.gk-status { margin: 6px 18px 0; min-height: 1.4em; font-size: 14.5px; text-align: center; color: var(--gk-text); flex: none; }
.gk-status.error { color: #ffd5dc; }
.gk-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 14px 18px 18px; flex: none; }
.gk-overlay .gk-shutter, .gk-shutter { width: 76px; min-width: 76px; padding: 0; flex: none; aspect-ratio: 1; height: 76px; border-radius: 50%; border: 5px solid #fff; background: var(--gk-mint); cursor: pointer; box-shadow: 0 0 0 4px rgba(47, 224, 173, .25); grid-column: 2; }
.gk-shutter:disabled { opacity: .4; }
.gk-shutter:active:not(:disabled) { transform: scale(.94); }
.gk-side { background: rgba(255, 255, 255, .08); color: var(--gk-text); border: 1px solid var(--gk-line); border-radius: 999px; padding: 10px 14px; font: inherit; font-size: 14px; cursor: pointer; justify-self: center; }
.gk-torch { grid-column: 1; }
.gk-flip { grid-column: 3; }
.gk-torch.on { background: #f5c04e; color: #241a00; border-color: #f5c04e; }
.gk-review { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 18px 18px; flex: none; }
.gk-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 14px; padding: 24px; background: var(--gk-surface); }
.gk-fallback-text { margin: 0; font-size: 17px; line-height: 1.5; color: var(--gk-text); text-align: center; }
.gk-pick { position: relative; overflow: hidden; }
.gk-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.gk-scan-controls { grid-template-columns: 1fr; padding: 8px 18px 0; }
.gk-scan-controls .gk-torch { grid-column: 1; }
.gk-kind-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 16px 0; flex: none; }
.gk-kind-row .gk-kind { margin-left: auto; }
.gk-overlay .gk-again { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.gk-manual { display: flex; gap: 10px; align-items: flex-end; padding: 10px 16px 18px; flex: none; }
.gk-manual label { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--gk-muted); min-width: 0; }
.gk-manual input { font: inherit; font-size: 18px; letter-spacing: .08em; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--gk-line); background: var(--gk-surface); color: var(--gk-text); width: 100%; }

/* ── signature pad ── */
.gk-pad { display: block; }
.gk-pad-frame { position: relative; width: 100%; aspect-ratio: 5 / 2; background: var(--gk-paper); border-radius: 12px; border: 1px solid var(--gk-line); overflow: hidden; touch-action: none; }
.gk-pad-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: crosshair; }
.gk-pad-line { position: absolute; left: 6%; right: 6%; bottom: 24%; border-bottom: 1.5px solid #c9d2dc; pointer-events: none; }
.gk-pad-place { position: absolute; left: 7%; bottom: 26%; color: #9aa6b2; font-size: 15px; pointer-events: none; }
.gk-pad-off .gk-pad-frame { opacity: .45; }
.gk-pad-off .gk-pad-canvas { cursor: not-allowed; }
.gk-pad-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.gk-pad-bar .gk-btn { margin: 0; }
.gk-pad-state { margin-left: auto; font-size: 14px; color: var(--gk-muted, #93a4b8); }
.gk-pad-state.ok { color: var(--gk-mint); font-weight: 600; }
.gk-landscape .gk-land-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 12px; }
.gk-landscape .gk-land-frame { width: auto; aspect-ratio: auto; }
.gk-landscape .gk-pad-bar { padding: 0 16px 14px; margin: 0; }
.gk-landscape .gk-btn.gk-ghost { color: var(--gk-text); }

/* ── on-screen signing ── */
.gk-signing { background: var(--gk-surface); }
.gk-sign-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 24px; outline: none; }
.gk-sign-intro p { font-size: 15px; line-height: 1.55; color: var(--gk-muted); margin: 4px 0 14px; }
.gk-agreement { background: var(--gk-paper); color: var(--gk-paper-text); border-radius: 14px; padding: 18px 16px; font-size: 15px; line-height: 1.6; }
.gk-agreement h1 { font-size: 21px; margin: 0 0 4px; line-height: 1.25; }
.gk-agreement .gk-agreement-sub { font-size: 13px; color: #4a5562; margin: 0 0 14px; }
.gk-agreement h2 { font-size: 16.5px; margin: 20px 0 6px; line-height: 1.3; }
.gk-agreement h3 { font-size: 15px; margin: 14px 0 4px; }
.gk-agreement p { margin: 0 0 10px; overflow-wrap: anywhere; }
.gk-agreement p.small { font-size: 13px; color: #3c4652; }
.gk-agreement .gk-notice { border: 2px solid #14181d; border-radius: 10px; padding: 4px 12px 8px; margin: 16px 0; }
.gk-agreement .gk-table { overflow-x: auto; margin: 6px 0 12px; }
.gk-agreement table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gk-agreement th, .gk-agreement td { text-align: left; vertical-align: top; padding: 6px 6px; border-bottom: 1px solid #dde3ea; overflow-wrap: anywhere; }
.gk-agreement tbody th { font-weight: 600; width: 45%; color: #26303a; }
.gk-agreement tr.strong td, .gk-agreement tr.strong th { font-weight: 700; }
.gk-agreement .gk-signing-note { border-top: 1px solid #dde3ea; margin-top: 16px; }
.gk-agreement-end { font-weight: 700; text-align: center; margin: 18px 0 2px !important; color: #14181d; }
.gk-sign-tail h2 { font-size: 17px; margin: 22px 0 8px; }
.gk-check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.45; margin: 10px 0; padding: 12px; border: 1px solid var(--gk-line); border-radius: 12px; background: var(--gk-surface-2); cursor: pointer; }
.gk-check input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--gk-mint); }
.gk-check:has(input:disabled) { opacity: .5; }
.gk-lock { font-size: 14px; color: #f5c04e; margin: 6px 0; }
.gk-small-text { font-size: 14px; color: var(--gk-muted); margin: 0 0 8px; line-height: 1.5; }
.gk-selfie-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gk-thumb { width: 84px; height: 112px; object-fit: cover; border-radius: 12px; border: 2px solid var(--gk-mint); }
.gk-msg { margin: 14px 0; font-size: 15px; line-height: 1.45; }
.gk-msg:empty { display: none; }
.gk-msg.error { padding: 12px 14px; border-radius: 12px; border: 1px solid #7a3246; background: #24111a; color: #ffd5dc; }
.gk-msg.ok { color: var(--gk-mint); }
.gk-read { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--gk-line); background: var(--gk-bg); flex: none; font-size: 14px; }
.gk-read-bar { flex: 0 0 64px; height: 6px; border-radius: 6px; background: var(--gk-line); overflow: hidden; }
.gk-read-bar span { display: block; height: 100%; width: 0; background: var(--gk-mint); transition: width .2s; }
.gk-read-text { flex: 1; color: var(--gk-muted); }
.gk-read.done .gk-read-text { color: var(--gk-mint); font-weight: 600; }
.gk-state { display: flex; flex-direction: column; gap: 14px; align-items: stretch; padding: 40px 6px; text-align: center; font-size: 16px; }
.gk-state p { margin: 0; line-height: 1.5; color: var(--gk-text); }
.gk-success h3 { margin: 0; font-size: 22px; }
.gk-tick { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; font-size: 40px; color: var(--gk-ink); background: var(--gk-mint); }

@media (min-width: 720px) {
  .gk-sign-body { padding: 8px max(16px, calc(50% - 360px)) 28px; }
  .gk-stage { margin: 0 auto; width: min(100% - 24px, 760px); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .gk-camera .gk-hint { display: none; }
  .gk-camera .gk-controls { padding: 6px 18px 8px; }
  .gk-overlay .gk-shutter, .gk-shutter { width: 60px; min-width: 60px; height: 60px; }
}
@media (prefers-reduced-motion: reduce) { .gk-overlay * { transition: none !important; } }
