:root {
    --ink: #24312e;
    --muted: #5f6d68;
    --accent: #236b5d;
    --accent-light: #e8f2ef;
    --line: #b9c7c2;
    --paper: #ffffff;
    --background: #eef3f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--background);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.45;
}

.application-shell {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 18px 50px;
}

.application-header {
    padding: 28px 32px;
    color: #fff;
    background: var(--accent);
    border-radius: 8px 8px 0 0;
}

h1, h2, h3 { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { color: var(--accent); font-size: 1.35rem; }
h3 { margin-bottom: 6px; font-size: 1.05rem; }

.application-header p { margin: 0; max-width: 680px; }

form {
    padding: 28px 32px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
}

fieldset {
    margin: 0 0 24px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

legend {
    padding: 0 8px;
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: bold;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.phonefield { display: flex; flex-direction: column; gap: 5px; max-width: 300px; }
.field.full-width { grid-column: 1 / -1; }
label, .field-label { font-weight: bold; }
.hint { color: var(--muted); font-size: 0.88rem; font-weight: normal; }

input, textarea, select {
    width: 100%;
    padding: 9px 10px;
    color: var(--ink);
    background: #fcfefd;
    border: 1px solid var(--line);
    border-radius: 4px;
    font: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid #8bc4b5;
    border-color: var(--accent);
}

textarea { min-height: 86px; resize: vertical; }
.short-answer { min-height: 56px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.choice { display: inline-flex; align-items: center; gap: 7px; font-weight: normal; }
.choice input { width: auto; }

.section-note {
    margin: -8px 0 18px;
    color: var(--muted);
    font-size: 0.92rem;
}

.signature-wrap { max-width: 520px; }
#signature-pad {
    display: block;
    width: 100%;
    height: 150px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    touch-action: none;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

button {
    padding: 11px 18px;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-weight: bold;
}

button.secondary { color: var(--accent); background: var(--accent-light); }
button:hover { filter: brightness(0.93); }
.required-note { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 680px) {
    .application-shell { padding: 12px 8px 30px; }
    .application-header, form { padding: 22px 16px; }
    .application-header h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
    .application-header p { font-size: 14px; }
    .field-grid { grid-template-columns: 1fr; }
    .field.full-width { grid-column: auto; }
    .phonefield { max-width: 100%; }
    fieldset { padding: 15px; margin: 0 0 16px; }
    legend { font-size: 1rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 0.95rem; }
    label, .field-label { font-size: 14px; }
    input, textarea, select { padding: 8px 8px; font-size: 16px; }
    button { padding: 10px 16px; font-size: 14px; }
    #signature-pad { height: 120px; }
    .choice-row { gap: 8px 12px; }
}

@media (max-width: 480px) {
    .application-shell { padding: 8px 5px 20px; }
    .application-header { padding: 16px 12px; }
    .application-header h1 { font-size: 1.3rem; }
    form { padding: 16px 12px; }
    fieldset { padding: 12px; margin: 0 0 12px; }
    legend { font-size: 0.9rem; padding: 0 4px; }
    .section-note { font-size: 0.8rem; margin: -4px 0 12px; }
    h2 { font-size: 1rem; }
    h3 { font-size: 0.9rem; }
    label, .field-label { font-size: 13px; }
    .field { gap: 3px; }
    input, textarea, select { padding: 8px 6px; font-size: 16px; }
    button { padding: 9px 12px; font-size: 13px; }
    #signature-pad { height: 100px; }
}

@media print {
    body { background: #fff; }
    .application-shell { max-width: none; padding: 0; }
    .application-header, form { border: 0; border-radius: 0; }
    .application-header { padding: 0 0 18px; color: #000; background: #fff; }
    form { padding: 0; }
    fieldset { break-inside: avoid; }
    .form-actions, .required-note { display: none; }
    input, textarea, select { border-color: #777; background: #fff; }
}