* {
    box-sizing: border-box;
}

html {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: #f4f6f8;
}

body {
    margin: 0;

    background: #f4f6f8;
    color: #202a33;

    line-height: 1.55;
}


/* =========================================================
   PAGE
   ========================================================= */

.page-shell {
    width: min(1000px, 94%);

    margin: 0 auto;

    padding: 18px 0 50px;
}


/* =========================================================
   FORMS PORTAL
   ========================================================= */

.portal-link {
    display: inline-block;

    margin: 0 0 10px;

    color: #5f6b75;

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;
}

.portal-link:hover {
    color: #1f2933;

    text-decoration: underline;
}



/* =========================================================
   DISCREET ADMIN CONTROL
   ========================================================= */

.top-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-button {
    margin: 0 2px 10px 0;
    padding: 3px 7px;

    border: 0;
    background: transparent;
    color: #a4adb4;

    cursor: pointer;

    font-family: inherit;
    font-size: 10px;
    font-weight: 600;

    opacity: 0.55;
}

.admin-button:hover,
.admin-button:focus-visible {
    color: #5f6b75;
    opacity: 1;
    text-decoration: underline;
    outline: none;
}


/* =========================================================
   MAIN HEADER
   ========================================================= */

.form-header {
    display: flex;
    align-items: center;

    gap: 14px;

    min-height: 92px;

    padding: 18px 22px;

    background: #1f2933;
    color: #ffffff;

    border-bottom: 5px solid #d9a928;

    border-radius: 10px 10px 0 0;
}

.brand-mark {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 54px;
    height: 54px;

    flex: 0 0 54px;

    border-radius: 9px;

    background: #d9a928;
    color: #1f2933;

    font-size: 19px;
    font-weight: 800;
}

.form-header-text h1 {
    margin: 0;

    color: #ffffff;

    font-size: 25px;
    font-weight: 700;

    line-height: 1.2;
}

.form-header-text p {
    margin: 4px 0 0;

    color: #d7dde2;

    font-size: 14px;
}


/* =========================================================
   NOTICE
   ========================================================= */

.notice-box {
    display: flex;
    flex-direction: column;

    gap: 3px;

    margin: 14px 0;

    padding: 13px 16px;

    background: #fff8dd;

    border: 1px solid #e4cf79;
    border-radius: 8px;

    color: #5d501b;

    font-size: 13px;
    line-height: 1.45;
}

.notice-box strong {
    color: #514515;

    font-size: 13px;
    font-weight: 700;
}


/* =========================================================
   LANGUAGE
   ========================================================= */

.language-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin: 0 0 14px;

    padding: 17px 19px;

    background: #ffffff;

    border: 1px solid #dde2e6;
    border-radius: 9px;
}

.language-copy strong {
    display: block;

    margin-bottom: 3px;

    color: #26323c;

    font-size: 14px;
}

.language-copy p {
    margin: 0;

    color: #66727d;

    font-size: 13px;
}

.language-buttons {
    display: flex;

    flex-shrink: 0;

    gap: 8px;
}

.language-button {
    min-width: 96px;

    padding: 9px 15px;

    border: 2px solid #ccd3d8;
    border-radius: 7px;

    background: #ffffff;
    color: #26323c;

    cursor: pointer;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
}

.language-button.active {
    border-color: #d9a928;

    background: #f8efd5;
    color: #1f2933;
}


/* =========================================================
   OFFICIAL DOCUMENT HEADER
   ========================================================= */

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 24px;

    padding: 20px 24px;

    background: #28343e;
    color: #ffffff;

    border-radius: 10px 10px 0 0;
}

.document-header h2 {
    margin: 0;

    color: #ffffff;

    font-size: 20px;
    font-weight: 700;

    line-height: 1.25;
}

.document-header p {
    margin: 4px 0 0;

    color: #d6dde2;

    font-size: 13px;
}

.document-revision {
    display: flex;
    flex-direction: column;

    flex-shrink: 0;

    text-align: right;

    color: #dce2e6;

    font-size: 11px;
    line-height: 1.45;
}


/* =========================================================
   FORM CARD
   ========================================================= */

.form-card {
    margin: 0 0 26px;

    background: #ffffff;

    border-left: 1px solid #dde2e6;
    border-right: 1px solid #dde2e6;
    border-bottom: 1px solid #dde2e6;

    border-radius: 0 0 10px 10px;
}

.form-section {
    padding: 28px;

    border-bottom: 1px solid #e1e5e8;
}

.form-section h3 {
    margin: 0 0 20px;

    color: #26323c;

    font-size: 19px;
}


/* =========================================================
   FIELDS
   ========================================================= */

.field-grid {
    display: grid;

    gap: 18px;
}

.two-column {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}

