﻿/* =====================================================================
   POINT eCRF - Global stylesheet
   ---------------------------------------------------------------------
    1. Theme variables
    2. Base
    3. Top bar
    4. Page layout
    5. User pill
    6. Buttons
    7. Buttons (legacy)
    8. Radio button groups
    9. Form controls
   10. Text utilities
   11. Legacy layout helpers
   12. Widgets (tree, switch, toggle, accordion, progress, scroll-to-top)
   13. Homepage
   14. Patients page
   15. Modal & forms
   16. CRF forms (criteria and task forms, Yes/No toggles, text inputs)
   17. Visits, Tasks & Sign-off pages
   18. Responsive
   19. Admin pages (AdminPage, AdminUsers, AdminCenters, AdminLock)
   ===================================================================== */


/* 1. Theme variables ================================================== */

:root {
    --background: #f4f8f7; /* soft sage-white  */
    --card-bg: #ffffff; /* pure white card  */
    --main: #3a7068; /* muted teal       */
    --light-main: #a8d5cf; /* pastel teal      */
    --dark-main: #1e4a44; /* deep teal-green  */
    --attention-highlight: #bb2525; /* wine red         */

    --shadow-card: 0 2px 12px rgba(58, 112, 104, 0.10);
    --border-color: color-mix(in srgb, var(--main) 18%, transparent);
    --focus-ring: color-mix(in srgb, var(--main) 16%, transparent);
    --input-bg: color-mix(in srgb, var(--background) 90%, var(--main) 6%);
    --input-border: color-mix(in srgb, var(--main) 24%, transparent);
    --divider: color-mix(in srgb, var(--main) 13%, transparent);
    --text-muted: color-mix(in srgb, var(--main) 70%, transparent);
    --disabled-bg: #e0e0eb;
    --disabled-fg: #b3b3cc;
    scroll-behavior: smooth;
}


/* 2. Base ============================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--main);
}

a:link {
    color: var(--main);
    text-decoration: underline;
    font-size: 12px;
}

a:hover {
    color: var(--dark-main);
    text-decoration: underline;
    font-size: 12px;
}

::placeholder {
    color: var(--main);
    opacity: 0.38;
}


/* 3. Top bar ========================================================== */
/* 3-column grid: side columns are always equal, so the title is always centered */

.topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 16px;
    padding: 4px 20px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    justify-self: start;
    width: 80px;
    height: 80px;
    object-fit: contain;
    opacity: 0.55;
    mix-blend-mode: multiply;
    pointer-events: none;
    user-select: none;
}

.topbar-center {
    justify-self: center;
    text-align: center;
}

.topbar-title {
    margin: 0 0 2px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--attention-highlight);
}

.topbar-subtitle {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--main);
    opacity: 0.65;
}

.topbar-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 14px;
}


/* 4. Page layout ====================================================== */

.page-header {
    text-align: center;
    padding: 28px 20px 20px;
}

.page-header-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--attention-highlight);
}

.page-header-sub {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--main);
    opacity: 0.65;
}

.page-body {
    padding: 28px;
}


/* 5. User pill ======================================================== */

.user-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 11px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.user-pill-label {
    color: var(--main);
    opacity: 0.65;
}

.user-pill-name {
    color: var(--attention-highlight);
    font-weight: 700;
}

.user-pill-role {
    color: var(--main);
    font-weight: 600;
    opacity: 0.85;
}

.user-pill-sep {
    color: var(--main);
    opacity: 0.3;
}


/* 6. Buttons ========================================================== */

/* Shared base */
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 18px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

    /* Shared disabled (filled buttons) */
    .btn-primary:disabled,
    .btn-secondary:disabled,
    .btn-danger:disabled {
        background-color: var(--disabled-bg);
        color: var(--disabled-fg);
        box-shadow: none;
        filter: none;
        cursor: not-allowed;
    }

/* Primary */
.btn-primary {
    gap: 8px;
    color: #ffffff;
    background-color: var(--main);
    box-shadow: 0 1px 0 var(--dark-main) inset, 0 4px 14px color-mix(in srgb, var(--main) 32%, transparent);
    transition: box-shadow 0.15s ease, transform 0.08s ease, filter 0.15s ease;
}

    .btn-primary:hover {
        filter: brightness(1.09);
        box-shadow: 0 1px 0 var(--dark-main) inset, 0 6px 18px color-mix(in srgb, var(--main) 42%, transparent);
    }

    .btn-primary:active {
        transform: translateY(1px) scale(0.99);
        box-shadow: 0 1px 0 var(--dark-main) inset, 0 2px 5px color-mix(in srgb, var(--main) 22%, transparent);
    }

/* Secondary */
.btn-secondary {
    color: var(--dark-main);
    background-color: var(--light-main);
    transition: filter 0.15s ease, transform 0.08s ease;
}

    .btn-secondary:hover {
        filter: brightness(0.94);
    }

    .btn-secondary:active {
        transform: translateY(1px) scale(0.99);
    }

