/* Rata-päiväkirja — lomake CSS */

.rp-wrap {
  max-width: 680px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: #1a1a1a;
}
.rp-lomake-otsikko {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 20px;
  color: #1a1a1a;
}

/* Estää teeman ylikirjoittamisen nappiselektoreilla */
.rp-wrap button { box-shadow: none; text-shadow: none; }
.rp-wrap .rp-type-btn * { pointer-events: none; }

/* Tyypinvalintapainikkeet */
.rp-type-sel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 520px) {
  .rp-type-sel { grid-template-columns: 1fr; }
}
.rp-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  min-height: 100px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: #1a1a1a;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  box-sizing: border-box;
  width: 100%;
  overflow: visible;
}
.rp-type-btn:hover { border-color: #6b7280; background: #f9fafb; color: #1a1a1a; }
.rp-type-btn.rp-active-kausikortti { border-color: #15803d; background: #f0fdf4; color: #1a1a1a; }
.rp-type-btn.rp-active-kerta       { border-color: #1d4ed8; background: #eff6ff; color: #1a1a1a; }
.rp-type-btn.rp-active-vuokra      { border-color: #b45309; background: #fffbeb; color: #1a1a1a; }
.rp-type-btn strong,
.rp-type-btn .rp-type-label {
  font-size: 14px;
  font-weight: 600;
  display: block;
  line-height: 1.3;
  color: #111827;
  margin: 0;
}
.rp-type-btn small,
.rp-type-btn .rp-type-sub {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.3;
  display: block;
  margin: 0;
}
.rp-type-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  display: block;
}

/* Fieldset */
.rp-wrap fieldset.rp-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 28px 20px 20px;
  margin: 0 0 16px;
  background: #fafafa;
  overflow: visible;
  position: relative;
  min-width: 0;
}
.rp-wrap fieldset.rp-section legend {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #fafafa;
  line-height: 1;
  float: none;
  width: auto;
  margin: 0;
}
.rp-wrap fieldset.rp-section.rp-common { background: #fff; }
.rp-wrap fieldset.rp-section.rp-common legend { background: #fff; }

/* Rivit ja kentät */
.rp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}
@media (max-width: 480px) { .rp-row { grid-template-columns: 1fr; } }

.rp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.rp-field label {
  font-size: 13px;
  font-weight: 500;
  color: #111827 !important;
}
.rp-required label::after { content: " *"; color: #dc2626; }
.rp-opt { font-weight: 400; color: #9ca3af; font-size: 12px; }

.rp-field input,
.rp-field select,
.rp-field textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  background: #fff !important;
  color: #111827 !important;
}
.rp-field input::placeholder,
.rp-field textarea::placeholder { color: #9ca3af !important; opacity: 1; }
.rp-field select option { color: #111827; background: #fff; }
.rp-field input:focus,
.rp-field select:focus,
.rp-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.rp-field small { font-size: 11px; color: #9ca3af; }

/* Radio & checkbox */
.rp-radio-group { display: flex; flex-direction: column; gap: 6px; }
.rp-radio, .rp-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; cursor: pointer; color: #111827 !important;
}
.rp-radio input, .rp-checkbox input { width: 16px; height: 16px; }

/* Vastuuvapaus */
.rp-vastuu-lohko {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.rp-vastuu-teksti {
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
  margin-bottom: 10px;
}
.rp-vastuu-checkbox {
  font-size: 14px;
  font-weight: 500;
  color: #111827 !important;
  align-items: flex-start !important;
  gap: 10px;
}
.rp-vastuu-checkbox input { margin-top: 2px; flex-shrink: 0; }
.rp-virhe {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #b91c1c; border-radius: 6px;
  padding: 10px 14px; font-size: 14px; margin-bottom: 12px;
}
.rp-submit {
  width: 100%; padding: 12px;
  background: #1a1a1a; color: #fff;
  border: none; border-radius: 8px;
  font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.rp-submit:hover { background: #374151; }
.rp-submit:disabled { background: #9ca3af; cursor: not-allowed; }

/* Onnistuminen */
.rp-success {
  text-align: center; padding: 40px 20px;
  border: 2px solid #bbf7d0; border-radius: 12px;
  background: #f0fdf4;
}
.rp-success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #16a34a; color: #fff;
  font-size: 28px; line-height: 56px;
  margin: 0 auto 16px;
}
.rp-success h3 { margin: 0 0 8px; color: #15803d; }
.rp-success p  { color: #166534; margin: 0 0 20px; }
.rp-uusi-btn {
  padding: 10px 24px; border: 2px solid #16a34a;
  border-radius: 6px; background: #fff; color: #15803d;
  font-weight: 600; cursor: pointer; font-size: 15px;
}
.rp-uusi-btn:hover { background: #f0fdf4; }

/* Useampi auto -toiminto */
.rp-lisaa-auto-btn {
  margin-top: 4px;
  padding: 7px 16px;
  background: none;
  border: 1px dashed #9ca3af;
  border-radius: 6px;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: border-color .15s, background .15s;
}
.rp-lisaa-auto-btn:hover { border-color: #6b7280; background: #f9fafb; }
.rp-auto-rivi { margin-bottom: 8px; }
.rp-auto-rivi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}
.rp-auto-rivi-otsikko { font-size: 13px; font-weight: 500; color: #374151; }
.rp-poista-auto-btn {
  padding: 3px 10px;
  background: none;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  color: #dc2626;
  font-size: 12px;
  cursor: pointer;
}
.rp-poista-auto-btn:hover { background: #fef2f2; }
