:root {
    --primary: #005952;
    --primary-dark: #00423c;
    --primary-light: #e8f4f2;
    --accent-yellow: #f9e493;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --bg-light: #f3f5f8;
    --border-color: #000;
    --border-light: #e5e7eb;
    --white: #ffffff;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 50px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* ========================================================
   PORTAL / DASHBOARD (index.html)
   ======================================================== */
.portal-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 30px 20px;
}

.portal-header {
    background: var(--white);
    padding: 28px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-top: 5px solid var(--primary);
    gap: 24px;
}

.portal-header-content {
    flex: 1;
    min-width: 0;
}

.portal-header-content h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.portal-header-content p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.portal-logo-img {
    height: 52px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    margin-left: auto;
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}

/* 4 Cards Top, 3 Cards Bottom Layout */
.portal-grid-top,
.portal-grid-bottom {
    display: grid;
    gap: 22px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) and (max-width: 1139px) {
    .portal-grid,
    .portal-grid-top,
    .portal-grid-bottom {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1140px) {
    .portal-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .portal-grid-top {
        grid-template-columns: repeat(4, 1fr);
    }
    .portal-grid-bottom {
        grid-template-columns: repeat(4, 1fr);
    }
}


.portal-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.portal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.portal-card-badge {
    position: absolute;
    top: 18px;
    right: 18px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.portal-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.portal-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.portal-card p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex: 1;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    line-height: 1.5;
}

.portal-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
}

.portal-card-btn:hover {
    background: var(--primary-dark);
}

/* Card in Maintenance / Development state */
.portal-card.card-maintenance {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    cursor: default;
}

.portal-card.card-maintenance:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: #94a3b8;
}

.portal-card.card-maintenance .portal-card-badge {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.portal-card.card-maintenance .portal-card-icon {
    background: #e2e8f0;
    color: #64748b;
}

.portal-card.card-maintenance h2 {
    color: #475569;
}

.portal-card.card-maintenance p {
    color: #64748b;
}

.portal-card-btn.btn-disabled {
    background: #cbd5e1;
    color: #475569;
    cursor: not-allowed;
    pointer-events: none;
    user-select: none;
}

/* ========================================================
   FORM PAGES COMMON WRAPPERS
   ======================================================== */
.nav-back-bar {
    max-width: 900px;
    margin: 15px auto 10px auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    background: var(--white);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.nav-back-link:hover {
    background: var(--primary-light);
}

.form-wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
}

.form-wrapper-landscape {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
}

.form-paper {
    background: var(--white);
    padding: 35px 45px;
    box-shadow: var(--shadow-md);
    border-radius: 8px;
    margin-bottom: 25px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-paper-landscape {
    padding: 25px 35px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive Table Scroll Container */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 14px;
}

/* Dual signature grid */
.signature-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
}

.doc-logo-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.doc-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.doc-banner-title {
    background-color: var(--primary);
    color: var(--white);
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 700;
    padding: 7px 12px;
    margin-bottom: 14px;
    border-radius: 2px;
}

/* ========================================================
   TABLES & INPUT FIELDS
   ======================================================== */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    border: 0.6px solid #444;
    font-size: 12px;
}

.doc-table td, .doc-table th {
    border: 0.6px solid #444;
    padding: 6px 8px;
    vertical-align: middle;
}

.th-yellow, .td-yellow {
    background-color: var(--accent-yellow);
    font-weight: 600;
    color: #000;
}

.th-yellow-sub, .td-yellow-sub {
    background-color: #fdf5d3;
    font-weight: 600;
    color: #1f2937;
}

.th-teal, .td-teal {
    background-color: var(--primary);
    font-weight: 700;
    color: #ffffff;
}

.th-terracotta, .td-terracotta {
    background-color: #df8a64;
    font-weight: 600;
    color: #ffffff;
}

.th-terracotta-sub, .td-terracotta-sub {
    background-color: #f7dfd6;
    font-weight: 600;
    color: #222222;
}

.confidentiality-notice {
    font-size: 11px;
    font-weight: 500;
    font-style: italic;
    color: #c0392b;
    text-align: center;
    margin-top: 14px;
    padding: 6px;
}

.table-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    font-size: 12px;
    background: #ffffff;
    padding: 6px 8px;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.table-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 89, 82, 0.15);
    background-color: #ffffff;
}