/* Outline */
.btn-outline {
    color: var(--main);
    background-color: transparent;
    border: 1px solid var(--main);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

    .btn-outline:hover {
        color: var(--dark-main);
        background-color: color-mix(in srgb, var(--main) 10%, transparent);
        border-color: var(--dark-main);
    }

    .btn-outline:active {
        filter: brightness(0.92);
    }

    .btn-outline:disabled {
        color: var(--disabled-fg);
        border-color: var(--disabled-fg);
        cursor: not-allowed;
    }

/* Danger */
.btn-danger {
    color: #ffffff;
    background-color: var(--attention-highlight);
    transition: filter 0.15s ease, transform 0.08s ease;
}

    .btn-danger:hover {
        filter: brightness(1.1);
    }

    .btn-danger:active {
        transform: translateY(1px) scale(0.99);
    }


/* 7. Buttons (legacy) ================================================= */

.button {
    height: 36px;
    margin-left: 0;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
    background-color: var(--main);
    border-width: 1px;
    border-radius: 5px;
}

    .button:hover {
        color: var(--dark-main);
        background-color: var(--light-main);
        border-color: var(--dark-main);
    }

    .button:disabled {
        color: var(--disabled-fg);
        background-color: var(--disabled-bg);
        border-color: var(--disabled-fg);
    }

.button2 {
    width: 140px;
    height: 36px;
    font-size: 12px;
    font-weight: bold;
    color: var(--dark-main);
    background-color: var(--light-main);
    border-color: var(--dark-main);
    border-width: 1px;
    border-radius: 5px;
}

    .button2:disabled {
        color: var(--disabled-fg);
        background-color: var(--disabled-bg);
        border-color: var(--disabled-fg);
    }

.otherbutton {
    width: 140px;
    height: 36px;
    font-size: 12px;
    font-weight: bold;
    color: var(--main);
    background-color: var(--background);
    border-color: var(--main);
    border-width: 1px;
    border-radius: 5px;
}

    .otherbutton:hover {
        color: var(--dark-main);
        background-color: var(--attention-highlight);
        border-color: var(--dark-main);
    }

    .otherbutton:disabled {
        color: var(--disabled-fg);
        background-color: var(--disabled-bg);
        border-color: var(--disabled-fg);
    }

.otherbutton2 {
    width: 140px;
    height: 36px;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
    background-color: var(--attention-highlight);
    border-color: var(--main);
    border-width: 1px;
    border-radius: 5px;
}

    .otherbutton2:hover {
        color: var(--attention-highlight);
        background-color: #ffffff;
        border-color: var(--dark-main);
    }

.accbutton {
    height: 26px;
    font-size: 14px;
    color: #404040;
    background-color: transparent;
    border-color: transparent;
    border-radius: 2px;
}

    .accbutton:hover {
        font-weight: bold;
        color: var(--dark-main);
        background-color: var(--light-main);
    }

    .accbutton:disabled {
        font-weight: normal;
        color: var(--disabled-fg);
        background-color: var(--disabled-bg);
    }


/* 8. Radio button groups ============================================== */

/* Hide native inputs in all groups */
.rd input,
.rde input,
.rdefix input,
.rd2 input,
.rd3 input,
.rd4 input,
.rd5 input {
    display: none;
}

/* Horizontal groups: .myradio / .myradioe / .myradioefix */
.myradio,
.myradioe,
.myradioefix {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--dark-main);
    border-radius: 5px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);
}

.rd label,
.rde label,
.rdefix label {
    font-weight: bold;
    color: var(--main);
    background: var(--background);
    cursor: pointer;
    transition: background 0.1s;
}

.rd label {
    padding: 5px 20px;
    font-size: 14px;
}

.rde label,
.rdefix label {
    padding: 5px 10px;
    font-size: 12px;
}

.rdefix label {
    width: 75px;
}

    .rd label:not(:last-of-type),
    .rde label:not(:last-of-type),
    .rdefix label:not(:last-of-type) {
        border-right: 1px solid var(--dark-main);
    }

/* Vertical groups: .myradio2 - .myradio5 */
.myradio2,
.myradio3,
.myradio4,
.myradio5 {
    display: block;
    border: 1px solid var(--dark-main);
    border-radius: 5px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);
}

.myradio2 {
    width: 350px;
}

.myradio3 {
    width: 122px;
}

.myradio4 {
    width: 200px;
}

.myradio5 {
    width: 410px;
}

.rd2 label,
.rd3 label,
.rd4 label,
.rd5 label {
    display: inline-block;
    height: 28px;
    padding: 5px 10px 0;
    font-size: 12px;
    font-weight: bold;
    color: var(--main);
    background: var(--background);
    cursor: pointer;
    transition: background 0.1s;
}

.rd2 label {
    width: 348px;
}

.rd3 label {
    width: 120px;
}

.rd4 label {
    width: 198px;
}

.rd5 label {
    width: 408px;
}

    .rd2 label:not(:last-of-type),
    .rd3 label:not(:last-of-type),
    .rd4 label:not(:last-of-type),
    .rd5 label:not(:last-of-type) {
        border-bottom: 1px solid var(--dark-main);
    }

/* Checked state for every group */
.rd input:checked + label,
.rde input:checked + label,
.rdefix input:checked + label,
.rd2 input:checked + label,
.rd3 input:checked + label,
.rd4 input:checked + label,
.rd5 input:checked + label {
    background: var(--light-main);
}


/* 9. Form controls ==================================================== */

.drop {
    height: 32px;
    padding: 0 5px;
    font-size: 14px;
    font-weight: bold;
    color: var(--dark-main);
    background-color: #ffffff;
    border-color: var(--main);
    border-radius: 5px;
}

.dropdisabled {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: normal;
    color: var(--dark-main);
    background-color: transparent;
    border-color: transparent;
    border-radius: 0;
}

.txtbox {
    width: 120px;
    height: 32px;
    padding: 0 5px;
    font-size: 14px;
    font-weight: normal;
    color: var(--dark-main);
    background-color: #ffffff;
    border: 1px solid var(--dark-main);
    border-radius: 5px;
}

.follbox {
    width: 50px;
    font-size: 12px;
    font-weight: normal;
    color: #404040;
    background-color: #ffffff;
    border: 1px solid #707070;
    border-radius: 1px;
}

