* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.date-label {
  display: block;
  color: var(--brand-primary);
  font-weight: 500;
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.field-error {
  border-color: #dc3545 !important;
}

.error-message {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--brand-gradient);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.header {
  text-align: center;
  color: white;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.subtitle {
  opacity: 0.9;
  font-size: 0.95rem;
}

.loading-state,
.success-state {
  background: white;
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e5e5;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.success-icon {
  color: #28a745;
  margin-bottom: 1rem;
}

.success-state h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.success-state p {
  color: #666;
  margin-bottom: 1.5rem;
}

.trip-portal {
  display: grid;
  gap: 1rem;
}

.portal-welcome-card,
.portal-section {
  background: #fff;
  border: 1px solid rgba(25, 20, 56, 0.08);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  padding: 1.5rem;
}

.portal-welcome-card {
  background:
    radial-gradient(circle at top right, rgba(118, 75, 162, 0.15), transparent 42%),
    #fff;
}

.portal-complete-badge,
.portal-eyebrow {
  color: var(--brand-primary);
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-complete-badge {
  background: var(--brand-primary-10);
  border-radius: 999px;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.65rem;
}

.portal-welcome-card h2 {
  color: #24202f;
  font-size: 1.55rem;
  margin-bottom: 0.45rem;
}

.portal-welcome-card p,
.portal-section-heading p,
.portal-trip-heading p,
.portal-empty-state p {
  color: #6d6878;
  font-size: 0.9rem;
  line-height: 1.55;
}

.portal-section-heading {
  align-items: flex-start;
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.portal-section-icon {
  align-items: center;
  background: var(--brand-gradient);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.portal-section h3 {
  color: #272330;
  font-size: 1.08rem;
  margin-bottom: 0.2rem;
}

.portal-detail-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-detail {
  background: #f8f7fb;
  border: 1px solid #eeebf4;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.85rem;
}

.portal-detail-label {
  color: #777181;
  font-size: 0.74rem;
  font-weight: 650;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.portal-detail strong {
  color: #2d2934;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.portal-detail > span:last-child:not(.portal-detail-label) {
  color: #746e7c;
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.portal-trip-card {
  margin-top: 1rem;
}

.portal-trip-heading {
  border-bottom: 1px solid #eeebf4;
  margin: -0.1rem 0 1.15rem;
  padding-bottom: 1rem;
}

.portal-trip-heading h3 {
  font-size: 1.25rem;
  margin: 0.25rem 0;
}

.portal-subsection h4 {
  color: #474151;
  font-size: 0.88rem;
  margin-bottom: 0.7rem;
}

.portal-action-grid,
.portal-contact-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.portal-action,
.portal-contact {
  align-items: center;
  border: 1px solid #e3dff0;
  border-radius: 10px;
  color: var(--brand-primary);
  display: flex;
  font-size: 0.86rem;
  font-weight: 650;
  justify-content: space-between;
  min-height: 48px;
  padding: 0.75rem 0.85rem;
  text-decoration: none;
}

.portal-action:hover,
.portal-contact:hover {
  background: #f8f7fb;
  border-color: var(--brand-primary);
}

.portal-action-whatsapp {
  color: #187c45;
}

.portal-action-unavailable {
  color: #89838e;
  font-weight: 500;
}

.portal-contact {
  align-items: flex-start;
  color: #37313e;
  flex-direction: column;
  gap: 0.1rem;
  justify-content: center;
}

.portal-contact span {
  color: #7a7481;
  font-size: 0.73rem;
  font-weight: 500;
}

.portal-contact strong {
  font-size: 0.9rem;
}

.portal-live-note {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.4rem 0.75rem;
  text-align: center;
}

.portal-empty-state {
  text-align: center;
}

.portal-error-state {
  background: #fff;
  border: 1px solid rgba(25, 20, 56, 0.08);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  padding: 2rem 1.5rem;
  text-align: center;
}

.portal-error-icon {
  align-items: center;
  background: #fff2d9;
  border-radius: 50%;
  color: #9a5d00;
  display: flex;
  font-size: 1.25rem;
  font-weight: 800;
  height: 52px;
  justify-content: center;
  margin: 0 auto 1rem;
  width: 52px;
}

.portal-error-state h2 {
  color: #2f2937;
  font-size: 1.25rem;
  margin-bottom: 0.55rem;
}

.portal-error-state p {
  color: #6f6877;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 auto 1.25rem;
  max-width: 34rem;
}

form {
  background: white;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  overflow: hidden;
}

.form-section {
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.form-section:last-of-type {
  border-bottom: none;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

.section-desc {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.subsection-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  margin: 1.25rem 0 0.75rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.4rem;
}

.required {
  color: #dc3545;
}

.optional-label {
  color: #777;
  font-weight: 400;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-15);
}

.form-group input.error,
.form-group select.error {
  border-color: #dc3545;
}

.error-text {
  color: #dc3545;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.trip-selection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.trip-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.trip-option:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-05);
}

.trip-option.selected {
  border-color: var(--brand-primary);
  background: var(--brand-primary-10);
}

.trip-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
}

.trip-info {
  flex: 1;
}

.trip-name {
  font-weight: 500;
  color: #333;
}

.trip-dates {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

.dropzone {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-05);
}

.dropzone-content svg {
  color: #999;
  margin-bottom: 0.5rem;
}

.dropzone-content p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.dropzone .hint {
  font-size: 0.8rem;
  color: #999;
}

.file-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #28a745;
}

.file-selected svg {
  color: #28a745;
}

.file-selected span {
  font-size: 0.9rem;
}

.remove-file {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 0.85rem;
  cursor: pointer;
  margin-left: 0.5rem;
}

.remove-file:hover {
  text-decoration: underline;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.radio-option:hover {
  border-color: var(--brand-primary);
}

.radio-option:has(input:checked) {
  border-color: var(--brand-primary);
  background: var(--brand-primary-10);
}

.radio-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand-primary);
}

.radio-content {
  flex: 1;
}

.radio-label {
  font-weight: 500;
  color: #333;
}

.radio-hint {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

.form-actions {
  padding: 1.5rem;
  background: #f8f9fa;
}

.btn-primary {
  background: var(--brand-gradient);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-large {
  width: 100%;
  padding: 1rem;
  font-size: 1.05rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  padding: 1rem 1.5rem;
  background: #333;
  color: white;
  border-radius: 10px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #dc3545;
}

@media (max-width: 600px) {
  .form-grid.two-col,
  .form-grid.three-col {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 1.5rem 1rem;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

.form-actions {
  display: flex;
  gap: 1rem;
}

.btn-secondary {
  background: white;
  color: var(--brand-primary);
  border: 2px solid var(--brand-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--brand-primary);
  color: white;
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ocr-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.ocr-content {
  background: white;
  padding: 2rem 3rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 500;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.modal-content h3 {
  margin-bottom: 1rem;
  color: #28a745;
}

.modal-content p {
  margin-bottom: 1rem;
  color: #666;
}

.link-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.link-box input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.85rem;
}

.btn-copy {
  padding: 0.75rem 1rem;
  background: var(--brand-primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.hint {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1.5rem;
}

.toast.success {
  background: #28a745;
}

.expiry-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  color: #856404;
  margin-top: 1rem;
}

.expiry-warning svg {
  flex-shrink: 0;
  color: #ffc107;
}

.expiry-warning span {
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ─── Signature ─────────────────────────────────────────────────────────── */
.signature-canvas-wrapper {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 0.75rem;
  overflow: hidden;
  cursor: crosshair;
}

.signature-canvas-wrapper.has-drawing {
  border-color: var(--brand-primary);
  border-style: solid;
  background: #fff;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 160px;
  touch-action: none;
}

.signature-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #c4c4c4;
  font-size: 1.1rem;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s;
}

.sig-clear-btn {
  background: none;
  border: 1px solid #d1d5db;
  color: #6b7280;
  border-radius: 6px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sig-clear-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

/* ─── Legal consent ─────────────────────────────────────────────────────── */
.legal-consent-card {
  background: var(--brand-primary-05);
  border: 1px solid var(--brand-primary-15);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(91, 73, 166, 0.08);
  padding: 1.25rem;
}

.legal-consent-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.legal-consent-icon {
  align-items: center;
  background: var(--brand-primary);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  flex: 0 0 38px;
  height: 38px;
  justify-content: center;
}

.legal-consent-heading h3 {
  color: #29263a;
  font-size: 1.02rem;
  margin: 0 0 0.2rem;
}

.legal-consent-heading p {
  color: #6b6878;
  font-size: 0.88rem;
  margin: 0;
}

.legal-consent-option {
  align-items: flex-start;
  background: white;
  border: 1px solid #e4e0f5;
  border-radius: 10px;
  color: #374151;
  cursor: pointer;
  display: flex;
  font-size: 0.94rem;
  gap: 0.75rem;
  line-height: 1.5;
  margin-top: 0.7rem;
  padding: 0.9rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.legal-consent-option:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 3px 12px var(--brand-primary-08);
}

.legal-consent-option:has(input:checked) {
  background: #f6fff8;
  border-color: #84c995;
}

.legal-consent-option input[type="checkbox"] {
  accent-color: var(--brand-primary);
  cursor: pointer;
  flex-shrink: 0;
  height: 21px;
  margin-top: 1px;
  width: 21px;
}

.legal-consent-option input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.legal-consent-copy a[aria-disabled="true"] {
  color: #8c8995;
  cursor: not-allowed;
  pointer-events: none;
}

.legal-consent-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.legal-consent-copy a {
  color: var(--brand-primary);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-consent-copy a:hover {
  color: #38278f;
}

.legal-consent-copy small {
  color: #777384;
  font-size: 0.76rem;
}

.legal-consent-statement {
  border-left: 3px solid #9287d8;
  color: #565162;
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 1rem 0 0;
  padding: 0.1rem 0 0.1rem 0.8rem;
}

.legal-document-error {
  background: #fff4f4;
  border: 1px solid #f1b8b8;
  border-radius: 8px;
  color: #9b2424;
  font-size: 0.86rem;
  line-height: 1.45;
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
}

.confirm-error-msg {
  margin-top: 0.5rem;
  color: #dc3545;
}

@media (max-width: 600px) {
  .signature-canvas {
    height: 130px;
  }

  .legal-consent-card {
    padding: 1rem;
  }

  .portal-welcome-card,
  .portal-section {
    padding: 1.15rem;
  }

  .portal-detail-grid,
  .portal-action-grid,
  .portal-contact-grid {
    grid-template-columns: 1fr;
  }
}

/* Date calendar picker */
.date-input-cal {
  cursor: pointer;
  background-image: var(--brand-calendar-icon);
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.trip-cal-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trip-cal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.trip-cal-popup {
  position: relative;
  background: white;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  width: 300px;
  max-width: 92vw;
  z-index: 1;
}

.trip-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
}

.trip-cal-nav {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  color: #333;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1;
}

.trip-cal-nav:hover {
  background: #f0f0f0;
}

.trip-cal-month-label {
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
  text-align: center;
}

.trip-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.trip-cal-day-hdr {
  text-align: center;
  padding: 0.4rem 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #717171;
}

.trip-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.trip-cal-day:hover:not(.tc-disabled):not(.tc-empty) {
  background: #f0f0f0;
  border: 1px solid #333;
}

.trip-cal-day.tc-disabled {
  color: #ccc;
  cursor: default;
}

.trip-cal-day.tc-selected {
  background: var(--brand-primary);
  color: white;
}

.trip-cal-day.tc-today {
  font-weight: 700;
  color: var(--brand-primary);
}

.brand-stroke-icon {
  color: var(--brand-primary);
}

.trip-cal-day.tc-empty {
  cursor: default;
}
