/* Portal-wide custom checkboxes — shared by app + login */

.pms-check,
.patient-check-item,
.patient-check-label,
.permission-check-item,
.form-check,
.remember {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text, var(--white, #f4f4f4));
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.35;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.pms-check--card,
.patient-check-item,
.permission-check-item {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.permission-check-item {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.pms-check--card:hover,
.patient-check-item:hover,
.permission-check-item:hover {
    border-color: rgba(24, 181, 178, 0.45);
    background: var(--teal-soft, rgba(24, 181, 178, 0.12));
    box-shadow: 0 0 0 1px rgba(24, 181, 178, 0.12);
}

.pms-check--card:has(input:checked),
.patient-check-item:has(input:checked),
.permission-check-item:has(input:checked) {
    border-color: rgba(24, 181, 178, 0.55);
    background: rgba(24, 181, 178, 0.12);
    box-shadow: 0 4px 14px rgba(17, 151, 160, 0.12);
}

.pms-check span,
.patient-check-item span,
.patient-check-label span,
.permission-check-item span,
.form-check span,
.remember span {
    flex: 1;
    padding-top: 1px;
}

.pms-check input[type="checkbox"],
.patient-check-item input[type="checkbox"],
.patient-check-label input[type="checkbox"],
.permission-check-item input[type="checkbox"],
.form-check input[type="checkbox"],
.remember input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin: 0;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 7px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.08) 100%), var(--bg-card, var(--panel, #28353f));
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.pms-check input[type="checkbox"]:hover,
.patient-check-item input[type="checkbox"]:hover,
.patient-check-label input[type="checkbox"]:hover,
.permission-check-item input[type="checkbox"]:hover,
.form-check input[type="checkbox"]:hover,
.remember input[type="checkbox"]:hover {
    border-color: var(--teal-2);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(24, 181, 178, 0.12);
}

.pms-check input[type="checkbox"]:checked,
.patient-check-item input[type="checkbox"]:checked,
.patient-check-label input[type="checkbox"]:checked,
.permission-check-item input[type="checkbox"]:checked,
.form-check input[type="checkbox"]:checked,
.remember input[type="checkbox"]:checked {
    border-color: transparent;
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-2) 100%);
    box-shadow: 0 2px 10px rgba(17, 151, 160, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.pms-check input[type="checkbox"]:checked::after,
.patient-check-item input[type="checkbox"]:checked::after,
.patient-check-label input[type="checkbox"]:checked::after,
.permission-check-item input[type="checkbox"]:checked::after,
.form-check input[type="checkbox"]:checked::after,
.remember input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(1);
    animation: pms-check-pop 0.2s ease;
}

@keyframes pms-check-pop {
    0% { transform: rotate(45deg) scale(0.5); opacity: 0; }
    100% { transform: rotate(45deg) scale(1); opacity: 1; }
}

.pms-check input[type="checkbox"]:focus-visible,
.patient-check-item input[type="checkbox"]:focus-visible,
.patient-check-label input[type="checkbox"]:focus-visible,
.permission-check-item input[type="checkbox"]:focus-visible,
.form-check input[type="checkbox"]:focus-visible,
.remember input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--teal-2);
    outline-offset: 2px;
}

.pms-check input[type="checkbox"]:active,
.patient-check-item input[type="checkbox"]:active,
.patient-check-label input[type="checkbox"]:active,
.permission-check-item input[type="checkbox"]:active,
.form-check input[type="checkbox"]:active,
.remember input[type="checkbox"]:active {
    transform: scale(0.92);
}

.pms-check--highlight {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.pms-check--highlight:hover {
    border-color: rgba(24, 181, 178, 0.45);
    background: var(--teal-soft, rgba(24, 181, 178, 0.12));
}

.pms-check--highlight:has(input:checked) {
    border-color: rgba(24, 181, 178, 0.55);
    background: rgba(24, 181, 178, 0.12);
}

.pms-check--highlight span {
    font-size: 0.9rem;
    font-weight: 600;
}

[data-theme="light"] .pms-check--card,
[data-theme="light"] .patient-check-item,
[data-theme="light"] .permission-check-item,
[data-theme="light"] .pms-check--highlight {
    background: #fff;
}

[data-theme="light"] .pms-check--card:hover,
[data-theme="light"] .patient-check-item:hover,
[data-theme="light"] .permission-check-item:hover,
[data-theme="light"] .pms-check--highlight:hover {
    background: var(--teal-soft, rgba(13, 110, 117, 0.1));
}

[data-theme="light"] .pms-check input[type="checkbox"],
[data-theme="light"] .patient-check-item input[type="checkbox"],
[data-theme="light"] .patient-check-label input[type="checkbox"],
[data-theme="light"] .permission-check-item input[type="checkbox"],
[data-theme="light"] .form-check input[type="checkbox"],
[data-theme="light"] .remember input[type="checkbox"] {
    border-color: rgba(51, 65, 85, 0.28);
    background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .pms-check input[type="checkbox"]:checked,
[data-theme="light"] .patient-check-item input[type="checkbox"]:checked,
[data-theme="light"] .patient-check-label input[type="checkbox"]:checked,
[data-theme="light"] .permission-check-item input[type="checkbox"]:checked,
[data-theme="light"] .form-check input[type="checkbox"]:checked,
[data-theme="light"] .remember input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--teal), var(--teal-2));
    box-shadow: 0 2px 8px rgba(13, 110, 117, 0.28);
}

/* ── Patient flags panel (demographics) ─────────────────────────────────────── */
.patient-flags-panel {
    margin-top: 16px;
    padding: 16px 18px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(
        160deg,
        rgba(24, 181, 178, 0.06) 0%,
        rgba(0, 0, 0, 0.12) 48%,
        var(--panel, #28353f) 100%
    );
}

.patient-flags-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.patient-flags-head-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--teal-2);
    background: rgba(24, 181, 178, 0.14);
    border: 1px solid rgba(24, 181, 178, 0.25);
}

.patient-flags-head strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.patient-flags-head p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.patient-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.patient-check-item.pms-check--card {
    align-items: flex-start;
    gap: 14px;
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.patient-check-item.pms-check--card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    border-radius: 12px 0 0 12px;
    transition: background 0.2s ease;
}

.patient-check-item.pms-check--card:has(input:checked)::before {
    background: linear-gradient(180deg, var(--teal) 0%, var(--teal-2) 100%);
}

.patient-check-item.pms-check--card:has(input:checked) {
    transform: translateY(-1px);
}

.patient-check-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    padding-top: 0 !important;
}

.patient-check-text strong {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.patient-check-text small {
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.4;
    font-weight: 400;
}

.patient-check-item input[type="checkbox"] {
    margin-top: 2px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 8px;
}

.patient-check-item input[type="checkbox"]:checked::after {
    left: 8px;
    top: 4px;
    width: 6px;
    height: 11px;
}

[data-theme="light"] .patient-flags-panel {
    background: linear-gradient(160deg, rgba(13, 110, 117, 0.06) 0%, #f8fafc 100%);
}

@media (max-width: 768px) {
    .patient-check-grid {
        grid-template-columns: 1fr;
    }
}

/* Inline variant (forms, modals) */
.pms-check--inline {
    padding: 8px 0;
}
