/* Checkbox = seleção, radio = escolha única, switch = estado persistente. */
:root {
    --choice-green: var(--color-green, #2E7D32);
    --choice-green-dark: #1B5E20;
    --choice-border: #82958a;
    --choice-surface: #fff;
    --choice-muted: #617168;
    --choice-focus: 0 0 0 3px rgba(18, 103, 187, .24);
}

:where(.admin, .auth-shell, .public-shell) .form-check {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    min-height: 2.75rem;
    padding: .2rem .7rem;
    border: 1px solid #d9e2dd;
    border-radius: .7rem;
    background: #fbfdfb;
}

:where(.admin, .auth-shell, .public-shell) .form-check .form-check-input {
    float: none;
    margin: .72rem 0 0;
}

:where(.admin, .auth-shell, .public-shell) .form-check .form-check-label {
    display: flex;
    flex: 1;
    align-items: center;
    min-height: 2.75rem;
    margin: 0;
    color: #34473d;
    font-size: .875rem;
    font-weight: 650;
    cursor: pointer;
}

.sig-checkbox--option {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 2.75rem;
    padding: .45rem .6rem;
    border: 1px solid transparent;
    border-radius: .6rem;
    color: #34473d;
    font-size: .875rem;
    font-weight: 650;
    cursor: pointer;
}

.sig-checkbox--option:hover { border-color: #c6d5cc; background: #f3f8f5; }

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input) {
    width: 1.3rem;
    height: 1.3rem;
    min-height: 1.3rem;
    border: 2px solid var(--choice-border);
    border-radius: .35rem;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: var(--choice-surface);
    background-image: none !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: .9rem .9rem !important;
    box-shadow: none;
    cursor: pointer;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input):checked {
    border-color: var(--choice-green);
    background-color: var(--choice-green);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.35' d='m3.2 8.3 3 3 6.6-6.8'/%3E%3C/svg%3E") !important;
}

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input)::before,
:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input)::after {
    display: none !important;
    content: none !important;
}

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input):indeterminate {
    border-color: var(--choice-green);
    background-color: var(--choice-green);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-width='2.4' d='M3.5 8h9'/%3E%3C/svg%3E") !important;
}

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input):disabled {
    border-color: #aab5af;
    background-color: #edf0ee;
    cursor: not-allowed;
    opacity: 1;
}

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input):disabled:checked,
:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input):disabled:indeterminate {
    border-color: #718078;
    background-color: #718078;
}

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:disabled + .form-check-label,
.sig-checkbox:has(input[type="checkbox"]:disabled) { color: #6d7872; cursor: not-allowed; }

:where(table, .table) tbody tr:has(input[type="checkbox"]:checked) { background-color: #f0f7f2; }

:where(.admin, .auth-shell, .public-shell) input[type="checkbox"]:not(.switch-input):not(.sig-switch__input):focus-visible,
:where(.admin, .auth-shell, .public-shell) input[type="radio"]:focus-visible + label,
.sig-switch__input:focus-visible + .sig-switch__text + .sig-switch__track {
    outline: 2px solid #1267bb;
    outline-offset: 2px;
    box-shadow: var(--choice-focus);
}

:where(.admin, .auth-shell, .public-shell) input[type="radio"] + label {
    min-height: 2.75rem;
    border: 1px solid #b8c6be;
    border-radius: .65rem;
    background: var(--choice-surface);
    color: #293a31;
    font-weight: 650;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.sig-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    padding: .2rem;
    border-radius: .75rem;
}

.sig-radio-group > * { min-width: min(100%, 8rem); }
.sig-radio-group input[type="radio"] + label { margin: 0 !important; }

:where(.admin, .auth-shell, .public-shell) input[type="radio"] + label:hover {
    border-color: var(--choice-green);
    background: #f0f8f3;
}

:where(.admin, .auth-shell, .public-shell) input[type="radio"]:checked + label {
    border-color: var(--choice-green);
    background: #e8f4ec;
    color: var(--choice-green-dark);
    box-shadow: inset 0 0 0 1px var(--choice-green);
}

.sig-switch-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.75rem;
    padding: .85rem 1rem;
    border: 1px solid #d6e0da;
    border-radius: .75rem;
    background: #fafcfb;
}

.sig-switch-field__title { display: block; color: #24342b; font-size: .9rem; font-weight: 750; }
.sig-switch-field small { display: block; max-width: 34rem; margin-top: .2rem; color: var(--choice-muted); font-size: .75rem; line-height: 1.4; }
.sig-switch { display: inline-flex; align-items: center; gap: .55rem; margin: 0; cursor: pointer; user-select: none; }
.sig-switch__input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    appearance: none !important;
    opacity: 0;
}
.sig-switch__track { position: relative; width: 3rem; height: 1.65rem; flex: 0 0 3rem; border: 2px solid #778a7f; border-radius: 999px; background: #dfe5e1; transition: border-color .16s ease, background-color .16s ease; }
.sig-switch__thumb { position: absolute; top: 50%; left: .17rem; width: 1.12rem; height: 1.12rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(24, 48, 35, .3); transform: translateY(-50%); transition: left .16s ease; }
.sig-switch__text { color: var(--choice-muted); font-size: .78rem; font-weight: 700; }
.sig-switch__input:checked ~ .sig-switch__track { border-color: var(--choice-green); background: var(--choice-green); }
.sig-switch__input:checked ~ .sig-switch__track .sig-switch__thumb { left: 1.42rem; }
.sig-switch__input:checked ~ .sig-switch__text--on,
.sig-switch__input:not(:checked) ~ .sig-switch__text--off { color: var(--choice-green-dark); }
.sig-switch__input:disabled ~ * { cursor: not-allowed; opacity: .6; }

@media (max-width: 767.98px) {
    .sig-switch-field { align-items: flex-start; flex-direction: column; }
    .sig-switch { min-height: 2.75rem; }
    :where(.admin, .auth-shell, .public-shell) input[type="radio"] + label { width: 100%; }
    .sig-radio-group { display: grid !important; grid-template-columns: 1fr; width: 100%; }
    .sig-radio-group > * { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .sig-switch__track, .sig-switch__thumb,
    :where(.admin, .auth-shell, .public-shell) input[type="radio"] + label { transition: none; }
}

@media (forced-colors: active) {
    .sig-switch__track { border: 2px solid ButtonText; background: ButtonFace; }
    .sig-switch__input:checked ~ .sig-switch__track { background: Highlight; }
    .sig-switch__thumb { background: ButtonText; forced-color-adjust: none; }
}