#tUserID:focus,
#tUserPass:focus,
#DropDownList1:focus {
    background-color: var(--background);
}

input[type='checkbox'] {
    accent-color: var(--light-main);
}

.chk input {
    width: 17px;
    height: 17px;
    color: var(--main);
}

.chk2 input {
    width: 13px;
    height: 13px;
    color: var(--main);
}


/* 10. Text utilities ================================================== */

.version {
    color: var(--attention-highlight);
    opacity: 0.65;
}

.txtlabel {
    font-size: 14px;
    color: var(--dark-main);
}

.txtlabelsmall {
    font-size: 12px;
    color: var(--main);
}

.txtattention {
    font-size: 14px;
    font-weight: bold;
    color: var(--attention-highlight);
}

.txtattentionsmall {
    font-size: 12px;
    font-weight: bold;
    color: var(--attention-highlight);
}

.txtinfo {
    font-size: 14px;
    font-weight: bold;
    color: var(--main);
}

.txtinfo12 {
    font-size: 12px;
    font-weight: bold;
    color: var(--main);
}

.txtinfosmall {
    font-size: 10px;
    font-style: italic;
    color: var(--main);
}

.fancyinfo {
    font-size: 14px;
    font-weight: bold;
    color: var(--light-main);
}

.fancyinfosmall {
    font-size: 12px;
    font-weight: bold;
    color: var(--light-main);
}

.fontmain {
    font-size: 170%;
    font-weight: bold;
    color: var(--attention-highlight);
}

.fontlight {
    color: var(--light-main);
}

.under {
    font-size: 100%;
    text-decoration: underline;
    color: var(--main);
    background-color: transparent;
}

.upper {
    font-size: 100%;
    color: var(--main);
    background-color: transparent;
}

.pagetitle {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--light-main);
}

.centertitle {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--main);
}

.tabletitle {
    font-size: 14px;
    font-weight: bold;
    color: var(--main);
}

.tabletitle2 {
    font-size: 14px;
    font-weight: bold;
    color: #404040;
}

.badge {
    padding: 4px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
    background-color: #00cccc;
    border-radius: 5px;
}

.bulletlinks {
    padding-left: 25px;
    line-height: 30px;
    color: #404040;
}

.balloon {
    text-align: left;
    font-size: 12px;
}


/* 11. Legacy layout helpers =========================================== */

.mrg {
    padding-left: 20px;
}

.backs {
    background-color: var(--background);
}

.cntr {
    padding: 10px 5px;
}

.box {
    width: 80%;
    height: 90%;
    margin: 1% auto;
    text-align: center;
    color: var(--main);
    background-color: #ffffff;
    border-radius: 1%;
    box-shadow: 10px 48px 80px -32px rgba(0, 0, 0, 0.3);
}

.box1 {
    width: 90%;
    height: 90%;
    margin-top: 2%;
    padding-top: 2%;
    background-color: #ffffff;
    border-radius: 5px;
    box-shadow: 10px 48px 80px -32px rgba(0, 0, 0, 0.3);
}

.headerrow {
    width: 665px;
    height: 28px;
    text-align: center;
    font-size: 14px;
    color: var(--main);
    border: 1px solid var(--main);
}

.bord {
    border: 1px solid var(--main);
    border-collapse: collapse;
}

.grid-container {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 20px;
}

.grid-container1 {
    display: grid;
    grid-template-columns: min-content min-content min-content;
    gap: 20px;
}

.item1 {
    float: left;
    padding: 15px;
}


/* 12. Widgets ========================================================= */

/* Tree view */
.treeNode {
    font: 16px Arial, sans-serif;
    color: #ffffff;
}

.rootNode {
    width: 100%;
    padding: 10px;
    font-size: 18px;
    font-weight: bold;
    background-color: var(--light-main);
    border-bottom: 1px solid #ffffff;
}

.leafNode {
    padding: 10px;
    font-weight: bold;
    color: #404040;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 26px;
}

    .switch input {
        opacity: 0;
    }

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background-color: var(--background);
    transition: 0.4s;
}

    .slider:before {
        position: absolute;
        content: "";
        width: 31px;
        height: 29px;
        left: -1px;
        bottom: -3px;
        background-color: var(--main);
        transition: 0.4s;
    }

input:checked + .slider {
    background-color: var(--light-main);
}

input:focus + .slider {
    box-shadow: 0 0 1px #cccccc;
}

input:checked + .slider:before {
    transform: translateX(37px);
}

.slider.round {
    padding-top: 7px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--dark-main);
    border: 1px solid var(--dark-main);
    border-radius: 3px;
}

    .slider.round:before {
        border: 1px solid var(--dark-main);
        border-radius: 3px;
    }

/* Toggle */
.toggle {
    --width: 28px;
    --height: 20px;
    position: relative;
    display: inline-block;
    width: var(--width);
    height: var(--height);
    margin-left: 10px;
    cursor: pointer;
}

    .toggle input {
        display: none;
    }

    .toggle .labels {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
        font-family: sans-serif;
        font-size: 16px;
        transition: all 0.4s ease-in-out;
    }

        .toggle .labels::after,
        .toggle .labels::before {
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            top: 0;
            width: 100%;
            height: 100%;
            color: var(--main);
            opacity: 0.9;
            background-color: transparent;
            transition: all 0.2s ease-in-out;
        }

        .toggle .labels::after {
            content: attr(data-off);
            left: 0;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
        }

        .toggle .labels::before {
            content: attr(data-on);
            left: calc(var(--width) * -1);
            text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.1);
        }

    .toggle input:checked ~ .labels::after,
    .toggle input:checked ~ .labels::before {
        transform: translateX(var(--width));
    }

