/* ============================================================
   Pacific Cross — New Normal Lifestyle Application Form
   Bilingual EN/DE static form, faithful to paper layout
   ============================================================ */

:root {
  --ink: #1a1f2b;
  --muted: #5a6270;
  --accent: #0f5e9e;      /* Pacific blue */
  --accent-dark: #0b4778;
  --line: #9aa4b2;
  --soft: #f4f6f9;
  --paper: #ffffff;
  --warn-bg: #fff7e6;
  --warn-border: #e6b800;
  --ok: #1e7d32;
  --err: #c62828;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #e8ebf0;
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- Top bar ---------- */
.topbar {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.topbar .brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
}
.topbar .brand span { display: block; }
.topbar .brand small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }
.topbar .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lang-switch { display: inline-flex; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  background: transparent; color: #fff; border: 0; padding: 6px 14px;
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.lang-switch button.active { background: #fff; color: var(--accent-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Paper layout ---------- */
.page {
  max-width: 980px;
  margin: 22px auto 60px;
  background: var(--paper);
  box-shadow: 0 2px 14px rgba(0,0,0,.12);
  border-radius: 4px;
  padding: 30px 36px 40px;
}

/* ---------- Document header (like PDF page 1) ---------- */
.doc-header { text-align: center; margin-bottom: 22px; }
.doc-header .company { font-size: 17px; font-weight: 700; color: var(--accent-dark); }
.doc-header h1 { font-size: 22px; margin: 6px 0 2px; letter-spacing: .2px; }
.doc-header .series { font-size: 16px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.doc-header .meta { font-size: 12px; color: var(--muted); line-height: 1.6; }
.form-code { margin-top: 8px; font-size: 11.5px; color: var(--muted); text-align: right; }

/* ---------- Section ---------- */
.section {
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 18px 0;
  background: #fff;
}
.section-title {
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  padding: 7px 12px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--accent-dark);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.section-body { padding: 12px 14px; }
.section-body.less-pad { padding: 8px 14px; }

/* ---------- Chosen Plan box ---------- */
.plan-box { border: 1.5px solid var(--accent); border-radius: 4px; margin: 16px 0; }
.plan-box .plan-head {
  background: var(--accent); color: #fff; padding: 7px 12px;
  font-weight: 700; font-size: 14.5px;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px 16px;
  padding: 10px 14px;
}
.plan-grid label { display: flex; align-items: center; gap: 7px; padding: 3px 0; cursor: pointer; }

/* ---------- Field rows ---------- */
.frow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 18px; padding: 5px 0; border-bottom: 1px dotted #d7dce3; }
.frow:last-child { border-bottom: 0; }
.flabel { font-weight: 600; white-space: nowrap; }
.fnote { font-size: 11.5px; color: var(--muted); }

.opt-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.opt-group label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* Underline-style inputs (paper look) */
.ufield {
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent; padding: 3px 4px;
  font-size: 14px; color: var(--ink);
  min-width: 90px;
}
.ufield:focus { outline: none; border-bottom-color: var(--accent); border-bottom-width: 2px; background: #f6faff; }
.ufield.wide { flex: 1 1 200px; min-width: 160px; }
.ufield.short { min-width: 60px; width: 70px; }
.ufield.mid { width: 150px; }
.ufield.err { border-bottom-color: var(--err); }

/* Boxed inputs for address / textareas */
.bfield {
  border: 1px solid var(--line); border-radius: 3px;
  padding: 6px 8px; font-size: 14px; width: 100%;
  font-family: inherit;
}
.bfield:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(15,94,158,.15); }
textarea.bfield { resize: vertical; min-height: 56px; }

/* Checkbox / radio cosmetic */
input[type="checkbox"].opt, input[type="radio"].opt {
  width: 15px; height: 15px; accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Health questions ---------- */
.q { padding: 7px 4px; border-bottom: 1px dotted #d7dce3; }
.q:last-child { border-bottom: 0; }
.q-main { display: flex; gap: 10px; align-items: flex-start; }
.q-num { font-weight: 700; color: var(--accent-dark); min-width: 34px; }
.q-text { flex: 1; }
.q-yn { display: inline-flex; gap: 14px; align-items: center; white-space: nowrap; padding-top: 2px; }
.q-sub { margin: 5px 0 0 44px; color: var(--muted); font-size: 13px; }
.q-sub .ufield { font-size: 13px; }
.q-female { background: #eef4fb; border: 1px solid #c9dcee; border-radius: 4px; padding: 8px 10px; margin-top: 8px; }
.q-female .q { border-bottom-color: #c9dcee; }

/* ---------- Tables ---------- */
.tbl-scroll { overflow-x: auto; max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }

/* ---- validation marks (missing required fields) ---- */
input.invalid, textarea.invalid, select.invalid {
  background: #fdecea !important;
  border-color: #d33 !important;
  box-shadow: 0 0 0 1px #d33 !important;
}
.opt-group.invalid { outline: 1.5px solid #d33; outline-offset: 1px; border-radius: 4px; }
.opt-group.invalid label { background: #fdecea; }
.sig-box.invalid canvas { border-color: #d33 !important; background: #fdecea; }
.tbl th {
  background: var(--soft); border: 1px solid var(--line);
  padding: 6px 8px; text-align: left; font-weight: 700; font-size: 12.5px;
}
.tbl td { border: 1px solid var(--line); padding: 4px 6px; vertical-align: top; }
.tbl input.ufield { width: 100%; min-width: 0; }
.tbl .row-del { color: var(--err); background: none; border: 0; cursor: pointer; font-size: 16px; }
.add-row { margin-top: 8px; }

/* ---------- Declaration / warning ---------- */
.decl { font-size: 13px; color: #2c3440; text-align: justify; }
.decl p { margin: 8px 0; }
.warning {
  border: 1.5px solid var(--warn-border); background: var(--warn-bg);
  border-radius: 4px; padding: 10px 14px; margin: 16px 0; font-size: 13px;
}
.warning .w-title { font-weight: 800; color: #8a6d00; margin-bottom: 4px; }

/* ---------- Signature ---------- */
.sig-row { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 6px; }
.sig-box { flex: 1 1 260px; }
.sig-box canvas {
  display: block; width: 100%; height: 110px;
  border: 1px solid var(--line); border-radius: 3px; background: #fff;
  touch-action: none; cursor: crosshair;
}
.sig-line { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- Status / messages ---------- */
.status {
  display: none;
  margin: 14px 0; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13.5px; border: 1px solid;
}
.status.show { display: block; }
.status.ok { background: #e8f5e9; border-color: var(--ok); color: var(--ok); }
.status.err { background: #fdecea; border-color: var(--err); color: var(--err); }
.status.info { background: #e3f0fa; border-color: var(--accent); color: var(--accent-dark); }
.status.spin::before {
  content: ""; display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--accent); border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; margin-right: 8px;
  vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Progress ---------- */
.progress { display: flex; gap: 6px; margin: 10px 0 4px; }
.progress .seg { flex: 1; height: 5px; border-radius: 3px; background: #d7dce3; }
.progress .seg.done { background: var(--ok); }
.progress .seg.cur { background: var(--accent); }

/* ---------- Footer ---------- */
.doc-footer {
  margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .topbar, .no-print { display: none !important; }
  .page { box-shadow: none; border: 0; margin: 0; max-width: none; padding: 10px; }
  .section { break-inside: avoid-page; }
  .sig-box canvas { border-color: #000; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .page { padding: 14px 12px 30px; margin: 8px auto 40px; }
  .frow { gap: 6px 12px; }
  .q-sub { margin-left: 10px; }
  .doc-header h1 { font-size: 18px; }
  .btn { min-height: 44px; }
  .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