.center-text {
    text-align: center;
}

.col-checkbox {
    width: 48px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    padding: 6px 2px;
    -webkit-tap-highlight-color: rgba(0, 89, 82, 0.15);
}

.col-checkbox input[type="radio"],
.col-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
    vertical-align: middle;
}

/* Comments Boxes */
.comments-box-wrapper {
    margin-bottom: 16px;
}

.comments-label {
    font-weight: 600;
    font-size: 12.5px;
    margin-bottom: 6px;
    color: #000;
}

.comments-textarea {
    width: 100%;
    border: 0.6px solid #444;
    border-radius: 0;
    padding: 8px;
    font-family: inherit;
    font-size: 12px;
    color: #000;
    resize: vertical;
    outline: none;
    background: #fff;
    min-height: 70px;
}

.comments-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* Signature & Date blocks */
.signature-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px dashed #ccc;
    flex-wrap: wrap;
}

.sig-col {
    flex: 1;
    min-width: 250px;
}

.sig-label-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
}

.btn-clear {
    background: #eef2f6;
    border: 1px solid #ccd4dc;
    border-radius: 4px;
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-clear:hover {
    background: #e2e8f0;
}

.canvas-container {
    border: 0.6px solid #444;
    background: #fff;
    height: 105px;
    position: relative;
    border-radius: 4px;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: crosshair;
}

.date-col {
    width: 160px;
}

.date-col label {
    font-size: 12.5px;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.date-input {
    width: 100%;
    border: 0.6px solid #444;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
}

.signatures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

@media (max-width: 680px) {
    .signatures-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========================================================
   SUBMIT & TARGET EMAIL BAR (Solicitado pelo Usuário)
   ======================================================== */
.action-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
}

.email-field-group {
    margin-bottom: 18px;
}

.email-field-group label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.email-field-group p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.email-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.email-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.email-target-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    font-size: 13.5px;
    border: 1.5px solid #d1d5db;
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.email-target-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 89, 82, 0.15);
}

.btn-generate {
    width: 100%;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 89, 82, 0.25);
}

.btn-generate:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-generate:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dual Action Buttons Group */
.action-buttons-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 10px;
}

@media (max-width: 640px) {
    .action-buttons-group {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.btn-action {
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    padding: 13px 18px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--white);
    min-height: 48px;
}

/* Download / Share PDF Button */
.btn-download {
    background: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 89, 82, 0.25);
}

.btn-download:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 89, 82, 0.35);
}

/* Send PDF by Email Button */
.btn-email {
    background: #0d7377;
    box-shadow: 0 2px 6px rgba(13, 115, 119, 0.25);
}

.btn-email:hover {
    background: #095255;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(13, 115, 119, 0.35);
}

.btn-action:disabled {
    background: #9ca3af !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.spinner {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

/* Secondary Local Storage Buttons (Subdued, Smaller & Apathetic Style) */
.secondary-buttons-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #64748b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    min-height: 36px;
    text-decoration: none;
}

.btn-secondary-action svg {
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.btn-secondary-action:hover svg {
    opacity: 1;
}

.btn-save-local:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #94a3b8;
}

.btn-clear-local:hover {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}

.btn-secondary-action:active {
    transform: scale(0.98);
}

