:root {
  --blue: #0c2f6b;
  --blue-2: #235aa6;
  --ink: #172033;
  --muted: #667085;
  --bg: #f5f7fb;
  --danger: #b42318;
  --success: #067647;
  --line: #cfd6e1;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
button, input, select, textarea { font-family: inherit; }
.wrap { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: var(--blue); color: #fff; padding: 18px 0; box-shadow: 0 2px 12px #0b234322; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { font-size: 24px; font-weight: 800; }
.brand-sub { opacity: .85; font-size: 13px; }
.institution { text-align: right; font-weight: 700; }
.app-shell { padding: 42px 0 70px; }
.intro { margin-bottom: 24px; }
.intro h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.1; margin: 6px 0 10px; color: #102f5d; }
.intro p { color: var(--muted); font-size: 17px; margin: 0; }
.eyebrow { font-size: 12px !important; letter-spacing: .14em; font-weight: 800; color: var(--blue-2) !important; }
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.type-card { appearance: none; border: 2px solid transparent; background: #fff; border-radius: 16px; padding: 22px; text-align: left; cursor: pointer; box-shadow: 0 7px 24px #223b5c12; display: grid; gap: 5px; color: var(--ink); }
.type-card:hover { border-color: #a9bee0; }
.type-card:focus-visible { outline: 3px solid #90b4e9; outline-offset: 2px; }
.type-card.active { border-color: var(--blue-2); box-shadow: 0 9px 28px #235aa621; }
.type-code { display: inline-flex; width: max-content; background: #e8f0fc; color: var(--blue); font-weight: 900; padding: 5px 9px; border-radius: 8px; font-size: 13px; }
.type-card strong { font-size: 18px; }
.type-card > span:last-child { color: var(--muted); }
.form-grid { display: grid; gap: 18px; }
.form-section { background: #fff; border: 1px solid #e4e8ef; border-radius: 16px; padding: 24px; box-shadow: 0 6px 20px #1d36520a; }
.form-section h2 { margin: 0 0 20px; font-size: 20px; color: #153760; }
.fields { display: grid; gap: 16px; align-items: stretch; }
.fields.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.span-2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 700; color: #344054; }
.fields.two > label { height: 100%; min-height: 84px; }
.fields.two > label.span-2 { min-height: 84px; }
label small, .hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.english-note { color: #d92d20 !important; font-weight: 800 !important; }
input, select { width: 100%; height: 44px !important; min-height: 44px !important; max-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fff; color: #111827; font-size: 14px; font-weight: 400; outline: none; margin-top: auto; }
input[type="email"], input[type="date"], input[type="number"], input[type="text"] { height: 44px !important; min-height: 44px !important; }
input[readonly] { background: #f7f9fc; color: #344054; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: #fff; color: #111827; font-size: 14px; font-weight: 400; outline: none; resize: vertical; }
.programme-long textarea { min-height: 190px; height: 190px; }
input:focus, select:focus, textarea:focus { border-color: #4e7fc5; box-shadow: 0 0 0 3px #4e7fc51c; }
.checkline { display: flex; flex-direction: row; align-items: center; gap: 9px; margin-top: 18px; font-size: 14px; font-weight: 700; }
.checkline input { width: auto; height: auto !important; min-height: 0 !important; margin: 0; }
.hidden { display: none !important; }
.hint-block { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.fixed-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; background: #f7f9fc; border: 1px solid #e4e9f0; border-radius: 12px; padding: 14px; }
.fixed-data div { display: grid; align-content: start; gap: 3px; min-height: 58px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid #e7ebf1; }
.fixed-data span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #667085; }
.fixed-data strong { font-size: 14px; overflow-wrap: anywhere; }
.extra-block { margin-top: 18px; }
.programme-long { margin-top: 24px; }
.programme-long-first { margin-top: 34px; }
.char-count { display: block; align-self: flex-end; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--danger); }
.char-count.ok { color: var(--success); }
.actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 18px 0; background: linear-gradient(transparent, var(--bg) 28%); z-index: 5; }
.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; }
.btn-ghost { background: #f4f7fb; color: #344054; border: 1px solid #d8e0ec; padding: 8px 14px; font-size: 13px; font-weight: 700; border-radius: 8px; cursor: pointer; }
.status { min-height: 22px; color: var(--muted); font-size: 14px; text-align: right; }
.status.error { color: var(--danger); font-weight: 700; }
.sig-pad-wrap { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fbfcfe; margin-top: 18px; }
.sig-pad-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sig-pad-top strong { font-size: 15px; color: #153760; }
.sig-pad-hint { font-size: 12px; color: var(--muted); }
.signature-canvas-shell { position: relative; width: 100%; height: 190px; }
canvas.signature-pad { position: absolute; inset: 0; width: 100%; height: 190px; background: #fff; border: 1px dashed #9fb0c8; border-radius: 10px; touch-action: none; display: block; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.signature-placeholder { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #a0aaba; font-weight: 600; font-size: 14px; pointer-events: none; }
.preview-open { overflow: hidden; }
#previewDialog { position: fixed; inset: 0; z-index: 9999; background: #0b172ab8; padding: 20px; display: flex; align-items: center; justify-content: center; }
#previewDialog.hidden { display: none !important; }
.preview-box { width: min(1050px, 96vw); height: min(95vh, 1120px); background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 30px 70px #0005; }
.dialog-head { height: 58px; background: #fff; border-bottom: 1px solid #e5e7eb; padding: 10px 14px 10px 18px; display: flex; justify-content: space-between; align-items: center; }
.dialog-actions { display: flex; align-items: center; gap: 8px; }
.dialog-print { border: 0; border-radius: 8px; background: var(--blue-2); color: #fff; padding: 9px 14px; font-weight: 800; cursor: pointer; }
.dialog-close { border: 0; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 8px; }
#previewFrame { width: 100%; height: calc(100% - 58px); border: 0; background: #d8dce2; }
.invalid-field { border-color: #d92d20 !important; box-shadow: 0 0 0 3px #d92d2014 !important; }
@media (max-width: 760px) {
  .topbar__inner { align-items: flex-start; flex-direction: column; }
  .institution { text-align: left; }
  .type-picker, .fields.two, .fixed-data { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .fields.two > label, .fields.two > label.span-2 { min-height: 0; }
  input, select { margin-top: 0; }
  .form-section { padding: 18px; }
  .actions { justify-content: stretch; }
  .btn { flex: 1; }
  .app-shell { padding-top: 28px; }
  #previewDialog { padding: 6px; }
  .preview-box { width: 100%; height: 98vh; border-radius: 8px; }
  .sig-pad-top { flex-direction: column; align-items: flex-start; }
  .dialog-head > strong { font-size: 13px; }
  .dialog-print { font-size: 12px; padding: 8px 10px; }
}


/* Prywatność i stopka */
.site-footer { margin-top: 8px; border-top: 1px solid #dde4ee; background: #fff; }
.site-footer__inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--blue-2); font-weight: 700; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; }
.privacy-page { max-width: 880px; margin: 0 auto; }
.privacy-page p { color: #445066; font-size: 14px; line-height: 1.65; }
.privacy-page a { color: var(--blue-2); font-weight: 700; }
@media (max-width: 760px) {
  .site-footer__inner { min-height: 72px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 6px; padding-top: 14px; padding-bottom: 14px; }
}
