:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172b4d;
  background: #f4f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.55; background: #f4f7fb; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100% - 24px, 820px); margin: 22px auto 28px; }
.chat-panel { overflow: hidden; background: #fff; border: 1px solid #e3eaf2; border-top: 0; border-radius: 0 0 18px 18px; box-shadow: 0 12px 35px rgba(29, 55, 90, .06); }
.chat-intro { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid #edf1f6; background: #fbfdff; }
.bot-avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; color: #fff; background: #0f766e; font-weight: 800; }
.intro-title { margin: 0; font-weight: 750; }
.intro-subtitle { margin: 2px 0 0; color: #718096; font-size: .86rem; }
.progress-wrap { padding: 13px 22px 4px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; color: #64748b; font-size: .78rem; margin-bottom: 7px; }
.progress-track { width: 100%; height: 6px; overflow: hidden; border-radius: 999px; background: #e8eef7; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: #2563eb; transition: width .2s ease; }
.chat-messages { display: flex; flex-direction: column; gap: 12px; min-height: 210px; max-height: 56vh; overflow-y: auto; padding: 22px; background: #f8fafc; scroll-behavior: smooth; }
.message-row { display: flex; width: 100%; }
.bot-row { justify-content: flex-start; }
.user-row { justify-content: flex-end; }
.message-bubble { max-width: min(88%, 590px); padding: 12px 15px; border-radius: 17px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 2px 4px rgba(15, 23, 42, .035); }
.bot-bubble { border: 1px solid #e5eaf1; border-bottom-left-radius: 5px; background: #fff; color: #26364d; }
.user-bubble { border: 1px solid #2563eb; border-bottom-right-radius: 5px; background: #2563eb; color: #fff; }
.safety-bubble { border: 1px solid #f0b4ae; background: #fff1f0; color: #8a211b; font-weight: 550; }
.error-bubble { border-color: #f0b4ae; color: #8a211b; background: #fff1f0; }
.chat-controls { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 18px 22px 14px; border-top: 1px solid #edf1f6; background: #fff; }
.quick-reply { width: auto; max-width: 100%; min-height: 43px; padding: 10px 15px; border: 1px solid #cbd8e8; border-radius: 12px; color: #234066; background: #fff; font-weight: 600; text-align: left; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.quick-reply:hover { border-color: #2563eb; background: #eff6ff; }
.quick-reply:active { transform: translateY(1px); }
.primary-reply { border-color: #2563eb; color: #fff; background: #2563eb; }
.primary-reply:hover { border-color: #1d4ed8; background: #1d4ed8; }
.chat-input-form { display: flex; gap: 9px; width: 100%; }
.chat-input-form input { min-width: 0; flex: 1; min-height: 46px; padding: 11px 14px; border: 1px solid #cbd5e1; border-radius: 12px; color: #172b4d; background: #fff; }
.chat-input-form input:focus { outline: 3px solid #dbeafe; border-color: #2563eb; }
.send-button { min-width: 105px; padding: 10px 15px; border: 0; border-radius: 12px; color: #fff; background: #2563eb; font-weight: 700; }
.control-heading { width: 100%; margin: 0; font-size: 1.05rem; }
.consent-copy { flex-basis: 100%; margin: 0; color: #53657d; font-size: .9rem; }
.consent-check { display: flex; flex-basis: 100%; align-items: flex-start; gap: 10px; color: #35465c; font-size: .9rem; font-weight: 500; cursor: pointer; }
.consent-check input { width: 19px; height: 19px; flex: 0 0 19px; margin-top: 3px; accent-color: #2563eb; }
.guardian-check { padding: 10px; border-radius: 10px; background: #f8fafc; }
.inline-error { flex-basis: 100%; margin: 0; color: #b42318; font-size: .85rem; }
.status-message { margin: 0; padding: 0 22px 12px; color: #52647c; font-size: .88rem; overflow-wrap: anywhere; }
.results-area { padding: 22px; border-top: 1px solid #e7edf4; background: #fff; }
.results-area h2 { margin: 0 0 8px; font-size: 1.35rem; }
.results-disclaimer { margin: 0 0 18px; color: #64748b; }
.result-card { margin: 14px 0; padding: 17px; border: 1px solid #dfe7f1; border-radius: 14px; background: #fbfdff; }
.result-card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.result-card p { margin: 7px 0; }
.result-score { font-size: 1.1rem; font-weight: 800; color: #1d4ed8; }
.result-card h4 { margin: 16px 0 6px; }
.result-card ul, .ai-report ul { padding-left: 23px; }
.result-card li, .ai-report li { margin-bottom: 8px; }
.safety-warning { padding: 14px; border: 1px solid #e9a7a1; border-radius: 12px; color: #8a211b; background: #fff1f0; font-weight: 650; }
.report-title { margin: 22px 0 8px; }
.ai-report { padding: 17px; border: 1px solid #e0e7ef; border-radius: 13px; background: #f8fafc; color: #334155; line-height: 1.75; overflow-wrap: anywhere; }
.ai-report h3 { margin: 18px 0 8px; color: #1e3a8a; font-size: 1rem; }
.ai-report h3:first-child { margin-top: 0; }
.ai-report p { margin: 9px 0; }
.restart-button { margin-top: 18px; }
.app-footer { padding: 12px 8px 0; color: #738198; text-align: center; font-size: .78rem; }
.app-footer p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
@media (max-width: 600px) {
  .app-shell { width: calc(100% - 12px); margin: 6px auto 16px; }
  .app-header { padding: 13px; gap: 10px; border-radius: 15px 15px 0 0; }
  .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; }
  .brand-copy p { font-size: .77rem; }
  .local-badge { font-size: .67rem; padding: 4px 7px; }
  .chat-panel { border-radius: 0 0 15px 15px; }
  .chat-intro { padding: 13px; }
  .chat-messages { min-height: 190px; max-height: 52vh; padding: 15px 12px; }
  .message-bubble { max-width: 94%; padding: 11px 12px; font-size: .93rem; }
  .chat-controls { padding: 14px 12px 10px; gap: 8px; }
  .quick-reply { flex: 1 1 auto; font-size: .9rem; }
  .chat-input-form { flex-wrap: wrap; }
  .chat-input-form input { flex-basis: 100%; }
  .send-button { width: 100%; }
  .status-message { padding: 0 13px 12px; }
  .results-area { padding: 15px 12px; }
  .result-card { padding: 14px; }
}


.app-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 24px 20px;
    background: #fff;
    border: 1px solid #e3eaf2;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 6px 24px rgba(29, 55, 90, .04);
}

.company-heading {
    width: 100%;
    text-align: center;
}

.company-main {
    margin: 0;
    color: #1d4ed8;
    font-size: clamp(2rem, 5vw, 2.7rem);
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 1.15;
}

.company-tagline {
    margin: 5px 0 0;
    color: #0f766e;
    font-size: 0.85rem;
    font-weight: 750;
    letter-spacing: 2px;
}

.app-heading {
    width: 100%;
    padding-top: 13px;
    border-top: 1px solid #edf1f6;
}

.app-heading h2 {
    margin: 0;
    color: #172b4d;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.app-heading p {
    margin: 5px 0 0;
    color: #687891;
    font-size: 0.88rem;
}

.local-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #166534;
    background: #dcfce7;
    font-size: .75rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    .app-header {
        padding: 25px 12px 18px;
        gap: 11px;
    }

    .company-main {
        font-size: 2rem;
    }

    .company-tagline {
        font-size: 0.72rem;
        letter-spacing: 1.5px;
    }

    .app-heading h2 {
        font-size: 1.2rem;
    }

    .local-badge {
        position: static;
        align-self: center;
        margin-top: 2px;
    }
}

/* Admin controls */

.admin-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.admin-login-btn {
    padding: 10px 15px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: #1d4ed8;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.admin-login-btn:hover,
.admin-submit:hover {
    background: #1e40af;
}

/* Login popup */

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: rgba(15, 23, 42, 0.65);
}

.admin-modal[hidden] {
    display: none;
}

.admin-modal-content {
    position: relative;
    width: 100%;
    max-width: 390px;
    padding: 28px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.admin-modal-content h2 {
    margin: 0 0 7px;
    color: #172b4d;
    font-size: 1.35rem;
}

.admin-modal-content > p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 22px;
}

.admin-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 28px;
    cursor: pointer;
}

.admin-modal-content form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.admin-modal-content label {
    font-size: 0.88rem;
    font-weight: 650;
    color: #334155;
}

.admin-modal-content input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    margin-bottom: 9px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    outline: none;
}

.admin-modal-content input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px #dbeafe;
}

.admin-submit {
    display: block;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    font-weight: 750;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.admin-error {
    margin: 0;
    color: #b42318;
    font-size: 0.85rem;
}

.download-link {
    margin-top: 15px;
}