/* Accordion (+/- icons) */
#accordionPlusMinus .accordion-button {
    flex-direction: row-reverse;
    justify-content: start;
    margin-left: 0;
    margin-right: 15px;
}

    #accordionPlusMinus .accordion-button:not(.collapsed) {
        color: #000000;
        background-color: #ffffff;
    }

    #accordionPlusMinus .accordion-button::after {
        width: 1.25rem;
        height: 1.25rem;
        content: "";
        justify-content: start;
        margin-left: 0;
        margin-right: 15px;
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 1v7m0 7V8m0 0H1m7 0h7' stroke='%2308521d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    }

    #accordionPlusMinus .accordion-button:not(.collapsed)::after {
        margin-left: 0;
        transform-origin: 50% 25%;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 2'%3E%3Cpath fill='none' stroke='%23eb3039' stroke-linecap='round' stroke-width='2' d='M8 1H1m7 0h7'/%3E%3C/svg%3E");
    }

/* Step progress bar */
.progressbar {
    counter-reset: step;
}

.progressbar2 {
    counter-reset: step -1;
}

.progressbar-wrapper,
.progressbar2-wrapper {
    width: 75%;
    padding-top: 5px;
    padding-bottom: 5px;
    background: transparent;
}

.progressbar li,
.progressbar2 li {
    position: relative;
    float: left;
    width: 7%;
    list-style-type: none;
    text-align: center;
    font-size: 12px;
    color: var(--main);
}

    .progressbar li:before,
    .progressbar2 li:before {
        content: counter(step);
        counter-increment: step;
        position: relative;
        z-index: 2;
        display: block;
        width: 30px;
        height: 30px;
        margin: 0 auto 3px;
        line-height: 25px;
        text-align: center;
        border: 2px solid #e0e5e5;
        border-radius: 50%;
        background: #ffffff url(user.svg) no-repeat center center;
        background-size: 60%;
    }

    .progressbar li:after,
    .progressbar2 li:after {
        content: '';
        position: absolute;
        top: 15px;
        left: -50%;
        z-index: 0;
        width: 100%;
        height: 2px;
        background-color: #e0e5e5;
    }

    .progressbar li:first-child:after,
    .progressbar2 li:first-child:after {
        content: none;
    }

    .progressbar li.active,
    .progressbar2 li.active {
        font-weight: bold;
        color: var(--main);
    }

        .progressbar li.active:before,
        .progressbar2 li.active:before {
            border-color: var(--main);
            background: #b2efef url(user.svg) no-repeat center center;
            background-size: 60%;
        }

        .progressbar li.active + li:after,
        .progressbar2 li.active + li:after {
            background-color: #b2efef;
        }

/* Scroll-to-top button */
.stt {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 3rem;
    height: 3rem;
    border: 2px solid var(--light-main);
    border-radius: 50%;
    background: #f2f2f2 url("toparrow.png") center no-repeat;
    box-shadow: 0 0.25rem 0.5rem 0 gray;
    opacity: 0.7;
}


/* 13. Homepage ======================================================== */

.home-content {
    max-width: 1120px;
    margin: 0 auto;
    padding: 36px 28px 48px;
}

.home-intro {
    margin-bottom: 28px;
}

.home-intro-title {
    margin: 0 0 10px;
    font-size: 30px;
    font-weight: 700;
    color: var(--dark-main);
}

.home-intro-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--main);
}

.home-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: stretch;
}

.home-panel {
    display: flex;
    flex-direction: column;
    min-height: 210px;
    padding: 26px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

.home-section-title {
    display: block;
    margin-bottom: 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--dark-main);
}

.home-section-text {
    display: block;
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Center selector: sits directly under the card text */
.home-center-select .drop {
    width: 100%;
    min-width: 0;
}

/* Card action button: pinned to the bottom of every home card */
.home-panel-action {
    margin-top: auto;
    padding-top: 18px;
}

.center-error {
    font-size: 13px;
    font-weight: 600;
    color: var(--attention-highlight);
}

.home-error {
    display: block;
    margin-top: 10px;
}

/* Statistics preview */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.stat-tile {
    padding: 14px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--dark-main);
}

.stat-label {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-bar {
    margin-bottom: 14px;
}

.stat-bar-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--main);
}

.stat-bar-track {
    height: 8px;
    overflow: hidden;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
}

.stat-bar-fill {
    height: 100%;
    background-color: var(--main);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.stat-bar-fill--sdv {
    background-color: var(--dark-main);
}

/* "123 of 456 required fields answered" under each bar */
.stat-bar-detail {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}


/* 14. Patients page ================================================== */

.patients-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 32px 56px;
}

.patients-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}

.patients-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--dark-main);
}

.patients-page-center {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--main);
    opacity: 0.75;
}

.patients-page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.patients-card {
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

.patients-card-header {
    padding: 14px 20px;
    background-color: var(--background);
    border-bottom: 1px solid var(--divider);
}

.patients-card-label {
    margin: 0 0 1px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.patients-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-main);
}

/* Page-level messages */
.page-message {
    display: block;
    margin-bottom: 16px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--main);
    border-radius: 10px;
}

    .page-message.is-error {
        color: var(--attention-highlight);
        border-left-color: var(--attention-highlight);
    }

/* Data table */
.table-scroll {
    overflow-x: auto;
}

