.teeth-chart {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.teeth-chart-quadrant {
    background: var(--bg-ffffff);
    border: 1px solid var(--bd-e5e7eb);
    border-radius: 12px;
    padding: 14px 16px;
}

.teeth-chart-quadrant-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--fg-374151);
    margin-bottom: 10px;
}

.teeth-chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.teeth-chart-tooth {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 40px;
}

.teeth-chart-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--fg-ffffff);
    background: var(--bg-16a34a);
    border: none;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .1s ease;
}

.teeth-chart-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--sh-000000-a018);
}

.teeth-chart-chip-static {
    cursor: default;
}

.teeth-chart-chip-static:hover {
    transform: none;
    box-shadow: none;
}

.teeth-chart-chip-primary {
    width: 26px;
    height: 26px;
    font-size: 11px;
    background: var(--bg-0ea5e9);
}

@media (max-width: 576px) {
    .teeth-chart {
        grid-template-columns: 1fr;
    }
}

.qn-list {
    display: flex;
    flex-direction: column;
}

.qn-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
}

.qn-item:last-child {
    border-bottom: 0;
}

.qn-num {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .78rem;
}

.qn-item-error .qn-num {
    background: var(--bg-fee2e2);
    color: var(--danger);
}

.qn-body {
    flex: 1;
    min-width: 0;
}

.qn-question {
    margin: 0 0 8px;
    padding-top: 2px;
    font-size: .92rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.6;
}

.qn-required {
    margin-inline-start: 4px;
    color: var(--danger);
}

.qn-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.qn-option {
    position: relative;
    margin: 0;
}

.qn-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.qn-option span {
    display: inline-flex;
    align-items: center;
    padding: 4px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-ffffff);
    color: var(--ink);
    font-size: .84rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.qn-option:hover span {
    border-color: var(--primary);
}

.qn-option input:checked+span {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--fg-ffffff);
    font-weight: 600;
}

.qn-option-no input:checked+span {
    background: var(--dark);
    border-color: var(--dark);
}

.qn-option-skip span {
    color: var(--muted);
    border-style: dashed;
}

.qn-option-skip input:checked+span {
    background: var(--bg-f3f4f6);
    border-color: var(--muted);
    color: var(--ink);
    font-weight: 500;
}

.qn-option input:focus-visible+span {
    box-shadow: 0 0 0 3px var(--sh-a8760a-a025);
}

.qn-item textarea.form-control,
.qn-item input.form-control {
    max-width: 560px;
    font-size: .88rem;
}

@media (max-width: 576px) {
    .qn-item {
        gap: 10px;
        padding: 10px 0;
    }
}

.reg-page {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px 48px;
    background: var(--bg-f6f5f2);
}

.reg-wrap {
    max-width: 880px;
    margin-inline: auto;
}

.reg-lang {
    display: flex;
    justify-content: center;
    padding: 0 0 14px;
}

.reg-lang a {
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-ffffff);
    color: var(--muted);
    font-size: .85rem;
    text-decoration: none;
}

.reg-lang a:hover {
    color: var(--primary);
}

.reg-card {
    background: var(--bg-ffffff);
    border: 1px solid var(--bd-eceae5);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 10px 28px -18px var(--sh-141414-a018);
}

.reg-title {
    margin: 0 0 4px;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
}

.reg-subtitle {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: .92rem;
}

.reg-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 28px 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}

.reg-section-title i {
    color: var(--primary);
}

.reg-consent {
    margin-bottom: 12px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-fcfbf8);
}

.reg-consent h3 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 700;
}

.reg-consent ul {
    margin: 0 0 8px;
    padding-inline-start: 1.2rem;
}

.reg-consent li {
    margin-bottom: 6px;
    font-size: .9rem;
    line-height: 1.7;
}

.reg-consent-sub {
    margin: 12px 0 6px;
    font-size: .92rem;
    font-weight: 700;
    color: var(--primary-deep);
}

.reg-agree {
    margin-top: 24px;
    text-align: center;
}

.reg-agree-hint {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: .85rem;
}

.reg-agree-btn {
    padding: 12px 28px;
    font-weight: 700;
}

.reg-state {
    text-align: center;
    padding: 32px 16px;
}

.reg-state-icon {
    margin-bottom: 12px;
    font-size: 3.2rem;
}

.reg-state-icon-success {
    color: var(--success);
}

.reg-state-icon-warning {
    color: var(--warning);
}

.invite-qr {
    display: inline-block;
    padding: 14px;
    background: var(--bg-ffffff);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.invite-qr svg {
    display: block;
    width: 260px;
    max-width: 100%;
    height: auto;
}

.invite-link {
    display: flex;
    gap: 8px;
    max-width: 520px;
    margin: 18px auto 0;
}

@media (max-width: 576px) {
    .reg-card {
        padding: 18px 14px;
    }
}

.reg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-ffffff);
    border-bottom: 2px solid var(--ink);
}