.field-group {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.field-group-wide {
    grid-column: 1 / -1;
}

.field-group label,
.signature-section > label {
    color: #303a43;

    font-size: 14px;
    font-weight: 700;
}

.field-group input {
    width: 100%;

    min-height: 47px;

    padding: 9px 11px;

    border: 2px solid #d4dade;
    border-radius: 7px;

    background: #ffffff;
    color: #202a33;

    font-family: inherit;
    font-size: 16px;
}

.field-group input:focus {
    outline: none;

    border-color: #b58a19;

    box-shadow:
        0 0 0 3px rgba(217, 169, 40, 0.18);
}


/* =========================================================
   SIGNATURE
   ========================================================= */

.signature-section {
    margin-top: 27px;
}

.signature-section > p {
    margin: 4px 0 10px;

    color: #66727d;

    font-size: 14px;
}

.signature-wrapper {
    position: relative;

    width: 100%;
    height: 190px;

    background: #ffffff;

    border: 2px solid #9ea8af;
    border-radius: 8px;

    overflow: hidden;

    touch-action: none;
}

#signatureCanvas {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    cursor: crosshair;

    touch-action: none;
}

.signature-placeholder {
    position: absolute;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);

    pointer-events: none;

    color: #a2abb2;

    font-size: 18px;
}

#clearSignatureButton {
    margin-top: 10px;
}


/* =========================================================
   QUESTIONS
   ========================================================= */

.test-heading {
    margin-bottom: 20px;
}

.test-heading h3 {
    margin-bottom: 4px;
}

.test-heading p {
    margin: 0;

    color: #66727d;

    font-size: 14px;
}

.questions-container {
    display: grid;

    gap: 17px;
}

.question-card {
    padding: 17px;

    background: #f8f9fa;

    border: 1px solid #dce2e6;
    border-radius: 9px;
}

.question-card.has-error {
    border-color: #d68c8c;

    background: #fff8f8;
}

.question-text {
    margin: 0 0 12px;

    color: #26323c;

    font-size: 15px;
    font-weight: 700;
}

.answer-list {
    display: grid;

    gap: 7px;
}

.answer-option {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 8px 10px;

    background: #ffffff;

    border: 1px solid #e0e4e7;
    border-radius: 7px;

    cursor: pointer;

    font-size: 14px;
}

.answer-option:hover {
    border-color: #c6cdd2;

    background: #fbfbfb;
}

.answer-option input {
    width: 18px;
    height: 18px;

    margin: 2px 0 0;

    flex: 0 0 auto;

    accent-color: #d9a928;
}

.answer-letter {
    min-width: 20px;

    color: #26323c;

    font-weight: 700;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.secondary-button,
.cancel-button,
.primary-button {
    min-height: 43px;

    padding: 10px 16px;

    border-radius: 7px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;

    text-decoration: none;

    text-align: center;
}

.secondary-button {
    border: 1px solid #aab3ba;

    background: #ffffff;
    color: #28343e;

    cursor: pointer;
}

.secondary-button:hover,
.cancel-button:hover {
    background: #f1f3f4;
}

.cancel-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;

    min-width: 105px;

    border: 1px solid #abb4bb;

    background: #ffffff;
    color: #28343e;
}

.primary-button {
    min-width: 235px;

    border: 2px solid #c39418;

    background: #d9a928;
    color: #1f2933;

    cursor: pointer;
}

.primary-button:hover {
    background: #e1b63a;
}

.primary-button:disabled {
    opacity: 0.6;

    cursor: wait;
}


/* =========================================================
   ACTIONS / MESSAGES
   ========================================================= */

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    gap: 12px;

    padding: 27px 28px;
}

.form-message {
    display: none;

    margin: 24px 28px 0;

    padding: 13px 15px;

    border-radius: 7px;

    font-size: 14px;
    font-weight: 600;
}

.form-message.error {
    display: block;

    background: #fdecec;

    border: 1px solid #e4a4a4;

    color: #8c2525;
}

.form-message.success {
    display: block;

    background: #eaf7ed;

    border: 1px solid #9bc9a4;

    color: #236231;
}


/* =========================================================
   FOOTER
   ========================================================= */

.form-footer {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 2px;

    margin-top: 26px;

    padding: 22px 20px;

    background: #1f2933;
    color: #dbe1e5;

    border-radius: 9px;

    text-align: center;
}

.form-footer strong {
    font-size: 13px;
}

.form-footer span {
    color: #aeb7be;

    font-size: 11px;
}

.hidden {
    display: none !important;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .page-shell {
        width: min(100% - 20px, 1000px);

        padding-top: 12px;
    }

    .form-header {
        min-height: 82px;

        padding: 16px;
    }

    .brand-mark {
        width: 48px;
        height: 48px;

        flex-basis: 48px;

        font-size: 17px;
    }

    .form-header-text h1 {
        font-size: 21px;
    }

    .language-panel {
        flex-direction: column;
        align-items: stretch;

        gap: 13px;
    }

    .language-buttons {
        width: 100%;
    }

    .language-button {
        flex: 1;
    }

    .document-header {
        align-items: flex-start;

        padding: 18px;
    }

    .document-header h2 {
        font-size: 18px;
    }

    .form-section {
        padding: 20px;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .field-group-wide {
        grid-column: auto;
    }

    .signature-wrapper {
        height: 180px;
    }

    .form-actions {
        flex-direction: column-reverse;

        align-items: stretch;

        padding: 20px;
    }

    .cancel-button,
    .primary-button {
        width: 100%;
    }
}

@media (max-width: 430px) {

    .document-header {
        flex-direction: column;

        gap: 8px;
    }

    .document-revision {
        align-items: flex-start;

        text-align: left;
    }

    .question-card {
        padding: 14px;
    }
}
