/* ID Card Authorization — paper-style layout, touch-friendly */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border, #dce0e8);
  background: var(--header-bg, rgba(255, 255, 255, 0.92));
  position: sticky;
  top: 0;
  z-index: 10;
}

[data-theme="dark"] .site-header {
  --header-bg: rgba(15, 18, 25, 0.9);
  --border: #2a3348;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.95rem;
}

.site-header a {
  color: var(--auth-accent);
  text-decoration: none;
}

.site-header a:hover {
  text-decoration: underline;
}

.logo {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.logo-sub {
  font-weight: 400;
  font-size: 0.88rem;
  opacity: 0.85;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font-size: 1.1rem;
}

.auth-body {
  --auth-paper: #fffef9;
  --auth-ink: #1a1a1a;
  --auth-line: #333;
  --auth-accent: #1e3a5f;
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  background: var(--bg, #e8eaef);
  color: var(--auth-ink);
}

[data-theme="dark"] .auth-body {
  --auth-paper: #1c222e;
  --auth-ink: #e8ecf4;
  --auth-line: #6b7a94;
  --auth-accent: #7eb8ff;
}

.auth-header.site-header {
  font-family: "DM Sans", system-ui, sans-serif;
}

.auth-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.auth-paper-wrap {
  display: flex;
  justify-content: center;
}

.auth-paper {
  width: 100%;
  max-width: 816px;
  background: var(--auth-paper);
  border: 1px solid var(--border, #ccc);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 2rem 2.25rem 2.5rem;
  color: var(--auth-ink);
}

.auth-brand {
  text-align: center;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--auth-accent);
  margin: 0 0 0.35rem;
}

.auth-title {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: 0.02em;
}

.auth-instructions {
  text-align: center;
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.auth-instructions a {
  color: var(--auth-accent);
}

.auth-lead {
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.auth-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1.25rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: text;
  min-height: 3.25rem;
}

.auth-field--full {
  grid-column: 1 / -1;
}

.auth-field--short {
  max-width: 100%;
}

.auth-label {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="tel"],
.auth-field input[type="number"],
.auth-field input[type="date"] {
  font-family: inherit;
  font-size: 1.05rem;
  padding: 0.55rem 0.35rem;
  border: none;
  border-bottom: 2px solid var(--auth-line);
  background: transparent;
  color: inherit;
  border-radius: 0;
  min-height: 44px;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.auth-field input:focus {
  outline: none;
  border-bottom-color: var(--auth-accent);
  background: rgba(30, 58, 95, 0.06);
}

[data-theme="dark"] .auth-field input:focus {
  background: rgba(126, 184, 255, 0.08);
}

.auth-field.auth-field--invalid input {
  border-bottom-color: #c62828;
}

.auth-opt {
  font-weight: 400;
  font-size: 0.8rem;
  opacity: 0.85;
}

.auth-design {
  border: 1px solid var(--auth-line);
  margin: 1.25rem 0;
  padding: 0.75rem 1rem 1rem;
}

.auth-design legend {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.35rem;
}

.auth-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0;
  min-height: 48px;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.4;
}

.auth-radio input {
  width: 22px;
  height: 22px;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--auth-accent);
}

.auth-signature-section {
  margin-top: 1.5rem;
}

.auth-sig-heading {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 1rem;
}

.auth-sig-pad-wrap {
  margin-top: 0.75rem;
  background: #fff;
  border: 2px solid var(--auth-line);
  border-radius: 4px;
  padding: 0;
  overflow: hidden;
}

[data-theme="dark"] .auth-sig-pad-wrap {
  background: #0f1219;
}

.auth-sig-pad {
  display: block;
  width: 100%;
  height: 200px;
  max-height: 40vh;
  border: none;
  background: transparent;
  touch-action: none;
  cursor: crosshair;
}

.auth-sig-hint {
  font-size: 0.78rem;
  text-align: center;
  margin: 0.4rem 0 0.5rem;
  opacity: 0.8;
}

.auth-legal {
  margin: 1.25rem 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.45;
}

.auth-consent {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  cursor: pointer;
}

.auth-consent input {
  width: 22px;
  height: 22px;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
  font-family: "DM Sans", system-ui, sans-serif;
}

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  min-height: 48px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--primary {
  background: var(--auth-accent);
  color: #fff;
}

.btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border, #999);
  color: inherit;
}

.auth-msg {
  font-family: "DM Sans", system-ui, sans-serif;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.auth-msg.hidden { display: none; }
.auth-msg--err { background: #fde8e8; color: #991b1b; }
.auth-msg--ok { background: #e8f5e9; color: #166534; }

.auth-success {
  max-width: 640px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--surface, #fff);
  border-radius: 12px;
  text-align: center;
  font-family: "DM Sans", system-ui, sans-serif;
}

.auth-success.hidden,
.auth-paper-wrap.hidden { display: none; }

.hidden { display: none !important; }

.auth-success h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  margin-top: 0;
}

.auth-success .btn {
  margin: 0.5rem;
}

@media (max-width: 640px) {
  .auth-paper {
    padding: 1.25rem 1rem 1.75rem;
  }

  .auth-fields {
    grid-template-columns: 1fr;
  }

  .auth-field--short {
    max-width: none;
  }

  .auth-sig-pad {
    height: 180px;
  }
}

@media print {
  .auth-header,
  .auth-actions,
  .auth-legal,
  .auth-msg,
  #clear-signature,
  .theme-toggle {
    display: none !important;
  }

  .auth-body {
    background: #fff;
  }

  .auth-paper {
    box-shadow: none;
    border: none;
    max-width: none;
  }
}