.local-draft-status {
    text-align: center;
    font-size: 12px;
    color: #64748b;
    margin-top: 8px;
    min-height: 18px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.local-draft-status.success {
    color: #15803d;
}

.local-draft-status.info {
    color: #0369a1;
}

.local-draft-status.danger {
    color: #b91c1c;
}

/* ========================================================
   RESPONSIVE DESIGN
   ======================================================== */
@media (max-width: 768px) {
    .portal-header {
        padding: 22px 24px;
        gap: 18px;
    }
    .form-wrapper,
    .form-wrapper-landscape {
        padding: 0 8px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    .form-paper,
    .form-paper-landscape {
        padding: 16px 10px !important;
        border-radius: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Scrollable wrapper for wide multi-column tables */
    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 14px !important;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        background: #ffffff;
    }

    .table-responsive .doc-table {
        min-width: 520px;
        width: 100%;
        margin-bottom: 0 !important;
        border: none !important;
    }

    /* Fixed layout for 2-column details/info tables (prevents blowout) */
    .doc-table:not(.table-responsive .doc-table) {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }

    /* Override any hardcoded pixel widths on info table labels */
    .doc-table:not(.table-responsive .doc-table) td[style*="width"],
    .doc-table:not(.table-responsive .doc-table) th[style*="width"],
    .doc-table:not(.table-responsive .doc-table) td.td-yellow:first-child,
    .doc-table:not(.table-responsive .doc-table) td:first-child {
        width: 38% !important;
        max-width: 140px !important;
        min-width: 85px !important;
        font-size: 12px !important;
        line-height: 1.25 !important;
        padding: 6px 8px !important;
        word-break: break-word;
        hyphens: auto;
    }

    .doc-table:not(.table-responsive .doc-table) td:last-child {
        width: 62% !important;
        padding: 4px 6px !important;
    }

    .doc-table:not(.table-responsive .doc-table) td:last-child .table-input {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        font-size: 13px !important;
        padding: 6px 8px !important;
    }

    .doc-table td.td-yellow {
        word-break: break-word;
        hyphens: auto;
    }

    .table-input {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        font-size: 13.5px !important;
        padding: 6px 8px !important;
    }

    .doc-banner-title {
        font-size: 15px !important;
        padding: 8px 10px !important;
        line-height: 1.35 !important;
        word-break: break-word;
    }

    /* Multi-column radio headers */
    .table-responsive .doc-table th.center-text {
        font-size: 9.5px !important;
        line-height: 1.15 !important;
        padding: 6px 2px !important;
        white-space: normal !important;
    }

    .table-responsive .doc-table td.col-checkbox {
        padding: 6px 2px !important;
        text-align: center !important;
    }

    .col-checkbox input[type="radio"],
    .col-checkbox input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
        margin: 0 auto !important;
        display: block !important;
    }

    /* Dual signatures stack vertically on mobile */
    .signature-dual-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    .signature-row {
        flex-direction: column;
        align-items: stretch;
    }
    .date-col {
        width: 100%;
    }
    /* Touch-friendly inputs and prevent mobile auto-zoom on iOS Safari */
    input[type="text"],
    input[type="email"],
    select,
    textarea {
        font-size: 15px;
    }
    .btn-clear {
        padding: 4px 10px;
        min-height: 28px;
    }
}

@media (max-width: 680px) {
    .portal-header {
        flex-direction: column-reverse;
        align-items: center;
        text-align: center;
        padding: 24px 20px;
        gap: 16px;
    }
    .portal-logo-img {
        height: 48px;
        margin: 0 auto;
    }
    .portal-header-content {
        text-align: center;
        width: 100%;
    }
    .portal-header-content h1 {
        font-size: 22px;
        line-height: 1.25;
        margin-bottom: 8px;
    }
    .portal-header-content p {
        font-size: 13.5px;
        line-height: 1.5;
        max-width: 460px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .portal-header {
        padding: 20px 16px;
        gap: 14px;
    }
    .portal-header-content h1 {
        font-size: 20px;
    }
    .portal-header-content p {
        font-size: 13px;
    }
    .portal-logo-img {
        height: 44px;
    }
}

/* ========================================================
   CATCH UP FORM STYLES
   ======================================================== */
.catchup-score-banner {
    background: #e8f4f2;
    border: 1.5px solid #005952;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.catchup-score-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
    font-family: 'Outfit', sans-serif;
}

.catchup-total-score-pill {
    background: var(--primary);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0, 89, 82, 0.25);
}

.catchup-question-card {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.catchup-question-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 89, 82, 0.1);
}

.catchup-q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.catchup-q-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.catchup-q-badge {
    background: #f3f4f6;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.catchup-input-wrapper {
    margin-bottom: 12px;
}

.catchup-text-input,
.catchup-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13.5px;
    font-family: inherit;
    color: #1f2937;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease;
}

.catchup-textarea {
    resize: vertical;
    min-height: 60px;
}

.catchup-text-input:focus,
.catchup-textarea:focus {
    border-color: var(--primary);
}

.catchup-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.catchup-score-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.catchup-score-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catchup-score-select {
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: #fff;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    outline: none;
}

/* ========================================================
   MOBILE APPS BANNER & IN-APP DETECTION
   ======================================================== */