.patient-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    /* Headers and cells centered, so each value sits directly under its title */
    .patient-table th {
        padding: 10px 14px;
        text-align: center;
        white-space: nowrap;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-muted);
        background-color: var(--background);
        border-bottom: 1px solid var(--divider);
    }

    .patient-table td {
        padding: 10px 14px;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        color: var(--dark-main);
        border-bottom: 1px solid var(--divider);
    }

    .patient-table tbody tr:last-child td {
        border-bottom: none;
    }

    .patient-table tbody tr:hover td {
        background-color: color-mix(in srgb, var(--light-main) 22%, transparent);
    }

    .patient-table .grid-selected-row td {
        background-color: color-mix(in srgb, var(--light-main) 35%, transparent);
    }

    .patient-table .cell-code {
        font-weight: 700;
        letter-spacing: 0.02em;
    }

.lock-yes {
    font-weight: 700;
    color: var(--attention-highlight);
}

.lock-no {
    color: var(--text-muted);
}

/* Row buttons (Open / Edit) */
.btn-row {
    min-width: 64px;
    height: 30px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffffff;
    background-color: var(--main);
    border: 1px solid var(--main);
    border-radius: 999px;
    cursor: pointer;
    transition: filter 0.15s ease, background-color 0.15s ease;
}

    .btn-row:hover:not(:disabled) {
        filter: brightness(1.09);
    }

.btn-row-outline {
    color: var(--main);
    background-color: transparent;
    border-color: var(--border-color);
}

    .btn-row-outline:hover:not(:disabled) {
        filter: none;
        color: var(--dark-main);
        background-color: var(--light-main);
        border-color: var(--main);
    }

.btn-row:disabled,
.btn-row.aspNetDisabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Empty grid */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

    .empty-state svg {
        width: 30px;
        height: 30px;
        opacity: 0.35;
    }


/* 15. Modal & forms =================================================== */

.app-modal {
    width: min(560px, calc(100vw - 32px));
    padding: 0;
    color: var(--main);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

    .app-modal::backdrop {
        background: rgba(30, 74, 68, 0.35);
    }

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--divider);
}

.app-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--dark-main);
}

.app-modal-close {
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 1;
    color: var(--main);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

    .app-modal-close:hover {
        background-color: var(--input-bg);
    }

.app-modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 20px;
}

.app-modal-info {
    display: block;
    margin-bottom: 16px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border-radius: 8px;
}

.app-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--divider);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--main);
    opacity: 0.78;
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.form-input {
    height: auto;
    min-height: 84px;
    padding: 10px 12px;
    resize: vertical;
}

.form-input:focus {
    border-color: var(--main);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Definition of the selected option, shown under a dropdown */
.form-info {
    display: block;
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border-left: 3px solid var(--light-main);
    border-radius: 6px;
}

    .form-info[hidden] {
        display: none;
    }

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.form-error {
    display: block;
    margin-top: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--attention-highlight);
}


/* 16. CRF forms ====================================================== */

.crf-page {
    max-width: 920px;
    margin: 0 auto;
    padding: 28px 32px 56px;
}

.crf-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}

.crf-page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--dark-main);
}

.crf-page-sub {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--main);
    opacity: 0.75;
}

/* Patient status badge */
.crf-status {
    display: inline-block;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--main);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
}

    .crf-status.is-yes {
        color: #ffffff;
        background-color: var(--main);
        border-color: var(--main);
    }

    .crf-status.is-no {
        color: #ffffff;
        background-color: var(--attention-highlight);
        border-color: var(--attention-highlight);
    }

.crf-card {
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

.crf-card-header {
    padding: 16px 22px;
    text-align: center;
    background-color: var(--background);
    border-bottom: 1px solid var(--divider);
}

.crf-card-label {
    max-width: 720px;
    margin: 0 auto 6px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--dark-main);
}

    .crf-card-label strong {
        font-weight: 700;
    }

.crf-card-note {
    margin: 0;
    font-size: 13px;
    color: var(--main);
}

/* Grid: criterion text | Yes/No answer | field tools (audit, SDV, query) */
.crf-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px 112px;
    align-items: center;
    column-gap: 24px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--divider);
}

.crf-row-head {
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

    .crf-row-head > :nth-child(2),
    .crf-row-head > :nth-child(3),
    .crf-answer {
        justify-self: center;
    }

    /* "Audit · SDV · Query" is wider than its 112px column: keep it on one line
       (centered, it spills evenly into the column gap and the card padding) */
    .crf-row-head > :nth-child(3) {
        white-space: nowrap;
        letter-spacing: 0.04em;
    }

.crf-row-sub {
    padding-left: 60px;
    background-color: color-mix(in srgb, var(--background) 60%, transparent);
}

/* Result rows of a test not performed (e.g. CVRD functions): dimmed; the audit /
   SDV / query tools stay fully visible */
.crf-row.is-na .crf-text,
.crf-row.is-na .crf-answer {
    opacity: 0.4;
}

.crf-text {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--dark-main);
}

.crf-no {
    display: inline-flex;
    flex: 0 0 26px;
    align-items: center;
    justify-content: center;
    height: 26px;
    font-size: 12px;
    font-weight: 700;
    color: var(--main);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
}

.crf-no-sub {
    font-style: italic;
}

.crf-sublist {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--main);
}

    .crf-sublist li {
        margin-bottom: 2px;
    }

.crf-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
}

/* Derived answer (e.g. group C criterion 4): same size and shape as a Yes/No toggle */
.crf-result {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--input-bg);
    border: 1px dashed var(--input-border);
    border-radius: 999px;
}

    .crf-result.is-yes {
        color: #ffffff;
        background-color: var(--main);
        border: 1px solid var(--main);
    }

    .crf-result.is-no {
        color: #ffffff;
        background-color: var(--attention-highlight);
        border: 1px solid var(--attention-highlight);
    }

