:root {
  --blue: #0c2f6b;
  --blue-2: #0f4c9b;
  --bg: #f4f7fb;
  --line: #d6dee9;
  --muted: #667085;
  --danger: #d92d20;
  --success: #16794b;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: #172033; font-family: Arial, Helvetica, sans-serif; }
.wrap { width: min(1080px, calc(100% - 36px)); margin: 0 auto; }
.topbar { background: var(--blue); color: #fff; box-shadow: 0 2px 10px #0002; }
.topbar__inner { min-height: 80px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.brand-sub { margin-top: 2px; font-size: 12px; opacity: .82; letter-spacing: .04em; text-transform: uppercase; }
.institution { max-width: 470px; text-align: right; font-size: 14px; line-height: 1.4; opacity: .95; }
.app-shell { padding: 42px 0 30px; }
.intro { margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--blue-2); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.intro h1 { margin: 0 0 12px; color: #17365f; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.03em; }
.intro p:last-child { max-width: 850px; margin: 0; color: #536070; line-height: 1.58; font-size: 15px; }
.form-grid { display: grid; gap: 20px; }
.form-section { background: #fff; border: 1px solid #e1e7ef; border-radius: 16px; padding: 24px; box-shadow: 0 8px 24px #162b4a0c; }
.form-section h2 { margin: 0 0 20px; color: #153760; font-size: 19px; line-height: 1.2; }
.fields { display: grid; gap: 18px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
label.field { display: grid; grid-template-rows: minmax(18px, auto) 18px 44px; gap: 5px; min-width: 0; color: #25344b; font-size: 13px; font-weight: 700; align-content: start; }
label.field .field-title { grid-row: 1; }
label.field small { grid-row: 2; min-height: 18px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
label.field input, label.field select { grid-row: 3; }
label.field.textarea-field { grid-template-rows: minmax(18px, auto) 18px auto; }
label.field.textarea-field textarea { grid-row: 3; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #111827; font: 400 14px Arial, Helvetica, sans-serif; outline: none; }
input, select { height: 44px; padding: 0 12px; }
textarea { min-height: 96px; resize: vertical; padding: 11px 12px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: #4e7fc5; box-shadow: 0 0 0 3px #4e7fc51c; }
.invalid-field { border-color: var(--danger) !important; box-shadow: 0 0 0 3px #d92d2014 !important; }
.choice-group { margin-top: 4px; }
.mobility-choice { margin-top: 30px; }
.choice-label { display: block; margin-bottom: 9px; color: #25344b; font-size: 13px; font-weight: 700; }
.choice-hint { margin: -4px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.choice-grid.transport { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice-card { position: relative; display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #25344b; font-size: 13px; font-weight: 700; cursor: pointer; }
.choice-card input { width: 17px; height: 17px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--blue-2); }
.choice-card:has(input:checked) { border-color: #6e96ce; background: #f6f9fd; box-shadow: 0 0 0 2px #4e7fc510; }
.conditional { margin-top: 18px; padding-top: 18px; border-top: 1px dashed #d7dfeb; }
.sig-pad-wrap { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fbfcfe; }
.sig-pad-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.sig-pad-top strong { color: #153760; font-size: 15px; }
.sig-pad-hint { max-width: 720px; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.signature-canvas-shell { position: relative; width: 100%; height: 190px; }
canvas.signature-pad { position: absolute; inset: 0; width: 100%; height: 190px; display: block; background: #fff; border: 1px dashed #9fb0c8; border-radius: 10px; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.signature-placeholder { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #a0aaba; font-size: 14px; font-weight: 600; pointer-events: none; }
.hidden { display: none !important; }
.btn-ghost { border: 1px solid #d8e0ec; border-radius: 8px; padding: 8px 14px; background: #f4f7fb; color: #344054; font-size: 13px; font-weight: 700; cursor: pointer; }
.actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 18px 0; background: linear-gradient(transparent, var(--bg) 28%); }
.btn { border: 0; border-radius: 10px; padding: 13px 20px; font-size: 15px; font-weight: 800; cursor: pointer; }
.btn-primary { background: var(--blue-2); color: #fff; }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid #bfcce0; }
.status { min-height: 22px; margin: 0; color: var(--muted); font-size: 14px; text-align: right; }
.status.error { color: var(--danger); font-weight: 700; }
.preview-open { overflow: hidden; }
#previewDialog { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: #0b172ab8; }
.preview-box { width: min(980px, 96vw); height: min(95vh, 1120px); overflow: hidden; background: #fff; border-radius: 14px; box-shadow: 0 30px 70px #0005; }
.dialog-head { height: 58px; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 10px 18px; background: #fff; border-bottom: 1px solid #e5e7eb; }
.dialog-actions { display: flex; align-items: center; gap: 8px; }
.dialog-print { border: 0; border-radius: 8px; padding: 9px 14px; background: var(--blue-2); color: #fff; font-weight: 800; cursor: pointer; }
.dialog-close { border: 0; padding: 4px 8px; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; }
#previewFrame { width: 100%; height: calc(100% - 58px); border: 0; background: #d8dce2; }
@media (max-width: 760px) {
  .mobility-choice { margin-top: 24px; }
  .topbar__inner { flex-direction: column; align-items: flex-start; padding: 16px 0; }
  .institution { text-align: left; }
  .fields.two, .fields.three, .choice-grid, .choice-grid.transport { grid-template-columns: 1fr; }
  .span-2, .span-all { grid-column: auto; }
  .form-section { padding: 18px; }
  .sig-pad-top { flex-direction: column; align-items: flex-start; }
  .actions { justify-content: stretch; }
  .btn { flex: 1; }
  #previewDialog { padding: 6px; }
  .preview-box { width: 100%; height: 98vh; border-radius: 8px; }
  .dialog-head > strong { font-size: 13px; }
  .dialog-print { padding: 8px 10px; font-size: 12px; }
}

/* Załączniki dowodów podróży */
.attachment-box { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fbfcfe; }
.attachment-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.attachment-head strong { display: block; color: #153760; font-size: 15px; }
.attachment-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.file-input { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.file-picker { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid #bfcce0; border-radius: 9px; background: #fff; color: var(--blue); font-size: 13px; font-weight: 800; cursor: pointer; }
.file-picker:hover { background: #f5f8fc; }
.privacy-note { margin-top: 13px; padding: 10px 12px; border-radius: 9px; background: #f1f6fc; color: #4b5b70; font-size: 12px; line-height: 1.45; }
.attachment-list { display: grid; gap: 8px; margin-top: 12px; }
.attachment-empty { padding: 10px 0 2px; color: var(--muted); font-size: 12px; }
.attachment-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid #e0e6ee; border-radius: 9px; background: #fff; }
.attachment-item-main { min-width: 0; }
.attachment-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #25344b; font-size: 12px; font-weight: 700; }
.attachment-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.attachment-remove { flex: 0 0 auto; border: 0; padding: 6px 8px; background: transparent; color: #a53030; font-size: 12px; font-weight: 700; cursor: pointer; }
.attachment-processing { opacity: .7; }
@media (max-width: 760px) {
  .attachment-head { align-items: flex-start; flex-direction: column; }
  .file-picker { width: 100%; }
}

.site-footer { margin-top: 6px; border-top: 1px solid #e0e6ee; background: #fff; }
.site-footer__inner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.site-footer a { color: var(--blue-2); font-weight: 700; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
@media (max-width: 760px) { .site-footer__inner { min-height: 52px; } }
