
.consent-modal,
.consent-modal * {
  box-sizing: border-box;
}

.consent-modal[hidden],
.consent-modal [hidden] {
  display: none !important;
}

.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1e293b;
}

.consent-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 65%);
  backdrop-filter: blur(3px);
}

.consent-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(850px, 100%);
  max-height: min(92vh, 1000px);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgb(0 0 0 / 25%);
}

.consent-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
  color: #fff;
  background: linear-gradient(135deg, #075985, #0f766e);
}

.consent-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  opacity: .85;
}

.consent-header h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 27px);
  line-height: 1.4;
}

.consent-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  opacity: .92;
}

.consent-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 10px;
  background: rgb(255 255 255 / 12%);
  color: white;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.consent-close:hover {
  background: rgb(255 255 255 / 24%);
}

.consent-body {
  overflow-y: auto;
  padding: 24px 28px 28px;
}

.consent-notice {
  padding: 15px 17px;
  margin-bottom: 24px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 12px;
}

.consent-notice strong {
  display: block;
  margin-bottom: 5px;
  color: #115e59;
}

.consent-notice p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.8;
}

.consent-section-title {
  margin: 26px 0 15px;
  padding-bottom: 9px;
  border-bottom: 1px solid #e2e8f0;
  color: #0f4c5c;
  font-size: 17px;
  line-height: 1.5;
}

.consent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.consent-full {
  grid-column: 1 / -1;
}

.consent-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.consent-field b,
.consent-check b {
  color: #dc2626;
}

.consent-field input {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 400;
  outline: none;
}

.consent-field input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgb(13 148 136 / 13%);
}

.consent-field input::placeholder {
  color: #94a3b8;
}

.consent-terms {
  padding: 17px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.consent-terms p {
  margin: 0 0 15px;
  font-size: 14px;
  line-height: 1.9;
  color: #334155;
}

.consent-terms p:last-child {
  margin-bottom: 0;
}

.consent-terms strong {
  color: #0f172a;
}

.consent-checks {
  display: grid;
  gap: 13px;
  margin-top: 20px;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 14px;
  line-height: 1.8;
  cursor: pointer;
}

.consent-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: #0f766e;
}

.consent-hint {
  margin: 0 0 12px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.7;
}

.consent-signature-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background:
    linear-gradient(#fff, #fff),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      #f1f5f9 32px
    );
  overflow: hidden;
}

#consentSignature {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.consent-signature-caption {
  position: absolute;
  right: 14px;
  bottom: 10px;
  padding-top: 5px;
  border-top: 1px solid #94a3b8;
  color: #64748b;
  font-size: 11px;
  pointer-events: none;
}

.consent-signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 9px;
}

.consent-date-box {
  margin-top: 20px;
  padding: 15px;
  border-radius: 10px;
  background: #f1f5f9;
}

.consent-date-box span,
.consent-date-box strong {
  display: block;
}

.consent-date-box span {
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
}

.consent-date-box strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.consent-date-box p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.7;
}

.consent-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.7;
}

.consent-message[data-type="success"] {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.consent-message[data-type="error"] {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.consent-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.consent-btn:active {
  transform: translateY(1px);
}

.consent-btn-primary {
  color: #fff;
  background: #0f766e;
}

.consent-btn-primary:hover {
  background: #115e59;
}

.consent-btn-secondary {
  color: #334155;
  background: #fff;
  border-color: #cbd5e1;
}

.consent-btn-secondary:hover {
  background: #f1f5f9;
}

.consent-privacy-note {
  margin: 17px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.consent-saved-section {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.consent-saved-item {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.consent-saved-item h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.consent-saved-item p {
  margin: 4px 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.consent-saved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.consent-saved-actions .consent-btn {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
}

@media (max-width: 600px) {
  .consent-modal {
    padding: 8px;
  }

  .consent-dialog {
    max-height: 96vh;
    border-radius: 14px;
  }

  .consent-header {
    padding: 18px;
  }

  .consent-body {
    padding: 18px;
  }

  .consent-grid {
    grid-template-columns: 1fr;
  }

  .consent-full {
    grid-column: auto;
  }

  .consent-footer-actions {
    flex-direction: column-reverse;
  }

  .consent-footer-actions .consent-btn {
    width: 100%;
  }

  .consent-signature-wrap {
    height: 160px;
  }
}

@media print {
  body.consent-printing > * {
    display: none !important;
  }

  body.consent-printing #consentMount {
    display: block !important;
  }

  body.consent-printing .consent-modal {
    position: static;
    display: block !important;
    padding: 0;
    background: white;
  }

  body.consent-printing .consent-backdrop,
  body.consent-printing .consent-close,
  body.consent-printing .consent-footer-actions,
  body.consent-printing .consent-signature-actions,
  body.consent-printing .consent-privacy-note,
  body.consent-printing .consent-saved-section,
  body.consent-printing .consent-message {
    display: none !important;
  }

  body.consent-printing .consent-dialog {
    display: block;
    width: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
  }

  body.consent-printing .consent-header {
    color: #111;
    background: white;
    border-bottom: 2px solid #334155;
    padding: 0 0 14px;
  }

  body.consent-printing .consent-eyebrow {
    color: #475569;
  }

  body.consent-printing .consent-subtitle {
    color: #334155;
  }

  body.consent-printing .consent-body {
    overflow: visible;
    padding: 12px 0;
  }

  body.consent-printing .consent-notice,
  body.consent-printing .consent-terms,
  body.consent-printing .consent-check,
  body.consent-printing .consent-date-box {
    background: white;
    break-inside: avoid;
  }

  body.consent-printing .consent-section-title {
    break-after: avoid;
  }

  body.consent-printing .consent-field input {
    border: 0;
    border-bottom: 1px solid #94a3b8;
    border-radius: 0;
    padding-left: 0;
    color: #111;
  }

  body.consent-printing .consent-signature-wrap {
    break-inside: avoid;
    border: 1px solid #94a3b8;
  }

  body.consent-printing .consent-terms p {
    orphans: 3;
    widows: 3;
  }

  @page {
    size: A4;
    margin: 14mm;
  }
}