/* Text input inside a CRF row (e.g. sampling code): fits the answer column,
   same height as a Yes/No toggle; read-only / SDV-locked look like the toggles */
.crf-input {
    width: 150px;
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
}

    .crf-input:disabled {
        color: var(--dark-main);
        background-color: var(--background);
        border-style: dashed;
        cursor: not-allowed;
    }

/* Code field: fixed patient-code prefix + 3 digits typed by the user (sampling codes).
   Prefix and box stay on one row, fit inside the 150px Answer column and are centred
   as a unit, so they sit under the Yes/No toggles of the rows above. */
.code-input {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 150px;
    white-space: nowrap;
}

.code-prefix {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--dark-main);
    white-space: nowrap;
}

/* Exactly 3 digits wide (also fixed by Width="40px" on the TextBox) */
.code-input input.crf-input--suffix {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding: 0 4px;
    font-size: 13px;
    text-align: center;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

/* Warning hint, e.g. a code saved in a previous format */
.crf-hint.crf-hint--warn {
    font-style: normal;
    font-weight: 600;
    color: var(--attention-highlight);
}

/* Question text that holds a wide input under it (e.g. medical history) */
.crf-text-body {
    flex: 1 1 auto;
    min-width: 0;
}

.crf-textarea {
    display: block;
    margin-top: 8px;
    font-size: 13px;
}

    .crf-textarea:disabled {
        color: var(--dark-main);
        background-color: var(--background);
        border-style: dashed;
        cursor: not-allowed;
    }

/* Link in a question's text (e.g. questionnaire name -> questionnaire page).
   Overrides the global a:link size (12px) so it matches the question text. */
.crf-text a.crf-link,
.crf-text a.crf-link:hover {
    font-size: inherit;
    font-weight: 600;
    color: var(--main);
    text-decoration: underline;
    text-underline-offset: 2px;
}

    .crf-text a.crf-link:hover {
        color: var(--dark-main);
    }

/* Collapsible reference text under a question (e.g. WHO severity definitions,
   CRF Supplementary Table 1) */
.crf-details {
    margin-top: 6px;
    font-size: 12px;
    color: var(--main);
}

    .crf-details summary {
        width: fit-content;
        font-weight: 600;
        color: var(--main);
        cursor: pointer;
    }

        .crf-details summary:hover {
            color: var(--dark-main);
            text-decoration: underline;
        }

.crf-details-body {
    margin-top: 6px;
    padding: 8px 10px;
    line-height: 1.5;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border-left: 3px solid var(--light-main);
    border-radius: 6px;
}

    .crf-details-body p {
        margin: 0 0 4px;
    }

    .crf-details-body ul {
        margin: 4px 0 0;
        padding-left: 18px;
    }

    .crf-details-body li {
        margin-bottom: 3px;
    }

.crf-reason {
    padding: 16px 22px;
    border-bottom: 1px solid var(--divider);
}

.crf-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
}

/* Yes / No segmented toggle (RadioButtonList, RepeatLayout="Flow")
   When disabled, ASP.NET wraps each item in <span class="aspNetDisabled">;
   "display: contents" removes those wrappers from the layout, so the toggle
   keeps exactly the same shape whether it is enabled or locked. */
.yn-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 999px;
}

    .yn-toggle > span {
        display: contents;
    }

    .yn-toggle input {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: 0;
        opacity: 0;
        pointer-events: none;
    }

    .yn-toggle label {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 46px;
        height: 24px;
        padding: 0 10px;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-muted);
        border-radius: 999px;
        cursor: pointer;
        user-select: none;
        transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    }

        .yn-toggle label:hover {
            color: var(--dark-main);
            background-color: color-mix(in srgb, var(--main) 8%, transparent);
        }

    .yn-toggle input[value="1"]:checked + label {
        color: #ffffff;
        background-color: var(--main);
        box-shadow: 0 1px 3px color-mix(in srgb, var(--main) 40%, transparent);
    }

    .yn-toggle input[value="0"]:checked + label {
        color: #ffffff;
        background-color: var(--attention-highlight);
        box-shadow: 0 1px 3px color-mix(in srgb, var(--attention-highlight) 40%, transparent);
    }

    /* Exclusion criteria: YES is the unfavourable answer, so the colours are swapped
       (YES = wine red, NO = teal) */
    .yn-toggle.yn-toggle--exclusion input[value="1"]:checked + label {
        background-color: var(--attention-highlight);
        box-shadow: 0 1px 3px color-mix(in srgb, var(--attention-highlight) 40%, transparent);
    }

    .yn-toggle.yn-toggle--exclusion input[value="0"]:checked + label {
        background-color: var(--main);
        box-shadow: 0 1px 3px color-mix(in srgb, var(--main) 40%, transparent);
    }

    .yn-toggle input:focus-visible + label {
        box-shadow: 0 0 0 3px var(--focus-ring);
    }

    /* Disabled (read-only / SDV locked): same shape, calmer look */
    .yn-toggle.aspNetDisabled {
        background-color: var(--background);
        border-style: dashed;
    }

    .yn-toggle input:disabled + label {
        cursor: not-allowed;
    }

    .yn-toggle input:disabled:not(:checked) + label {
        opacity: 0.45;
    }

        .yn-toggle input:disabled:not(:checked) + label:hover {
            color: var(--text-muted);
            background-color: transparent;
        }

    .yn-toggle input:disabled:checked + label {
        box-shadow: none;
        opacity: 0.85;
    }

