:root {
  --brand: #0b3d5c;
  --brand-2: #1667a0;
  --ink: #15202b;
  --muted: #5b6b7a;
  --line: #d5dde5;
  --bg: #f3f6f9;
  --card: #ffffff;
  --error: #b42318;
  --error-bg: #fef3f2;
  --ok: #067647;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.topbar { background: var(--brand); color: #fff; padding: 14px 0 12px; }
.brand { font-weight: 700; font-size: 1.15rem; }
.brand-sub { font-size: .85rem; opacity: .85; }

.progress-wrap {
  position: sticky; top: 0; z-index: 5;
  background: #fff; border-bottom: 1px solid var(--line); padding: 10px 0;
}
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.progress-label span:last-child { text-align: right; font-weight: 600; color: var(--ink); }
.progress { height: 6px; background: #e4eaf0; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--brand-2); transition: width .25s; }

main { padding-top: 20px; padding-bottom: 48px; }

h2 { font-size: 1.4rem; margin: 0 0 6px; }
h3 { font-size: 1.05rem; margin: 26px 0 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.intro { color: var(--muted); margin: 0 0 18px; }

form { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-start; }
form > *, .card-body > * { flex: 1 1 100%; min-width: 0; }
.field.half { flex: 1 1 calc(50% - 8px); }
@media (max-width: 520px) { .field.half { flex-basis: 100%; } }

.field { margin: 0 0 16px; }
.field > label, .field > legend, .field .label {
  display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px;
}
.req { color: var(--error); margin-left: 2px; }
.help { font-size: .82rem; color: var(--muted); margin-top: 4px; }

input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time],
input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 11px 12px; border: 1px solid #b9c6d2; border-radius: 8px; background: #fff;
  min-height: 46px; appearance: none; -webkit-appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, #5b6b7a 50%), linear-gradient(135deg, #5b6b7a 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(22, 103, 160, .25); border-color: var(--brand-2); }

fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.radios { display: flex; gap: 10px; flex-wrap: wrap; }
.radios label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid #b9c6d2; border-radius: 8px; padding: 10px 18px; min-height: 46px; background: #fff; font-weight: 500;
}
.radios label:has(input:checked) { border-color: var(--brand-2); background: #eaf3fb; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--brand-2); flex: none; }

.check {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 16px; font-weight: 500;
}
.check input { margin-top: 2px; }
.check.agree { border-color: var(--brand-2); background: #f4f9fd; }

.doc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; font-size: .95rem;
}
.doc.scroll { max-height: 340px; overflow-y: auto; }
.doc h4 { margin: 0 0 8px; font-size: 1rem; }
.doc h5 { margin: 14px 0 6px; font-size: .92rem; }
.doc p { margin: 0 0 10px; }
.doc ul, .doc ol { margin: 0 0 10px; padding-left: 22px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.card-body { padding: 16px 16px 0; display: flex; flex-wrap: wrap; gap: 0 16px; }

.btn {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 12px 22px; min-height: 48px; cursor: pointer; border: 1px solid transparent;
}
.btn.primary { background: var(--brand-2); color: #fff; }
.btn.primary:hover { background: var(--brand); }
.btn.secondary { background: #fff; color: var(--ink); border-color: #b9c6d2; }
.btn.add { background: #fff; color: var(--brand-2); border: 1px dashed var(--brand-2); width: 100%; margin-bottom: 16px; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .85rem; }
.linklike { background: none; border: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.remove { background: none; border: 0; color: var(--error); font: inherit; font-size: .88rem; cursor: pointer; padding: 4px; }

.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; }
.nav .btn { flex: 1; max-width: 220px; }
.nav .btn.primary { margin-left: auto; }

.error-msg { color: var(--error); font-size: .85rem; margin-top: 4px; font-weight: 500; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--error); background: var(--error-bg); }
.has-error.check, .has-error .check { border-color: var(--error); background: var(--error-bg); }
.alert { background: var(--error-bg); border: 1px solid #fecdca; color: var(--error); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }

.duty { width: 100%; border-collapse: collapse; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.duty th, .duty td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.duty td input { max-width: 110px; }

.sig-wrap { position: relative; border: 2px dashed #9fb0c0; border-radius: 10px; background: #fff; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 180px; cursor: crosshair; touch-action: none; }
.sig-line { position: absolute; left: 16px; right: 16px; bottom: 36px; border-bottom: 1px solid #c6d1db; pointer-events: none; }
.sig-x { position: absolute; left: 18px; bottom: 40px; color: #9fb0c0; font-weight: 700; pointer-events: none; }
.sig-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: .85rem; color: var(--muted); }

.review { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.review section { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.review section:last-child { border-bottom: 0; }
.review .rhead { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 4px; }
.review dl { margin: 0; display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 2px 12px; font-size: .9rem; }
.review dt { color: var(--muted); }
.review dd { margin: 0; overflow-wrap: anywhere; }
.review .sub { grid-column: 1 / -1; font-weight: 600; margin-top: 6px; }

.done { text-align: center; padding: 30px 10px; }
.done .big { font-size: 3rem; color: var(--ok); line-height: 1; }
.done code { font-size: 1.1rem; background: #fff; border: 1px solid var(--line); padding: 4px 10px; border-radius: 6px; }

.draft-note { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 18px; }

@media print {
  .progress-wrap, .nav, .draft-note { display: none; }
}

/* admin dashboard */
.wrap.wide { max-width: 1100px; }
.muted { color: var(--muted); font-size: .82rem; }
.admin-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.admin { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin th, .admin td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin th { background: #f7f9fb; font-size: .8rem; color: var(--muted); text-transform: uppercase; }
.admin td:last-child { white-space: nowrap; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

[hidden] { display: none !important; }
.done code { white-space: nowrap; }

/* language picker */
.topbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lang-picker { display: flex; flex: none; border: 1px solid rgba(255, 255, 255, .5); border-radius: 8px; overflow: hidden; }
.lang-picker button {
  font: inherit; font-size: .85rem; font-weight: 600; color: #fff; background: transparent;
  border: 0; padding: 8px 12px; min-height: 40px; cursor: pointer;
}
.lang-picker button[aria-pressed="true"] { background: #fff; color: var(--brand); }

/* translated documents */
.doc-note { background: #fff8e6; border: 1px solid #f5d68a; border-radius: 6px; padding: 8px 10px; font-size: .88rem; }
.doc details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.doc summary { cursor: pointer; color: var(--brand-2); font-weight: 600; font-size: .9rem; }
.doc-alt { margin-top: 10px; color: #33414f; font-size: .9rem; }

/* carrier choice */
.companies .check.company { margin-bottom: 10px; }
.check.company small { color: var(--muted); font-weight: 400; }
.check.company:has(input:checked) { border-color: var(--brand-2); background: #eaf3fb; }
.companies.has-error .check.company { border-color: var(--error); }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.field > label.check { display: flex; font-weight: 500; margin-bottom: 10px; }
.topbar-link { color: #fff; }