/* Hide download badges completely inside the installed native mobile app */
.in-app-env .portal-app-banner,
body.in-app-env .portal-app-banner {
    display: none !important;
}

.portal-app-banner {
    background: linear-gradient(135deg, #ffffff 0%, #f4fbf9 100%);
    border-radius: var(--radius-lg);
    border: 1.5px solid #d1fae5;
    box-shadow: 0 4px 16px rgba(0, 89, 82, 0.08);
    padding: 28px 32px;
    margin-top: 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.portal-app-banner-content {
    flex: 1 1 450px;
}

.portal-app-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    border: 1px solid #bbf7d0;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #16a34a;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.portal-app-banner-content h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.portal-app-banner-content p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.portal-app-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.store-badge-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.store-badge-wrapper:hover {
    transform: translateY(-2px);
}

.store-badge-vector {
    height: 44px;
    width: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.store-badge-status-pill {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    background: #f59e0b;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1.5px solid #ffffff;
    pointer-events: none;
}

/* ========================================================
   PORTAL FOOTER
   ======================================================== */
.portal-footer {
    margin-top: 40px;
    padding: 24px 10px 10px;
    border-top: 1px solid #e2e8f0;
}

.portal-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted, #64748b);
}

.portal-footer-copy {
    font-weight: 500;
}

.portal-inline-link {
    color: var(--text-muted, #64748b);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.portal-inline-link:hover {
    color: var(--primary, #005952);
    text-decoration: underline;
}

.portal-footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.portal-footer-link {
    color: var(--primary, #005952);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    transition: all 0.15s ease;
}

.portal-footer-link:hover {
    background: var(--primary, #005952);
    color: #ffffff;
    border-color: var(--primary, #005952);
    box-shadow: 0 2px 6px rgba(0, 89, 82, 0.2);
}

@media (max-width: 768px) {
    .portal-app-banner {
        padding: 24px 20px;
        text-align: center;
        justify-content: center;
        flex-direction: column;
        gap: 20px;
    }
    .portal-app-banner-content {
        flex: 1 1 100%;
        text-align: center;
    }
    .portal-app-banner-badge {
        margin: 0 auto 12px auto;
    }
    .portal-app-banner-content h3 {
        text-align: center;
    }
    .portal-app-banner-content p {
        text-align: center;
        max-width: 520px;
        margin: 0 auto;
    }
    .portal-app-buttons {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .portal-footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================================
   PERSONAL SUPPORT PLAN (PSP) ENHANCEMENTS
   ======================================================== */
.psp-toc-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.psp-toc-link {
    white-space: nowrap;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}

.psp-toc-link:hover, .psp-toc-link.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.section-sub-banner {
    background-color: #005952;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 12px;
    margin: 22px 0 10px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-sub-banner span.sec-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.table-textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    font-size: 12px;
    background: #ffffff;
    padding: 6px 8px;
    color: #1e293b;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.table-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 89, 82, 0.15);
    background-color: #ffffff;
}

.input-sublabel {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    margin: 6px 0 2px 0;
}

.checkbox-label-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 12px;
}

.checkbox-label-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.btn-dynamic-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.btn-dynamic-action:hover {
    background: #e2e8f0;
    color: #000;
}

.btn-del-row {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    padding: 0 4px;
}

/* ========================================================
   VERTICAL RISK ASSESSMENT CARDS (Formerly Landscape)
   ======================================================== */
.risk-vertical-card {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.risk-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    background: #f8fafc;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-bottom: 14px;
    font-size: 11.5px;
}

.risk-header-item {
    display: flex;
    flex-direction: column;
}

.risk-header-item span.lbl {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
}

.risk-header-item input {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11.5px;
    background: #fff;
}

.risk-field-block {
    margin-bottom: 12px;
}

.risk-field-block label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.risk-field-block textarea,
.risk-field-block input[type="text"] {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
}

.risk-field-block textarea:focus,
.risk-field-block input[type="text"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 89, 82, 0.15);
}

.risk-meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.risk-calc-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.risk-calc-selectors {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
}

.risk-calc-selectors select {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 700;
    background: #fff;
    cursor: pointer;
}

.risk-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.risk-badge-neutral {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.risk-badge-low {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.risk-badge-med {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.risk-badge-high {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ========================================================
   5x5 RISK MATRIX TABLE (Vertical Layout Compliant)
   ======================================================== */
.risk-matrix-table-wrap {
    margin: 12px 0;
    overflow-x: auto;
}

.risk-matrix-table {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 10.5px;
    text-align: center;
    border: 1px solid #94a3b8;
}

.risk-matrix-table th,
.risk-matrix-table td {
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    height: 24px;
}

.risk-matrix-table th {
    background: #e2e8f0;
    color: #1e293b;
    font-weight: 700;
    font-size: 10px;
}

.matrix-header-y {
    background: #cbd5e1 !important;
    text-align: right;
    padding-right: 6px;
    font-weight: 600;
    font-size: 9.5px;
    white-space: nowrap;
}

.m-green {
    background-color: #84cc16;
    color: #14532d;
    font-weight: 700;
}

.m-amber {
    background-color: #f59e0b;
    color: #78350f;
    font-weight: 700;
}

.m-red {
    background-color: #ef4444;
    color: #ffffff;
    font-weight: 700;
}

.active-matrix-cell {
    outline: 3px solid #000000;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 2px #ffffff;
    font-weight: 900 !important;
    transform: scale(1.05);
    z-index: 2;
    position: relative;
}

/* ========================================================
   PDF GENERATED SUCCESS MODAL (MOBILE & DESKTOP)
   ======================================================== */
.pdf-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 15, 12, 0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
    box-sizing: border-box;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pdf-modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 460px;
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
    padding: 26px 24px;
    border: 1.5px solid #a7f3d0;
    animation: scaleInModal 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    text-align: center;
}

@keyframes scaleInModal {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.pdf-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #d1fae5;
    color: #065f46;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.pdf-modal-card h3 {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 700;
    color: #005952;
    font-family: 'Outfit', sans-serif;
}

.pdf-modal-filename {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #64748b;
    word-break: break-all;
    font-family: monospace;
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.pdf-modal-alert {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    text-align: left;
    gap: 10px;
    color: #166534;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 20px;
}

.pdf-modal-alert svg {
    flex-shrink: 0;
}

.pdf-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.pdf-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
    box-sizing: border-box;
    width: 100%;
}

.pdf-btn-share {
    background: #005952;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(0, 89, 82, 0.32);
}

.pdf-btn-share:hover, .pdf-btn-share:active {
    background: #00433e;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 89, 82, 0.42);
}

.pdf-btn-primary {
    background: #0284c7;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28);
}

.pdf-btn-primary:hover, .pdf-btn-primary:active {
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.38);
}

.pdf-btn-viewer {
    background: #005952;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(0, 89, 82, 0.32);
}

.pdf-btn-viewer:hover, .pdf-btn-viewer:active {
    background: #00433e;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 89, 82, 0.42);
}

.pdf-btn-close {
    background: #f1f5f9;
    color: #475569 !important;
    border: 1.5px solid #cbd5e1;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    margin-top: 4px;
}

.pdf-btn-close:hover, .pdf-btn-close:active {
    background: #e2e8f0;
    color: #0f172a !important;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

/* Bottom Share Sheet (native mobile look & feel) */
.share-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000000 !important;
    animation: fadeInModal 0.18s ease;
}

.share-sheet-card {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 16px 20px 28px 20px;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
    animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    text-align: center;
}

@keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.share-sheet-handle {
    width: 42px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 4px;
    margin: 0 auto 14px auto;
}

.share-sheet-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 18px;
    font-family: 'Outfit', sans-serif;
}

.share-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.share-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    outline: none;
}

.share-sheet-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.15s ease;
}

.share-sheet-item:hover .share-sheet-icon,
.share-sheet-item:active .share-sheet-icon {
    transform: scale(1.08);
}

.icon-wa {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.icon-mail {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.icon-sms {
    background: #fef9c3;
    color: #ca8a04;
    border: 1px solid #fef08a;
}

.icon-copy {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.share-sheet-label {
    font-size: 11.5px;
    color: #334155;
    font-weight: 600;
    line-height: 1.2;
}

.share-sheet-cancel {
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.share-sheet-cancel:hover,
.share-sheet-cancel:active {
    background: #e2e8f0;
    color: #0f172a;
}