/* Field tools: audit trail, SDV lock, query */
.field-tools {
    display: inline-flex;
    align-items: center;
    justify-self: center;
    gap: 6px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    line-height: 1;
    color: var(--main);
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, color 0.15s ease;
}

    .icon-btn:hover:not(:disabled):not(.is-disabled) {
        color: var(--dark-main);
        background-color: color-mix(in srgb, var(--light-main) 35%, white);
        border-color: var(--main);
        transform: translateY(-1px);
    }

    .icon-btn:disabled,
    .icon-btn.is-disabled {
        opacity: 0.45;
        cursor: not-allowed;
        transform: none;
    }

    .icon-btn svg {
        display: block;
        width: 16px;
        height: 16px;
        fill: currentColor;
    }

.icon-btn--audit {
    color: var(--attention-highlight);
}

.icon-btn--query {
    color: var(--main);
}

/* SDV lock: green = unlocked, red = locked (verified) */
.icon-btn--lock:not(.is-locked) {
    color: #166534;
    background-color: #dcfce7;
    border-color: #bbf7d0;
}

.icon-btn--lock.is-locked {
    color: #b91c1c;
    background-color: #fee2e2;
    border-color: #fecaca;
}

/* Query state: filled red = open query, green = resolved */
.icon-btn--query.has-query-open {
    color: #ffffff;
    background-color: var(--attention-highlight);
    border-color: var(--attention-highlight);
}

.icon-btn--query.has-query-resolved {
    color: #166534;
    background-color: #dcfce7;
    border-color: #bbf7d0;
}

.sdv-hidden-checkbox {
    display: none !important;
}

/* Wide modal (audit trail, queries) */
.app-modal-wide {
    width: min(960px, calc(100vw - 32px));
}

/* Tables inside modals */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .data-table th {
        padding: 10px;
        text-align: left;
        white-space: nowrap;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-muted);
        background-color: var(--background);
        border-bottom: 1px solid var(--border-color);
    }

    .data-table td {
        padding: 10px;
        vertical-align: top;
        color: var(--dark-main);
        border-bottom: 1px solid var(--divider);
    }

.data-empty {
    padding: 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--main);
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

/* Query modal */
.query-switch-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 14px;
}

.query-switch-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark-main);
}

.query-switch input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--main);
}

    .query-switch input[type="checkbox"]:disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }

.query-status {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--dark-main);
}

.query-input-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}


/* 17. Visits, Tasks & Sign-off pages =================================== */
/* Visit cards + General Tasks panel (CLASSIFY Visits page);
   context cards + task cards (CLASSIFY VisitForm page); sign-off certificate */

.visits-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 32px 56px;
}

.visits-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 0.9fr);
    gap: 24px;
    align-items: stretch; /* Visits and General Tasks cards share the row height */
}

.panel-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

.panel-header {
    padding: 16px 20px;
    background-color: var(--background);
    border-bottom: 1px solid var(--divider);
}

.panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-main);
}

.panel-body {
    flex: 1 1 auto; /* body fills the stretched card */
    padding: 20px;
}

/* Visit cards */
.visit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.visit-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    min-height: 118px;
    padding: 16px;
    text-align: left;
    text-decoration: none !important;
    color: var(--main);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

    .visit-card:hover {
        transform: translateY(-1px);
        color: var(--dark-main);
        background-color: color-mix(in srgb, var(--light-main) 30%, white);
        border-color: var(--main);
        box-shadow: var(--shadow-card);
    }

    .visit-card:focus-visible {
        outline: 2px solid var(--main);
        outline-offset: 2px;
    }

.visit-day {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--attention-highlight);
}

.visit-name {
    display: block;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--dark-main);
}

/* Sub label, e.g. "Telephone Contact" */
.visit-sub {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--dark-main);
    background-color: color-mix(in srgb, var(--light-main) 45%, white);
    border: 1px solid var(--border-color);
    border-radius: 999px;
}

.visit-action {
    display: block;
    margin-top: 18px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--main);
    opacity: 0.8;
}

/* General tasks */
.section-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-card {
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    text-align: left;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--dark-main);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

    .section-card:hover {
        transform: translateY(-1px);
        background-color: color-mix(in srgb, var(--light-main) 35%, white);
        border-color: var(--main);
    }

    .section-card:focus-visible {
        outline: 2px solid var(--main);
        outline-offset: 2px;
    }

/* Sign-off page: certificate text above the signature summary */
.signoff-body {
    padding: 20px 22px 4px;
}

.signoff-statement {
    margin: 0 0 18px;
    font-size: 14px;
    font-style: italic;
    line-height: 1.6;
    color: var(--dark-main);
}

/* Context cards (Tasks page: center, patient code, group; Sign-off page: signature) */
.context-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.context-card {
    padding: 14px 16px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.context-label {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.context-value {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-main);
}

/* Tasks page, "Visit Tasks" card header: title left, visit date + Save far right */
.visit-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
}

.visit-date-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.visit-date-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--main);
    opacity: 0.78;
}