.reg-header+.reg-card {
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.reg-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
}

.reg-header-logo {
    height: 64px;
    width: auto;
}

@media (max-width: 576px) {
    .reg-header-title {
        font-size: .95rem;
    }

    .reg-header-logo {
        height: 48px;
    }
}

.reg-card .form-section-card>.row {
    margin-top: 0 !important;
    padding-top: .25rem;
}

.reg-consent {
    line-height: 1.7;
}

@media (max-width: 576px) {
    .reg-page {
        padding: 12px 10px 32px;
    }

    .reg-card {
        padding: 18px 14px;
    }

    .reg-header {
        padding: 10px 14px;
    }

    .reg-title {
        font-size: 1.15rem;
    }

    .reg-subtitle {
        margin-bottom: 14px;
        font-size: .85rem;
    }

    .reg-card .form-section-card {
        border: 0;
        border-radius: 0;
        overflow: visible;
    }

    .reg-card .form-section-card:not(:first-child),
    .reg-card .col-12+.col-12 .form-section-card,
    .reg-card .col-lg-6+.col-lg-6 .form-section-card {
        margin-top: 4px;
    }

    .reg-card .form-section-card .form-section-title {
        padding: 0 0 .5rem;
        font-size: 1rem;
    }

    .reg-card .form-section-card>.row {
        padding: .6rem 0 0;
    }

    .reg-card .row {
        --bs-gutter-x: .75rem;
    }

    .reg-card .form-control,
    .reg-card select.form-control {
        font-size: 16px;
    }

    .reg-section-title {
        margin-top: 22px;
    }

    .reg-consent {
        padding: 12px 14px;
    }

    .reg-agree-btn {
        width: 100%;
        padding: 12px 16px;
    }
}

.reg-state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    margin-bottom: 18px;
    border-radius: 50%;
    font-size: 2.3rem;
}

.reg-state-badge-success {
    background: var(--bg-dcfce7);
    color: var(--success);
}

.reg-state-badge-warning {
    background: var(--bg-fef3c7);
    color: var(--warning);
}

.reg-state .reg-title {
    font-size: 1.35rem;
}

.reg-state .reg-subtitle {
    max-width: 420px;
    margin-inline: auto;
}

.reg-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 10px 20px;
    border: 1px dashed var(--primary);
    border-radius: 12px;
    background: var(--primary-tint);
    color: var(--primary-deep);
    font-size: .9rem;
}

.reg-file-chip strong {
    font-size: 1.15rem;
    letter-spacing: .5px;
}

.reg-state-note {
    margin-top: 22px;
    color: var(--muted);
    font-size: .82rem;
}

.reg-page-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-block: 24px;
}

.reg-page-state .reg-wrap {
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
}

.reg-page-state .reg-header {
    border: 1px solid var(--bd-eceae5);
    border-bottom: 3px solid var(--primary);
    border-radius: 16px 16px 0 0;
}

.reg-page-state .reg-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 24px 32px;
}

.reg-page-state .reg-state-badge {
    box-shadow: 0 0 0 10px var(--sh-16a34a-a008);
    margin-bottom: 26px;
}

.reg-page-state .reg-state-badge-warning {
    box-shadow: 0 0 0 10px var(--sh-f59e0b-a01);
}

.reg-page-state .reg-file-chip {
    flex-direction: column;
    gap: 2px;
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    border-style: solid;
    border-width: 1px;
    border-color: var(--bd-a8760a-a03);
    text-align: center;
}

.reg-page-state .reg-file-chip strong {
    font-size: 1.6rem;
}

.reg-page-state .reg-state-note {
    margin-top: 26px;
    padding-top: 18px;
    width: 100%;
    border-top: 1px solid var(--line);
}

@media (max-width: 576px) {
    .reg-page-state {
        align-items: flex-start;
        padding-top: 16px;
    }
}

.patient-note {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-block: 12px;
    padding-inline: 22px 0;
    border-bottom: 1px solid var(--line);
}

.patient-note:last-child {
    border-bottom: 0;
}

.patient-note::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

.patient-note-content {
    flex: 1;
    min-width: 0;
}

.patient-note-body {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.patient-note-meta {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.patient-note-delete {
    flex: none;
    margin: 0;
}

textarea.patient-note-input {
    height: 220px;
    min-height: 220px;
    resize: vertical;
}

.failed-job-code {
    max-height: 420px;
    margin: 0 0 16px;
    padding: 12px 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-soft, #f8f9fb);
    font-size: 12px;
    unicode-bidi: plaintext;
    white-space: pre-wrap;
    word-break: break-word;
}

.open-treatments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.open-treatment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-ffffff);
}

.visit-services-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}

.visit-services-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: .75rem;
    padding: .7rem 1rem;
    border-radius: 10px;
    background: var(--primary-tint);
    color: var(--primary-deep);
    font-weight: 700;
}

.tooth-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--muted);
}

.tooth-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tooth-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--tooth-bg);
    border: 1px solid var(--tooth-border);
}

