/* Peine Insurance 2027 health insurance renewal form
   Layout and colors inspired by the original Jotform default theme. */

:root {
  --bg: #f3f3fe;
  --card: #ffffff;
  --text: #2c3345;
  --muted: #5b6578;
  --placeholder: #8894ab;
  --border: #c3cad8;
  --border-focus: #2e69ff;
  --primary: #2e69ff;
  --primary-hover: #1f54d9;
  --back-bg: #e5e7f2;
  --back-text: #2c3345;
  --required: #dc2626;
  --header-table: #2c3e50;
  --cliff: #fdecea;
  --error-bg: #fdecea;
  --error-text: #b42318;
  --shadow: 0 4px 4px rgba(87, 100, 126, 0.21);
  --radius: 4px;
  --font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.page-bg {
  min-height: 100vh;
  padding: 48px 16px 72px;
}

.form-card {
  max-width: 752px;
  width: 100%;
  margin: 0 auto;
  background: var(--card);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 28px 38px 40px;
}

@media (max-width: 768px) {
  .page-bg { padding: 16px 0 40px; }
  .form-card { border-radius: 0; padding: 20px 16px 32px; box-shadow: none; }
}

.form-header-group {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin: 8px 0 8px;
}

.form-header {
  margin: 0 0 4px;
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.45;
}

.form-subHeader {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--muted);
}

.field {
  padding: 12px 4px;
  margin: 8px 0;
}

.field-label, .field > label.main-label, legend.main-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  word-break: break-word;
}

.req {
  color: var(--required);
  margin-left: 3px;
  font-weight: 600;
}

.hint {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}

.form-html { margin: 8px 0 4px; }
.form-html p, .form-html li { margin: 0 0 10px; }
.form-html ul { margin: 0 0 10px; padding-left: 1.3em; }
.form-html h3 { margin: 8px 0 12px; font-size: 1.15rem; text-align: center; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  height: 2.5em;
  padding: 0 0.625em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea {
  height: 80px;
  padding: 0.625em;
  resize: vertical;
  min-height: 80px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(46, 105, 255, 0.15);
}

select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6578' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
select:required:invalid { color: var(--placeholder); font-weight: 300; }
::placeholder { color: var(--placeholder); font-weight: 300; }

input.readonly, input[readonly] {
  background: #f4f5f8;
  color: var(--muted);
}

.name-row, .phone-row, .date-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.name-row .sub, .address-grid .sub, .phone-row .sub, .date-row .sub {
  flex: 1 1 160px;
  min-width: 120px;
}

.phone-row .sub.area { flex: 0 0 88px; min-width: 80px; }
.phone-row .sep, .date-row .sep {
  align-self: center;
  margin-top: -4px;
  color: var(--muted);
}

.sub-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.address-grid .full { grid-column: 1 / -1; }

@media (max-width: 560px) {
  .address-grid { grid-template-columns: 1fr; }
  .address-grid .full { grid-column: auto; }
}

.matrix-wrap { overflow-x: auto; width: 100%; }
.matrix {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
  table-layout: fixed;
}
.matrix th, .matrix td {
  border: 1px solid var(--border);
  padding: 4px;
  vertical-align: middle;
  font-size: 12px;
}
.matrix th {
  background: #f4f6fa;
  font-weight: 600;
  text-align: left;
  line-height: 1.25;
}
.matrix thead th:first-child { color: transparent; width: 88px; }
.matrix th.row-head {
  white-space: nowrap;
  width: 88px;
  background: #f4f6fa;
  color: var(--text);
  font-size: 11px;
}
.matrix input { height: 2.1em; min-width: 0; width: 100%; }

.fpl-wrap, .ref-wrap { overflow-x: auto; width: 100%; margin: 12px 0; }
.fpl, .ref-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-size: 12px;
}
.fpl th, .fpl td, .ref-table th, .ref-table td {
  border: 1px solid var(--border);
  padding: 5px 4px;
  white-space: nowrap;
  text-align: right;
}
.fpl th, .ref-table th {
  background: var(--header-table);
  color: #fff;
  text-align: center;
  font-weight: 600;
  white-space: normal;
  line-height: 1.3;
}
.fpl td:first-child, .fpl th:first-child,
.ref-table td:first-child, .ref-table th:first-child { text-align: center; }
.fpl td.cliff, .ref-table td.cliff { background: var(--cliff); font-weight: 600; }
.footnote { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

details.more-breakpoints {
  margin: 16px 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fafbff;
}
details.more-breakpoints summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
}
details.more-breakpoints summary:hover { color: var(--primary); }

.radios, .checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-item, .check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
}
.radio-item input, .check-item input {
  width: auto;
  height: auto;
  margin-top: 4px;
  accent-color: var(--primary);
}

.pagebreak {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.page-indicator { font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3em;
  min-width: 128px;
  padding: 0 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-back { background: var(--back-bg); border-color: var(--back-bg); color: var(--back-text); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea,
.field.has-error .sig-pad {
  border-color: var(--required);
}
.error-msg {
  color: var(--error-text);
  font-size: 13px;
  margin-top: 6px;
}
.error-banner {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #f3b4ae;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 12px 0;
}
.error-banner ul { margin: 6px 0 0; padding-left: 1.2em; }

.hidden { display: none !important; }

.sig-wrap { max-width: 310px; }
.sig-pad {
  width: 310px;
  max-width: 100%;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
  display: block;
  cursor: crosshair;
}
.sig-actions { margin-top: 8px; display: flex; gap: 8px; }
.sig-actions .btn { min-width: 0; height: 2.2em; font-size: 14px; }

.date-row .sub.month, .date-row .sub.day { flex: 0 0 64px; min-width: 56px; }
.date-row .sub.year { flex: 0 0 88px; min-width: 72px; }
.date-row input[type="date"] { flex: 0 0 auto; width: 12px; height: 2.5em; padding: 0; opacity: 0; position: absolute; pointer-events: none; }
.cal-btn {
  width: 2.5em;
  height: 2.5em;
  min-width: 2.5em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%232c3345' stroke-width='1.6'%3E%3Crect x='2' y='4' width='14' height='12' rx='1.5'/%3E%3Cpath d='M2 8h14M6 2v4M12 2v4'/%3E%3C/svg%3E") center no-repeat;
  cursor: pointer;
}

.page { display: none; }
.page.active { display: block; }

.thanks {
  text-align: center;
  padding: 48px 16px;
}
.thanks h2 { margin: 0 0 12px; }
.section-head {
  margin: 20px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 600; }

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 28px;
}

/* Admin */
.admin-body { background: var(--bg); }
.admin-card, .admin-wrap {
  max-width: 900px;
  margin: 48px auto;
  background: #fff;
  padding: 28px;
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.admin-header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.admin-header h1, .admin-card h1 { margin-top: 0; }
.muted { color: var(--muted); }
.sub-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
}
.sub-card h2 { margin: 0 0 4px; font-size: 1.1rem; }
.sub-card dl { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; margin: 12px 0; }
.sub-card dt { color: var(--muted); }
.sub-card dd { margin: 0; }
.sub-card pre {
  background: #f4f5f8;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  border-radius: 4px;
  max-height: 400px;
}
.error { color: var(--error-text); }

fieldset.field {
  border: 0;
  margin: 8px 0;
  padding: 12px 4px;
  min-width: 0;
}
legend.main-label {
  padding: 0;
  float: none;
  width: 100%;
}