.visit-date-input {
    width: auto;
    min-width: 150px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

    .visit-date-input:disabled {
        cursor: not-allowed;
        opacity: 0.75;
    }

/* Compact button (e.g. visit date Save) */
.btn-small {
    height: 32px;
    padding: 0 12px;
    font-size: 11px;
}

/* Task cards: the whole card is the button; the note sits at the bottom */
.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.module-card-wrap {
    position: relative;
    width: 100%;
    height: 112px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

    .module-card-wrap:hover {
        transform: translateY(-1px);
        background-color: color-mix(in srgb, var(--light-main) 30%, white);
        border-color: var(--main);
        box-shadow: var(--shadow-card);
    }

.module-card {
    width: 100%;
    height: 100%;
    padding: 16px 16px 34px;
    text-align: left;
    vertical-align: top;
    white-space: normal;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--dark-main);
    background-color: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
}

    .module-card:focus-visible {
        outline: 2px solid var(--main);
        outline-offset: -4px;
        border-radius: 10px;
    }

    .module-card:disabled {
        cursor: not-allowed;
    }

/* Task card disabled (e.g. visit date not saved yet) */
.module-card-wrap.is-disabled {
    opacity: 0.55;
}

    .module-card-wrap.is-disabled:hover {
        transform: none;
        background-color: var(--card-bg);
        border-color: var(--border-color);
        box-shadow: none;
    }

.module-card-note {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 10px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none; /* clicks go through to the card button */
}


/* 18. Responsive ====================================================== */

@media (max-width: 1100px) {
    .visits-layout {
        grid-template-columns: 1fr;
    }

    .module-grid,
    .context-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .home-panels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    /* Top bar stacks; title stays centered */
    .topbar {
        grid-template-columns: 1fr;
        row-gap: 8px;
        padding: 8px 14px;
    }

    .topbar-logo,
    .topbar-center,
    .topbar-right {
        justify-self: center;
    }

    .topbar-logo {
        width: 56px;
        height: 56px;
    }

    .topbar-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-body {
        padding: 16px;
    }

    .home-content {
        padding: 26px 18px 36px;
    }

    .home-intro-title {
        font-size: 22px;
    }

    .home-section-title {
        font-size: 20px;
    }

    .patients-page {
        padding: 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .crf-page {
        padding: 16px;
    }

    .crf-row {
        grid-template-columns: 1fr auto;
        row-gap: 10px;
        padding: 14px 16px;
    }

    .crf-text {
        grid-column: 1 / -1;
    }

    .field-tools {
        justify-self: end;
    }

    .crf-row-head {
        display: none;
    }

    .crf-row-sub {
        padding-left: 32px;
    }

    .crf-answer {
        justify-self: start;
        padding-left: 38px;
    }

    .visits-page {
        padding: 16px;
    }

    .visit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .module-grid,
    .context-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .visit-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .visit-card,
    .section-card,
    .module-card-wrap {
        transition: none;
    }

        .visit-card:hover,
        .section-card:hover,
        .module-card-wrap:hover {
            transform: none;
        }
}


/* 19. Admin pages ===================================================== */
/* AdminPage menu, AdminUsers, AdminCenters, AdminLock (<body class="admin-page">).
   Built on the Homepage (13), Patients page (14) and Modal & forms (15) styles. */

/* AdminPage menu: three cards in a row */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}

.admin-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    color: var(--main);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

    .admin-card-icon svg {
        width: 22px;
        height: 22px;
    }

/* "12 users · 2 locked" under the card text */
.admin-card-stat {
    display: block;
    margin-top: -10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Toolbar above a table (e.g. center selector) */
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 18px;
}

    .admin-toolbar .form-input {
        min-width: 280px;
    }

/* Status badges in tables */
.admin-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-radius: 999px;
}

    .admin-badge.is-ok {
        color: #166534;
        background-color: #dcfce7;
    }

    .admin-badge.is-locked {
        color: #b91c1c;
        background-color: #fee2e2;
    }

    .admin-badge.is-warn {
        color: #9a3412;
        background-color: #fff7ed;
    }

    .admin-badge.is-muted {
        color: var(--text-muted);
        background-color: var(--input-bg);
    }

/* Left-aligned text cells in the centered patient-table */
.patient-table td.cell-left,
.patient-table th.cell-left {
    text-align: left;
}

/* Row with two buttons (Edit / Delete, Lock / History) */
.admin-row-actions {
    display: inline-flex;
    gap: 6px;
}

/* Destructive row button (Delete center): wine red outline, filled on hover */
.btn-row-danger {
    color: var(--attention-highlight);
    border-color: color-mix(in srgb, var(--attention-highlight) 35%, transparent);
}

    .btn-row-danger:hover:not(:disabled) {
        color: #ffffff;
        background-color: var(--attention-highlight);
        border-color: var(--attention-highlight);
    }

/* Center access list in the user modal (CheckBoxList, RepeatLayout="UnorderedList"):
   one row per center, checkbox on the left, name wrapping beside it */
.admin-check-list {
    display: block;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 12px;
    list-style: none;
    font-size: 13px;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
}

    .admin-check-list li {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        padding: 8px 2px;
        border-bottom: 1px solid var(--divider);
    }

        .admin-check-list li:last-child {
            border-bottom: none;
        }

    .admin-check-list input[type="checkbox"] {
        flex: 0 0 auto;
        width: 16px;
        height: 16px;
        margin: 0;
        accent-color: var(--main);
        cursor: pointer;
    }

    .admin-check-list label {
        flex: 1 1 auto;
        min-width: 0;
        line-height: 1.4;
        cursor: pointer;
    }

/* Single checkbox with its text (reset password, visible center) */
.admin-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-main);
}

    .admin-check-row input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: var(--main);
        cursor: pointer;
    }

/* Read-only input (e.g. the center code of an existing center): admin pages only */
.admin-page .form-input:disabled {
    color: var(--dark-main);
    background-color: var(--background);
    border-style: dashed;
    cursor: not-allowed;
}

/* Temporary password (shown once) */
.credential-box {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 16px;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--dark-main);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.credential-label {
    align-self: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.credential-value {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
    user-select: all;
}

@media (max-width: 1000px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}