.tooth-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-dc2626);
    box-shadow: 0 0 0 2px var(--sh-ffffff), 0 0 0 3px var(--sh-dc2626);
}

.tooth-legend-bar {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: var(--ink);
}

.tooth-chart {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-ffffff);
}

.tooth-chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.tooth-chart-dentition-btn.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--fg-ffffff) !important;
}

.tooth-chart-dentition {
    overflow-x: auto;
    padding-bottom: 4px;
}

.tooth-chart-sides {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    min-width: max-content;
}

.tooth-chart-jaw {
    display: flex;
    justify-content: center;
    min-width: max-content;
}

.tooth-chart-quadrant {
    display: flex;
    gap: 5px;
    padding: 6px 8px;
}

.tooth-chart-quadrant:first-child {
    border-inline-end: 2px dashed var(--line);
}

.tooth-chart-occlusal {
    height: 2px;
    margin: 4px 0;
    background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px);
    min-width: max-content;
}

.tooth-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 42px;
    height: 54px;
    padding: 0;
    border-radius: 10px;
    border: 1.5px solid var(--tooth-border);
    background: var(--tooth-bg);
    color: var(--tooth-fg);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}

.tooth-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--sh-000000-a015);
}

.tooth-cell-icon {
    font-size: 17px;
}

.tooth-chart-jaw-upper .tooth-cell-icon {
    transform: rotate(180deg);
}

.tooth-cell-dot {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-dc2626);
    box-shadow: 0 0 0 2px var(--sh-ffffff);
}

.tooth-cell-history {
    position: absolute;
    bottom: 3px;
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    opacity: .7;
}

.tooth-cell.is-selected {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px var(--primary-tint);
}

.tooth-chart[data-mode="select"] .tooth-cell:not(.is-selected) {
    opacity: .85;
}

.tooth-history-head {
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.tooth-history-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .7rem .85rem;
    margin-bottom: 10px;
}

.tooth-history-sessions {
    list-style: none;
    padding: 0;
    margin: .5rem 0 0;
    font-size: 13px;
}

.tooth-history-sessions li {
    padding: .35rem 0;
    border-top: 1px dashed var(--line);
}

.ongoing-treatments {
    border: 1px solid var(--bd-f3d9a4);
    background: var(--primary-tint);
    border-radius: 12px;
    padding: .8rem 1rem;
}

.ongoing-treatments-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--primary-deep);
}

.ongoing-treatments .open-treatment {
    border-color: var(--bd-f3d9a4);
}

.treatment-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
}

.treatment-progress-bar {
    flex: 1;
    min-width: 70px;
    max-width: 160px;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.treatment-progress-bar span {
    display: block;
    height: 100%;
    background: var(--bg-15803d);
    border-radius: 3px;
}

.treatment-progress-label {
    color: var(--muted);
    white-space: nowrap;
    font-weight: 600;
}

.treatment-progress-lg .treatment-progress-bar {
    min-width: 180px;
    max-width: 260px;
    height: 9px;
}

.treatment-progress-lg .treatment-progress-label {
    font-size: 13px;
    color: var(--ink);
}

.treatment-timeline {
    position: relative;
    padding-inline-start: 22px;
}

.treatment-timeline::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    inset-inline-start: 6px;
    width: 2px;
    background: var(--line);
}

.treatment-timeline-item {
    position: relative;
    padding: .55rem .8rem;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-ffffff);
}

.treatment-timeline-dot {
    position: absolute;
    top: 14px;
    inset-inline-start: -21px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--line);
    box-shadow: 0 0 0 3px var(--sh-ffffff);
}

.treatment-timeline-item.is-done .treatment-timeline-dot {
    background: var(--bg-15803d);
}

.line-course {
    border: 1px dashed var(--bd-f3d9a4);
    border-radius: 10px;
    padding: .75rem .9rem;
    background: var(--bg-ffffff);
}

.line-course-title {
    font-weight: 700;
    color: var(--primary-deep);
    margin-bottom: 8px;
}

.line-course-summary {
    display: inline-block;
    padding: .35rem .7rem;
    border-radius: 8px;
    background: var(--primary-tint);
    color: var(--primary-deep);
    font-size: 13px;
    font-weight: 600;
}

.line-course-summary:empty {
    display: none;
}

.tasks-editor {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: .7rem .8rem;
    background: var(--bg-ffffff);
}

.tasks-editor-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.tasks-editor select.form-control-sm,
.tasks-editor input.form-control-sm {
    min-width: 150px;
}

.session-tasks {
    list-style: none;
    margin: 0;
    padding: 0;
}

.session-tasks li {
    padding: 1px 0;
}

.odontogram-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.tooth-btn {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    border: 1px solid var(--bd-000000-a01);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    color: var(--fg-ffffff);
}

.tooth-btn.bg-light-tooth {
    background: var(--bg-dee2e6) !important;
    color: var(--fg-495057);
}
