/* Customer-facing layout additions. IC's site.css + responsive.css are loaded first.
   Matching palette, typography, navigation and card styles; no business logic. */
:root {
    --ic-ink: #15283e; --ic-blue: #0a325c; --ic-teal: #166b8c;
    --ic-primary: #086896; --ic-bg: #f5f7fb; --ic-line: #e0e8f0;
}
html { scroll-behavior: smooth; }
body { background: var(--ic-bg); color: var(--ic-ink); min-height: 100vh; }
.site-header { position: relative; z-index: 10; }
.skip-link { position: absolute; left: 14px; top: -64px; z-index: 20; background: #fff;
    border: 2px solid var(--ic-primary); border-radius: 8px; padding: 10px 14px; }
.skip-link:focus { top: 8px; }
.preview-banner { padding: 12px 16px; margin-bottom: 20px; background: #fff9e8; border-left: 4px solid #ca8b22;
    border-radius: 8px; color: #74501a; line-height: 1.55; font-size: 14px; }
.customer-hero { padding: clamp(28px, 4.5vw, 48px); }
.customer-hero h1 { margin: 14px 0; }
.customer-hero .light { color: #9ee3f5; }
.login-panel { max-width: 660px; margin: 24px auto; }
.field-stack { margin-bottom: 18px; }
.field-stack label { margin-bottom: 7px; }
.field-stack .hint { display: block; margin-top: 6px; line-height: 1.5; }
.login-actions { margin-top: 24px; }
.login-actions button { width: 100%; }
button:disabled { opacity: .52; cursor: not-allowed; }
button.primary:disabled { background: #7c94a5; border-color: #7c94a5; }
.subtle-button { display: inline-flex; align-items: center; justify-content: center; color: #075c9a; padding: 10px 16px;
    min-height: 44px; border: 1px solid #b4c4d4; border-radius: 7px; background: #fff; }
.top-space { margin-top: 28px; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.detail-panel { margin-bottom: 0; }
.info-list { display: grid; margin: 0; }
.info-list > div { display: grid; grid-template-columns: 185px minmax(0,1fr); gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--ic-line); }
.info-list > div:last-child { border: none; }
.info-list dt { color: #62758a; }
.info-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.empty-score { color: #076b94; font-size: 44px; font-weight: 750; margin: 14px 0; }
.empty-score span { font-size: 14px; font-weight: 500; color: #607084; }
.tile { display: block; color: var(--ic-ink); transition: transform .15s ease, box-shadow .15s ease; }
.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px #172b421c; }
.tile-icon { width: 42px; height: 42px; border-radius: 12px; color: var(--ic-primary); background: #e9f4fa;
    display: grid; place-items: center; font-size: 25px; margin-bottom: 16px; }
.tile-link { font-weight: 700; font-size: 14px; color: var(--ic-primary); }
.progress-panel { margin-bottom: 18px; }
.progress-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.progress-track { width: 100%; height: 10px; border-radius: 99px; overflow: hidden; background: #e3edf4; }
.progress-track > span { display: block; height: 100%; width: 0%; border-radius: 99px;
    background: linear-gradient(90deg, #0a325c, #1881ac); transition: width .2s ease; }
.question h2 { line-height: 1.5; }
.option:has(input:checked) { background: #ebf7fd; border-color: #086896; }
.option input { accent-color: #086896; }
.option:focus-within { outline: 2px solid #519ac9; outline-offset: 2px; }
.readonly-choice { padding: 16px; background: #f2f7fb; border-radius: 8px; border: 1px dashed #adc5d9; color: #607084; }
.acceptance-panel .radio-line { align-items: start; }
.scorepanel.wide h2 { overflow-wrap: anywhere; }
.preview-banner, .field-stack, .info-list, .detail-panel, .question { min-width: 0; }
@media (max-width: 1023px) { .overview-grid { grid-template-columns: 1fr; } }
@media (max-width: 767px) {
    .preview-banner { margin-bottom: 14px; padding: 10px 12px; font-size: 12px; }
    .login-panel { margin: 14px 0; }
    .customer-hero h1 { font-size: clamp(22px, 6vw, 30px); }
    .field-stack { margin-bottom: 16px; }
    .info-list > div { grid-template-columns: 1fr; gap: 3px; }
    .info-list dt { font-size: 12px; }
    .info-list dd { font-size: 15px; }
    .progress-heading { flex-direction: column; gap: 4px; }
    .question .option { min-height: 48px; }
    .scorepanel.wide h2 { font-size: 21px; }
}
@media (max-width: 400px) { .customer-hero { padding: 23px 17px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tile, .progress-track > span { transition: none; } }

/* IC latest form/result adjustments for customer-facing pages (November 2026). */
.suitability-language-switch, .result-language-switch {gap:8px; align-items:center; margin-top:12px;}
.suitability-disclosure {margin-bottom:18px;}
.suitability-disclosure .hint {line-height:1.5;}
.question-number {font-weight:700;}
.result-risk-panel .result-risk-content {display:flex;align-items:center;justify-content:space-between;gap:16px;min-width:0;}
.result-risk-panel .result-risk-details {min-width:0;}
.result-risk-panel .result-risk-details p {margin:0 0 10px;}
.result-risk-panel .result-risk-details h2 {margin:0;}
.result-print-button {flex:0 0 auto;margin-left:auto;white-space:nowrap;}
.result-navigation-actions {display:flex;justify-content:flex-end;gap:10px;margin-top:18px;}
.answers-table {table-layout:fixed;}
.answers-table th:first-child {width:45%;}
.answers-table th:nth-child(2) {width:40%;}
.answers-table th:last-child {width:15%;min-width:90px;}
.answers-table td {overflow-wrap:anywhere;}
@media (max-width: 767px) {
  .result-risk-panel .result-risk-content {flex-wrap:wrap;}
  .result-print-button {margin:0;width:100%;}
  .suitability-language-switch a {min-width:68px;justify-content:center;}
}
@media print {
  .preview-banner,header,footer,.nav-menu,.result-print-button,.result-navigation-actions,
  .result-language-switch,.suitability-language-switch,.actions.bottom {display:none!important;}
  body {background:#fff!important;}
  .scorepanel,.panel {box-shadow:none!important;}
  .table-scroll {overflow:visible!important;}
  .answers-table {min-width:0!important;}
}




/* Three-field customer login with the latest IC-style sign-in theme.
   Keep the simple top bar and centered card, but use customer identity fields instead of LDAP credentials. */
.themed-login-page {
    background: #f1f3f8;
}
.simple-topbar {
    background: #fff;
    border-bottom: 1px solid #dbe3eb;
}
.simple-topbar-inner {
    min-height: 66px;
    display: flex;
    align-items: center;
}
.simple-brand {
    color: var(--ic-blue);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .01em;
}
.simple-brand:hover { text-decoration: none; }
.customer-login-main {
    min-height: calc(100svh - 66px - 80px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(76px, 12vh, 120px) !important;
    padding-bottom: 40px !important;
}
.customer-login-wrap {
    width: min(100%, 520px);
    margin-inline: auto;
}
.customer-login-card {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 42px 24px 22px;
    border-radius: 14px;
}
.customer-login-card > h1 {
    font-size: clamp(28px, 4.1vw, 34px);
    line-height: 1.25;
    margin: 0 0 16px;
    color: var(--ic-blue);
}
.customer-login-subtitle {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.7;
    color: #5f7590;
}
.customer-login-card .field-stack {
    margin-bottom: 14px;
}
.customer-login-card .field-stack label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #0d2340;
}
.customer-login-card .field-stack input {
    min-height: 44px;
    border-radius: 7px;
    background: #fff;
}
.customer-login-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.customer-login-actions .primary {
    min-width: 110px;
}
.customer-login-actions button {
    min-height: 42px;
}
.simple-footer {
    padding-top: 16px;
    padding-bottom: 18px;
    color: #647893;
}
.preview-login-mode .nav-toggle,
.preview-login-mode .nav-menu,
.preview-login-mode .preview-banner { display: none !important; }
.preview-login-mode .site-header { display: block !important; }
.preview-login-mode footer { display: block !important; }
.preview-login-mode #main-content {
    min-height: calc(100svh - 66px - 80px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(76px, 12vh, 120px) !important;
    padding-bottom: 40px !important;
}
.preview-login-mode #login {
    width: min(100%, 520px);
}
.preview-login-mode .customer-signin-shell {
    width: 100%;
    margin-inline: auto;
}
.preview-login-mode .customer-signin-brand,
.preview-login-mode .customer-signin-notice,
.preview-login-mode .customer-signin-preview-link { display: none !important; }
.preview-login-mode .customer-signin-panel {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 42px 24px 22px;
    border-radius: 14px;
}
.preview-login-mode .customer-signin-panel > h1 {
    font-size: clamp(28px, 4.1vw, 34px);
    line-height: 1.25;
    margin: 0 0 16px;
    color: var(--ic-blue);
}
.preview-login-mode .customer-signin-subtitle {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.7;
    color: #5f7590;
}
.preview-login-mode .customer-signin-panel .field-stack {
    margin-bottom: 14px;
}
.preview-login-mode .customer-signin-panel .field-stack label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #0d2340;
}
.preview-login-mode .customer-signin-panel .field-stack .hint { display: none; }
.preview-login-mode .customer-signin-panel .field-stack input {
    min-height: 44px;
    border-radius: 7px;
    background: #fff;
}
.preview-login-mode .customer-signin-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.preview-login-mode .customer-signin-actions .primary {
    min-width: 110px;
    opacity: 1;
}
@media (max-width: 767px) {
    .simple-topbar-inner { min-height: 64px; }
    .customer-login-main,
    .preview-login-mode #main-content {
        padding-top: 42px !important;
        padding-bottom: 30px !important;
    }
    .customer-login-wrap,
    .preview-login-mode #login { width: min(100%, 100%); }
    .customer-login-card,
    .preview-login-mode .customer-signin-panel {
        padding: 28px 18px 20px;
    }
    .customer-login-card > h1,
    .preview-login-mode .customer-signin-panel > h1 {
        font-size: 26px;
    }
    .simple-footer { padding-bottom: 16px; }
}
@media (max-width: 420px) {
    .customer-login-actions,
    .preview-login-mode .customer-signin-actions {
        flex-wrap: wrap;
    }
    .customer-login-actions button,
    .preview-login-mode .customer-signin-actions button {
        width: auto;
    }
}


/* Locale-stable DD/MM/YYYY birth-date field; picker dialog is styled separately. */
.customer-date-entry { position: relative; width: 100%; }
.customer-date-entry input[name="BirthDate"] { width: 100%; padding-right: 53px; }
.customer-calendar-button {
    position: absolute; top: 0; right: 2px;
    display: flex; align-items: center; justify-content: center;
    height: 44px; width: 44px; padding: 0;
    background: transparent; color: #34516d; border: 0;
    border-radius: 6px; cursor: pointer;
}
.customer-calendar-button:hover { background: #eaf2f8; }
.customer-calendar-button:focus-visible { outline: 2px solid #176aa3; outline-offset: 1px; }
.date-format-hint { display: block; margin-top: 5px; font-size: 12px; color: #65758a; }

/* NEW Questionnaire - latest IC cards + accessible responsive customer controls. */
#customer-questionnaire [data-lang="EN"] { display:none; }
#customer-questionnaire.show-english [data-lang="TH"] { display:none; }
#customer-questionnaire.show-english [data-lang="EN"] { display:initial; }
#customer-questionnaire textarea[data-lang="EN"] { display:none; }
#customer-questionnaire.show-english textarea[data-lang="TH"] { display:none; }
#customer-questionnaire.show-english textarea[data-lang="EN"] { display:block; }
.language-toggle { display:flex; gap:8px; flex-wrap:wrap; margin-top:16px; }
.language-toggle button { min-width:80px; padding:8px 16px; }
.language-toggle button.active { color:white; background:#086896; border-color:#086896; }
.notice-line { border-left:3px solid #ca8b22; padding:13px 15px; background:#fff8e9; border-radius:6px; margin-bottom:17px; line-height:1.6; }
.sticky-progress { position:sticky; top:0; z-index:5; box-shadow:0 3px 12px #142d4b16; }
.customer-question h2 { line-height:1.65; overflow-wrap:anywhere; }
.question-context,.auto-answer-note { padding:12px 14px; background:#f2f8fc; border-radius:7px; line-height:1.6; font-size:14px; }
.questionnaire-option { margin-bottom:0; min-height:48px; }
.questionnaire-option > span { flex:1; }
.questionnaire-option input { flex-shrink:0; accent-color:#086896; }
.questionnaire-option:has(input:checked) { background:#ebf7fd; border-color:#086896; }
.questionnaire-option:focus-within { outline:2px solid #519ac9; outline-offset:2px; }
.questionnaire-score-tag { display:block; margin-top:4px; font-size:12px; color:#547084; }
.auto-choice { background:#edf5fa; border-style:dashed; }
.question-error { color:#a62c2c; margin:12px 0 0; font-size:13px; }
.question-error[hidden] { display:none; }
/* Agreement checkbox: IC's general input rule sets width:100%, even on checkboxes.
   Limit only this checkbox to a fixed size and allow the text to fill the row. */
.suitability-disclosure .radio-line.agreement-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin-top: 18px;
    font-weight: 600;
    line-height: 1.6;
}
.suitability-disclosure .radio-line.agreement-line > input[type="checkbox"] {
    flex: 0 0 18px;
    width: 18px !important;
    min-width: 18px;
    max-width: 18px !important;
    height: 18px;
    min-height: 18px;
    padding: 0;
    margin: 3px 0 0;
    accent-color: #086896;
}
.suitability-disclosure .radio-line.agreement-line > span {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
}
.questionnaire-actions { justify-content:space-between; flex-wrap:wrap; gap:12px; margin:18px 0 36px; }
.questionnaire-actions > * { min-height:44px; }
.questionnaire-validation:empty { display:none; }
@media(max-width:767px) {
    .customer-question { padding:17px 15px; }
    .customer-question h2 { font-size:17px; }
    .sticky-progress { position:relative; }
    .questionnaire-actions { flex-direction:column-reverse; }
    .questionnaire-actions > * { width:100%; text-align:center; }
    .language-toggle button { flex:1; }
    .suitability-disclaimer-body { width:100%; }
}


/* Result print and IC-style saved answer details. */
.intake-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.intake-summary > div { min-width:0; }
.intake-summary p { margin:7px 0 0; overflow-wrap:anywhere; }
.result-risk-panel .result-risk-content { display:flex; gap:16px; width:100%; align-items:center; justify-content:space-between; }
.result-risk-panel .result-risk-details { min-width:0; }
.result-risk-panel .result-risk-details p { margin:0 0 10px; }
.result-risk-panel .result-risk-details h2 { margin:0; overflow-wrap:anywhere; }
.dashboard-result-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.result-navigation-actions { display:flex; flex-wrap:wrap; gap:10px; justify-content:flex-end; margin-top:16px; }
.answers-table { width:100%; table-layout:fixed; }
.answers-table th:first-child { width:38%; }
.answers-table th:nth-child(2) { width:50%; }
.answers-table th:last-child { width:12%; min-width:82px; }
.answers-table td { overflow-wrap:anywhere; vertical-align:top; }
.preline { white-space:pre-line; overflow-wrap:anywhere; }
@media(max-width:767px) {
    .intake-summary { grid-template-columns:1fr; }
    .result-risk-panel .result-risk-content { flex-wrap:wrap; }
    .result-risk-panel .result-print-button { width:100%; margin-left:0; }
    .answers-table { table-layout:auto; min-width:590px; }
    .dashboard-result-actions .subtle-button { flex:1 1 auto; }
}
@page { size:A4; margin:15mm 14mm; }
@media print {
    header, footer, .skip-link, .no-print, .dashboard-result-actions, .result-print-button,
    .result-navigation-actions, .result-language-switch, .nav-menu { display:none!important; }
    html, body { background:#fff!important; color:#162b43!important; }
    main.container { width:100%!important; max-width:none!important; margin:0!important;
        padding:0!important; }
    .pagehead { margin-bottom:12px!important; }
    .pagehead h1 { font-size:24px!important; }
    .scorepanel,.panel { box-shadow:none!important; border-color:#d4dce6!important; }
    .scorepanel { break-inside:avoid; }
    .table-scroll { overflow:visible!important; }
    .answers-table { min-width:0!important; table-layout:fixed!important; font-size:10pt!important; }
    .answers-table th,.answers-table td { padding:7px!important; }
    .answers-table th { background:#edf2f8!important; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
    .answers-table thead { display:table-header-group; }
    .answers-table tr { break-inside:avoid; page-break-inside:avoid; }
    .intake-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
    .result-risk-panel .result-risk-content { display:block; }
    .result-risk-panel .result-print-button { display:none!important; }
}

/* Saved Q1-Q12 answers are included in printed results (TH/EN, Local/Institute). */
@media print {
    .result-answers-printable {
        display: block !important;
        break-before: auto;
    }
    .result-answers-printable .table-scroll {
        width: 100% !important;
        overflow: visible !important;
    }
    .result-answers-printable .answers-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
    }
    .result-answers-printable .answers-table thead {
        display: table-header-group;
    }
    .result-answers-printable .answers-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
