:root {
    --bg: #f3f5ef;
    --panel: rgba(255, 255, 255, 0.94);
    --line: #d5dccd;
    --text: #173226;
    --muted: #5f6f66;
    --primary: #116149;
    --primary-strong: #0b4332;
    --soft: #dfe8d8;
    --danger: #b93c2f;
    --radius: 22px;
    --shadow: 0 18px 50px rgba(23, 50, 38, 0.08);
    --focus: rgba(17, 97, 73, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(17, 97, 73, 0.12), transparent 30%),
        linear-gradient(135deg, #f6f7f0 0%, #edf1e7 100%);
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
a, button, input, select, textarea { transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease, transform .18s ease; }
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--focus);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.sidebar {
    padding: 28px 22px;
    background: linear-gradient(180deg, #13382c 0%, #0f2d23 100%);
    color: #eff8f2;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.brand { display: flex; gap: 16px; align-items: center; margin-bottom: 26px; }
.brand p { margin: 4px 0 0; color: rgba(239, 248, 242, 0.75); }
.brand-mark {
    width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
    background: linear-gradient(135deg, #dfe8d8, #7ed1a8); color: #123427; font-weight: 700;
}
.nav { display: grid; gap: 14px; }
.nav-section-label {
    margin-top: 8px;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(239, 248, 242, 0.58);
    padding: 0 8px;
}
.nav-link, .nav-sublink { display: block; border-radius: 14px; transition: 180ms ease; }
.nav-link { padding: 12px 14px; font-weight: 600; }
.nav-link:hover, .nav-link.active { background: rgba(223, 232, 216, 0.15); transform: translateX(2px); }
.nav-sub { display: grid; gap: 6px; margin-top: 8px; padding-left: 8px; }
.nav-sublink { padding: 9px 12px; color: rgba(239, 248, 242, 0.82); font-size: 0.95rem; }
.nav-sublink:hover, .nav-sublink.active { background: rgba(223, 232, 216, 0.12); color: #fff; }

.content { padding: 28px; min-width: 0; }
.content > * { max-width: 1480px; }
.topbar, .panel, .metric-card, .module-card, .health-card, .auth-card {
    background: var(--panel); border: 1px solid rgba(213, 220, 205, 0.75);
    box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.topbar, .panel, .auth-card { border-radius: var(--radius); }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px 26px; margin-bottom: 22px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.context-subnav {
    padding: 18px 22px;
    margin-bottom: 22px;
    position: sticky;
    top: 102px;
    z-index: 19;
}
.context-subnav-head { margin-bottom: 14px; }
.context-subnav-head h2 { margin: 4px 0 0; font-size: 1.15rem; }
.context-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.context-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: #f6f8f2;
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 600;
    transition: 180ms ease;
}
.context-tab:hover,
.context-tab.active {
    background: var(--soft);
    color: var(--primary-strong);
    border-color: rgba(17, 97, 73, 0.22);
}
.anamnese-builder {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    min-height: 84px;
}
.anamnese-question {
    display: grid;
    gap: 8px;
}
.anamnese-question label,
.anamnese-question legend {
    font-weight: 600;
}
.anamnese-question fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}
.anamnese-choice-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.anamnese-choice {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}
.anamnese-question textarea,
.anamnese-question input,
.anamnese-question select {
    width: 100%;
}
.topbar h1, .panel h2, .auth-card h1 { margin: 4px 0 0; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.inline-form { margin: 0; }
.inline-form select { min-width: 220px; }
.eyebrow { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.muted { color: var(--muted); }
.pill {
    display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 999px;
    background: var(--primary); color: #fff; font-size: .9rem;
}
.pill.soft { background: var(--soft); color: var(--primary-strong); }
.btn {
    border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 18px; border-radius: 14px; background: var(--primary); color: #fff; font-weight: 600;
}
.btn:hover { transform: translateY(-1px); filter: saturate(1.04); }
.btn.small { padding: 9px 12px; font-size: .9rem; }
.btn.ghost { background: #f7f8f3; color: var(--primary-strong); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }

.dashboard-grid, .module-grid, .health-grid { display: grid; gap: 18px; }
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 22px; }
.metric-card, .health-card, .module-card { border-radius: 20px; padding: 20px; }
.metric-card p, .health-card span, .module-card p { margin: 0; color: var(--muted); }
.metric-card strong, .health-card strong { display: block; margin-top: 10px; font-size: 1.9rem; }
.panel { padding: 22px; margin-bottom: 22px; }
.panel-head {
    display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 18px;
}
.split { display: grid; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); gap: 22px; align-items: start; }
.module-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.module-card h3 { margin: 8px 0 12px; }
.module-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 12px; flex-wrap: wrap; }
.health-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.health-card.ok { border-color: rgba(17, 97, 73, 0.25); }
.health-card.warn { border-color: rgba(210, 133, 38, 0.32); }
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; }
.flash { padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; }
.flash.success { background: #e6f4ec; color: #1b5e43; }
.flash.error { background: #fdeae7; color: #8f2d24; }
.status-grid, .patient-grid, .action-grid, .patient-overview { display: grid; gap: 16px; }
.status-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.patient-overview { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.status-card, .patient-card, .action-card, .timeline-item {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
}
.patient-card:hover,
.action-card:hover,
.status-card:hover,
.timeline-item:hover,
.metric-card:hover,
.module-card:hover {
    border-color: rgba(17, 97, 73, 0.24);
    box-shadow: 0 12px 24px rgba(23, 50, 38, 0.06);
}
.status-card { padding: 20px; }
.status-card strong { display: block; font-size: 1.8rem; margin-bottom: 8px; }
.patient-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.patient-card { padding: 18px; }
.patient-card h3 { margin: 0 0 10px; }
.patient-card p { margin: 0 0 6px; color: var(--muted); }
.action-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.action-card { display: block; padding: 18px; }
.action-card strong { display: block; margin-bottom: 8px; }
.action-card span { color: var(--muted); }
.timeline { display: grid; gap: 14px; }
.timeline-item {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 16px;
    padding: 18px;
}
.timeline-time strong, .timeline-time span { display: block; }
.timeline-time span { margin-top: 4px; color: var(--muted); }
.timeline-body h3 { margin: 0 0 6px; }
.timeline-body p { margin: 0 0 12px; color: var(--muted); }
.tag-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
    align-items: end;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(180px, 1fr));
    gap: 14px;
}
.calendar-grid.day-view { grid-template-columns: minmax(0, 1fr); }
.calendar-grid.month { grid-template-columns: repeat(7, minmax(130px, 1fr)); }
.agenda-board {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    margin-top: 18px;
}
.agenda-sidebar-rail {
    display: grid;
    gap: 18px;
    align-content: start;
}
.agenda-main-rail {
    min-width: 0;
}
.agenda-side-panel {
    margin-bottom: 0;
}
.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}
.mini-calendar-day {
    display: grid;
    place-items: center;
    min-height: 38px;
    border-radius: 12px;
    background: #f7f9f4;
    border: 1px solid var(--line);
    font-weight: 600;
}
.mini-calendar-day.muted {
    opacity: 0.55;
}
.mini-calendar-day.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.agenda-side-summary {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f3f7ef;
    display: grid;
    gap: 6px;
}
.agenda-side-summary strong {
    font-size: 1.6rem;
}
.legend-list {
    display: grid;
    gap: 10px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcf8;
}
.legend-item.active {
    border-color: rgba(17, 97, 73, 0.42);
    background: #eef7f1;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #3778c2;
    flex: 0 0 auto;
}
.legend-dot.clinic {
    background: linear-gradient(135deg, #3778c2, #1b8d5f);
}
.google-calendar {
    border: 1px solid var(--line);
    border-radius: 22px;
    overflow: hidden;
    background: #fff;
    margin-top: 18px;
}
.google-calendar-head {
    display: grid;
    grid-template-columns: 82px repeat(var(--day-count, 7), minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
    background: #fbfcf8;
}
.google-time-head {
    border-right: 1px solid var(--line);
}
.google-day-head {
    padding: 14px 10px;
    text-align: center;
    border-right: 1px solid var(--line);
    display: grid;
    gap: 4px;
}
.google-day-head.today {
    background: #eef7f1;
}
.google-day-head span {
    color: var(--muted);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.google-day-head strong {
    font-size: 1.25rem;
}
.google-calendar-body {
    display: grid;
    grid-template-columns: 82px 1fr;
    min-height: var(--calendar-height, 720px);
}
.google-time-column {
    border-right: 1px solid var(--line);
    background: #fff;
}
.time-slot-label {
    height: 72px;
    padding: 0 12px;
    transform: translateY(-10px);
    color: var(--muted);
    font-size: .85rem;
    text-align: right;
}
.google-days-grid {
    position: relative;
    min-height: var(--calendar-height, 720px);
}
.google-grid-lines {
    display: grid;
    grid-template-columns: repeat(var(--day-count, 7), minmax(0, 1fr));
}
.google-grid-cell {
    display: block;
    height: 72px;
    border-right: 1px solid #e8ece2;
    border-bottom: 1px solid #edf1e9;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,246,0.98));
}
.google-grid-cell.today {
    background: linear-gradient(180deg, rgba(238,247,241,0.98), rgba(248,251,246,0.98));
}
.google-grid-cell:hover {
    background: linear-gradient(180deg, rgba(223,232,216,0.42), rgba(248,251,246,0.98));
}
.google-events-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.google-event-card {
    position: absolute;
    margin: 3px 5px;
    border-radius: 14px;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--event-color, #3778c2) 18%, white);
    border-left: 4px solid var(--event-color, #3778c2);
    box-shadow: 0 10px 20px rgba(27, 68, 114, 0.08);
    overflow: hidden;
    display: grid;
    gap: 4px;
    pointer-events: auto;
    isolation: isolate;
}
.stretched-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 14px;
}
.google-event-card.status-confirmado { background: color-mix(in srgb, var(--event-color, #1b8d5f) 14%, #eef8f1); }
.google-event-card.status-em_atendimento { background: color-mix(in srgb, var(--event-color, #d28526) 14%, #fff6df); }
.google-event-card.status-faltou { background: #fdeae7; border-left-color: #b93c2f; }
.google-event-card.status-cancelado { background: #efefef; border-left-color: #6c757d; }
.google-event-card.status-bloqueado { background: color-mix(in srgb, var(--event-color, #6a4eb0) 14%, #f3effd); }
.google-event-card strong {
    font-size: .92rem;
    line-height: 1.2;
    position: relative;
    z-index: 2;
}
.google-event-card span,
.google-event-time {
    color: #365246;
    font-size: .78rem;
    line-height: 1.2;
    position: relative;
    z-index: 2;
}
.google-event-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
    position: relative;
    z-index: 3;
}
.google-event-actions a {
    font-size: .72rem;
    font-weight: 700;
    color: var(--primary-strong);
}
.google-calendar.single-day .google-calendar-head {
    grid-template-columns: 82px minmax(0, 1fr);
}
.google-calendar.single-day .google-grid-lines {
    grid-template-columns: minmax(0, 1fr);
}
.agenda-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.agenda-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--primary-strong);
    font-weight: 600;
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--dentist-color, #d5dccd) 35%, white);
}
.agenda-filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: none;
}
.calendar-day {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    min-height: 300px;
    overflow: hidden;
}
.calendar-day.today {
    border-color: rgba(17, 97, 73, 0.45);
    box-shadow: inset 0 0 0 1px rgba(17, 97, 73, 0.12);
}
.calendar-day.month-cell {
    min-height: 240px;
}
.calendar-day.muted-cell {
    opacity: 0.72;
}
.calendar-day > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #f3f7ef;
}
.calendar-slots {
    display: grid;
    gap: 10px;
    padding: 12px;
}
.calendar-event {
    border-radius: 16px;
    padding: 12px;
    background: #eaf2ff;
    border-left: 4px solid #3778c2;
}
.calendar-event.status-confirmado { background: #e8f5ee; border-left-color: #1b8d5f; }
.calendar-event.status-em_atendimento { background: #fff4d8; border-left-color: #d28526; }
.calendar-event.status-faltou { background: #fdeae7; border-left-color: #b93c2f; }
.calendar-event.status-cancelado { background: #efefef; border-left-color: #6c757d; }
.calendar-event.status-bloqueado { background: #ece7fb; border-left-color: #6a4eb0; }
.event-main { display: grid; gap: 6px; margin-bottom: 10px; }
.event-main span { color: var(--muted); font-size: 0.92rem; }
.event-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mini-form { margin: 0; }
.calendar-layout { grid-template-columns: minmax(420px, 1.15fr) minmax(280px, 0.85fr); }
.status-grid.compact { margin: 18px 0 0; }
.agenda-support-grid {
    display: grid;
    gap: 16px;
}
.support-box {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    padding: 18px;
}
.support-box h3 {
    margin: 8px 0 12px;
}
.patient-registration-layout {
    grid-template-columns: minmax(720px, 1.35fr) minmax(320px, 0.65fr);
}
.pricing-layout {
    grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.9fr);
}
.patient-form {
    display: grid;
    gap: 18px;
}
.patient-inline-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.patient-form-section {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    overflow: hidden;
}
.patient-form-section-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: #f3f7ef;
}
.patient-form-section-head h3 {
    margin: 0;
    font-size: 1rem;
}
.patient-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
}
.patient-form-grid .field {
    margin: 0;
}
.patient-form-grid .patient-full {
    grid-column: 1 / -1;
}
.patient-form-grid .patient-wide {
    grid-column: span 2;
}
.radio-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 48px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 14px;
    background: #fff;
}
.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.radio-item input {
    width: auto;
    margin: 0;
}
.odontogram-wrap {
    display: grid;
    gap: 18px;
}
.odontogram-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 10px;
}
.tooth-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcf8;
    padding: 12px 10px;
    display: grid;
    gap: 6px;
    min-height: 112px;
}
.tooth-card.active {
    background: #e8f5ee;
    border-color: rgba(17, 97, 73, 0.35);
}
.tooth-card strong {
    font-size: 1.05rem;
}
.tooth-card span,
.tooth-card small {
    color: var(--muted);
}
.odontogram-wrap.advanced {
    gap: 22px;
}
.odontogram-svg-shell {
    display: grid;
    gap: 18px;
}
.odontogram-canvas-wrap {
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(180deg, #fcfdf9, #f5f8f1);
    padding: 12px;
}
.odontogram-canvas {
    width: 100%;
    min-height: 360px;
}
.odontogram-arcade-card {
    border: 1px solid var(--line);
    border-radius: 26px;
    background: linear-gradient(180deg, #fcfdf9, #f5f8f1);
    padding: 14px 14px 6px;
}
.odontogram-arcade-head {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}
.odontogram-svg {
    width: 100%;
    height: auto;
    display: block;
}
.odontogram-workspace {
    display: block;
}
.odontogram-visual-panel,
.odontogram-side-panel {
    display: grid;
    gap: 16px;
}
.odontogram-visual-panel {
    gap: 18px;
}
.odontogram-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.odontogram-batch-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.odontogram-icon-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}
.odontogram-form-panel {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(252, 253, 249, 0.95), rgba(245, 248, 241, 0.95));
    padding: 18px;
}
.odontogram-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.odontogram-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.odontogram-check:has(input:checked) {
    border-color: rgba(17, 97, 73, 0.36);
    background: #eef7f1;
    box-shadow: 0 0 0 3px rgba(17, 97, 73, 0.08);
}
.odontogram-check input {
    width: 18px;
    height: 18px;
    accent-color: #116149;
    margin: 0;
}
.odontogram-check span {
    font-weight: 600;
    color: var(--text);
}
.odontogram-tool {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 16px;
    padding: 12px 10px;
    display: grid;
    gap: 6px;
    justify-items: center;
    cursor: pointer;
    color: var(--primary-strong);
    font: inherit;
}
.odontogram-tool:hover,
.odontogram-tool.is-selected {
    background: #eef7f1;
    border-color: rgba(17, 97, 73, 0.35);
}
.odontogram-tool-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #dcecff;
    font-weight: 800;
}
.svg-tooth-label,
.svg-tooth-summary,
.svg-marker text,
.svg-arcade-label {
    font-family: inherit;
}
.svg-arcade-label {
    font-size: 11px;
    font-weight: 800;
    fill: #173226;
    text-anchor: middle;
    letter-spacing: 0.02em;
    paint-order: stroke fill;
    stroke: rgba(252, 253, 249, 0.98);
    stroke-width: 2px;
    pointer-events: none;
}
.svg-tooth-label {
    font-size: 9px;
    font-weight: 800;
    fill: var(--primary-strong);
    text-anchor: middle;
    paint-order: stroke fill;
    stroke: rgba(252, 253, 249, 0.95);
    stroke-width: 2px;
    pointer-events: none;
}
.svg-tooth-summary {
    font-size: 6px;
    fill: var(--muted);
    text-anchor: middle;
    paint-order: stroke fill;
    stroke: rgba(252, 253, 249, 0.95);
    stroke-width: 1.5px;
    pointer-events: none;
}
.svg-tooth-face,
.svg-root-shape,
.svg-root-hit {
    transition: fill .18s ease, stroke .18s ease, opacity .18s ease, transform .18s ease;
}
.svg-crown-outline {
    fill: rgba(255, 255, 255, 0.92);
    stroke: #c3cdc0;
    stroke-width: 1.15;
    pointer-events: none;
}
.svg-tooth-face,
.svg-root-shape {
    fill: #fff;
    stroke: #bfcabc;
    stroke-width: 1.1;
}
.svg-root-hit {
    fill: transparent;
    stroke: transparent;
    cursor: pointer;
}
.svg-tooth-face {
    cursor: pointer;
}
.svg-tooth:hover .svg-tooth-face,
.svg-tooth:hover .svg-root-shape {
    stroke: #7fa48f;
}
.svg-tooth.is-multi-selected .svg-tooth-face,
.svg-tooth.is-multi-selected .svg-root-shape {
    stroke: #116149;
    stroke-width: 1.8;
    filter: drop-shadow(0 0 0.2rem rgba(17, 97, 73, 0.18));
}
.svg-tooth-face.is-selected,
.svg-root-hit.is-selected,
.svg-root-shape.is-selected,
.svg-tooth-face:hover,
.svg-root-shape:hover {
    stroke: #3778c2;
}
.svg-tooth-face.is-selected,
.svg-tooth-face:hover {
    filter: drop-shadow(0 0 0.2rem rgba(55, 120, 194, 0.15));
}
.svg-root-hit:hover {
    cursor: pointer;
}
.svg-marker circle {
    stroke: rgba(23, 50, 38, 0.12);
}
.svg-marker text {
    font-size: 5.5px;
    font-weight: 800;
    fill: currentColor;
    text-anchor: middle;
}
.svg-marker circle {
    filter: drop-shadow(0 0 0.15rem rgba(17, 97, 73, 0.12));
}
.svg-marker.tone-info { color: #215f9d; }
.svg-marker.tone-success { color: #1c8b54; }
.svg-marker.tone-warning { color: #a46c08; }
.svg-marker.tone-danger { color: #b53f35; }
.svg-marker.tone-violet { color: #7243c5; }
.svg-marker.tone-neutral { color: #647180; }
.svg-marker.tone-emerald { color: #0f8b67; }
.svg-marker.tone-sky { color: #1171b0; }
.svg-marker.tone-approved { color: #116149; }
.svg-marker.tone-done { color: #0c4c38; }
.svg-marker.tone-muted { color: #8a949f; }
.svg-marker.tone-info circle { fill: #dcecff; }
.svg-marker.tone-success circle { fill: #dff6e9; }
.svg-marker.tone-warning circle { fill: #fff2d7; }
.svg-marker.tone-danger circle { fill: #fde2df; }
.svg-marker.tone-violet circle { fill: #ece3fb; }
.svg-marker.tone-neutral circle { fill: #eef1f4; }
.svg-marker.tone-emerald circle { fill: #dcfaf0; }
.svg-marker.tone-sky circle { fill: #dff4ff; }
.svg-marker.tone-approved circle { fill: #d7efe3; }
.svg-marker.tone-done circle { fill: #cfe6dd; }
.svg-marker.tone-muted circle { fill: #f0f2f4; }
.svg-tooth-face.state-info,
.svg-root-shape.state-info { fill: #dcecff; stroke: #3778c2; }
.svg-tooth-face.state-success,
.svg-root-shape.state-success { fill: #dff6e9; stroke: #1c8b54; }
.svg-tooth-face.state-warning,
.svg-root-shape.state-warning { fill: #fff2d7; stroke: #c98c16; }
.svg-tooth-face.state-danger,
.svg-root-shape.state-danger { fill: #fde2df; stroke: #d14f45; }
.svg-tooth-face.state-violet,
.svg-root-shape.state-violet { fill: #ece3fb; stroke: #7f58c9; }
.svg-tooth-face.state-neutral,
.svg-root-shape.state-neutral { fill: #eef1f4; stroke: #7d8894; }
.svg-tooth-face.state-emerald,
.svg-root-shape.state-emerald { fill: #dcfaf0; stroke: #0f9b73; }
.svg-tooth-face.state-sky,
.svg-root-shape.state-sky { fill: #dff4ff; stroke: #1182c8; }
.svg-tooth-face.state-approved,
.svg-root-shape.state-approved { fill: #dff6e9; stroke: #0f9b73; }
.svg-tooth-face.state-done,
.svg-root-shape.state-done { fill: #d7ede4; stroke: #116149; }
.svg-tooth-face.state-muted,
.svg-root-shape.state-muted { fill: #f0f2f4; stroke: #a2abb5; }
.tooth-interactive {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    padding: 10px;
    display: grid;
    gap: 8px;
    justify-items: center;
}
.tooth-interactive.active {
    border-color: rgba(17, 97, 73, 0.35);
    background: #eef7f1;
}
.tooth-interactive.is-multi-selected {
    border-color: #116149;
    box-shadow: 0 0 0 3px rgba(17, 97, 73, 0.12);
}
.tooth-figure {
    width: 54px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 12px 14px 14px 12px 18px;
    gap: 2px;
    justify-items: center;
}
.tooth-part,
.tooth-root {
    border: 1px solid #bfcabc;
    background: #fff;
    cursor: pointer;
    padding: 0;
}
.tooth-part:hover,
.tooth-root:hover,
.tooth-part.is-selected,
.tooth-root.is-selected {
    background: #dcecff;
    border-color: #3778c2;
}
.tooth-part.state-info,
.tooth-root.state-info {
    background: #dcecff;
    border-color: #3778c2;
}
.tooth-part.state-success,
.tooth-root.state-success {
    background: #dff6e9;
    border-color: #1c8b54;
}
.tooth-part.state-warning,
.tooth-root.state-warning {
    background: #fff2d7;
    border-color: #c98c16;
}
.tooth-part.state-danger,
.tooth-root.state-danger {
    background: #fde2df;
    border-color: #d14f45;
}
.tooth-part.state-violet,
.tooth-root.state-violet {
    background: #ece3fb;
    border-color: #7f58c9;
}
.tooth-part.state-neutral,
.tooth-root.state-neutral {
    background: #eef1f4;
    border-color: #7d8894;
}
.tooth-part.state-emerald,
.tooth-root.state-emerald {
    background: #dcfaf0;
    border-color: #0f9b73;
}
.tooth-part.state-sky,
.tooth-root.state-sky {
    background: #dff4ff;
    border-color: #1182c8;
}
.tooth-part.state-approved,
.tooth-root.state-approved {
    background: #dff6e9;
    border-color: #0f9b73;
    box-shadow: inset 0 0 0 1px rgba(15, 155, 115, 0.2);
}
.tooth-part.state-done,
.tooth-root.state-done {
    background: #d7ede4;
    border-color: #116149;
}
.tooth-part.state-muted,
.tooth-root.state-muted {
    background: #f0f2f4;
    border-color: #a2abb5;
    opacity: 0.8;
}
.tooth-part.top {
    grid-column: 2;
    grid-row: 1;
    width: 18px;
    border-radius: 6px 6px 3px 3px;
}
.tooth-part.left {
    grid-column: 1;
    grid-row: 2 / span 2;
    width: 14px;
    height: 30px;
    border-radius: 8px 3px 3px 8px;
}
.tooth-part.center {
    grid-column: 2;
    grid-row: 2 / span 2;
    width: 18px;
    height: 30px;
    border-radius: 4px;
}
.tooth-part.right {
    grid-column: 3;
    grid-row: 2 / span 2;
    width: 14px;
    height: 30px;
    border-radius: 3px 8px 8px 3px;
}
.tooth-part.bottom {
    grid-column: 2;
    grid-row: 4;
    width: 18px;
    border-radius: 3px 3px 6px 6px;
}
.tooth-root {
    grid-column: 2;
    grid-row: 5;
    width: 14px;
    height: 18px;
    border-radius: 0 0 8px 8px;
}
.tooth-markers {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.tooth-marker {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 800;
    border: 1px solid transparent;
}
.tooth-marker.tone-info { background: #dcecff; color: #215f9d; }
.tooth-marker.tone-success { background: #dff6e9; color: #1c8b54; }
.tooth-marker.tone-warning { background: #fff2d7; color: #a46c08; }
.tooth-marker.tone-danger { background: #fde2df; color: #b53f35; }
.tooth-marker.tone-violet { background: #ece3fb; color: #7243c5; }
.tooth-marker.tone-neutral { background: #eef1f4; color: #647180; }
.tooth-marker.tone-emerald { background: #dcfaf0; color: #0f8b67; }
.tooth-marker.tone-sky { background: #dff4ff; color: #1171b0; }
.tooth-marker.tone-approved { background: #d7efe3; color: #116149; }
.tooth-marker.tone-done { background: #cfe6dd; color: #0c4c38; }
.tooth-marker.tone-muted { background: #f0f2f4; color: #8a949f; }
.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.inline-form {
    display: inline;
}
.compact-space {
    margin-top: 18px;
}
.budget-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    padding: 16px;
    margin-bottom: 14px;
}
.budget-card.status-aprovado {
    background: #e8f5ee;
}
.budget-card.status-parcial {
    background: #fff4d8;
}
.mini-budget-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .9rem; font-weight: 700; background: #f6f8f2; position: sticky; top: 0; z-index: 1; }
tbody tr:nth-child(even) td { background: rgba(246, 248, 242, 0.55); }
tbody tr:hover td { background: rgba(223, 232, 216, 0.3); }
.actions { display: flex; gap: 10px; align-items: center; min-width: 170px; }
.actions form { margin: 0; }

.form-grid, .auth-form { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field span { font-weight: 600; }
.context-note {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f3f7ef;
    border: 1px solid var(--line);
    color: var(--primary-strong);
}
input, select, textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
    font: inherit; color: var(--text); background: #fff;
}
input::placeholder, textarea::placeholder { color: #8b9992; }
input:hover, select:hover, textarea:hover { border-color: rgba(17, 97, 73, 0.24); }
textarea { resize: vertical; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-actions.full { grid-column: 1 / -1; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 520px); padding: 30px; }
.auth-card.wide { width: min(100%, 760px); }
.search-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-form input[type="search"] { min-width: 220px; }
.checkbox-field span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
}
.check-list-grid {
    display: grid;
    gap: 10px;
}
.check-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.check-card span {
    display: grid;
    gap: 4px;
}
.check-card small {
    color: var(--muted);
}
.check-card:hover {
    border-color: rgba(17, 97, 73, 0.26);
    background: #fbfcf8;
}
.prosthetic-layout {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    align-items: start;
}
.prosthetic-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(220px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 6px;
}
.prosthetic-column {
    min-width: 220px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    display: grid;
    grid-template-rows: auto 1fr;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.prosthetic-column.is-drop-target {
    border-color: rgba(17, 97, 73, 0.45);
    box-shadow: 0 0 0 3px rgba(17, 97, 73, 0.10);
    background: #f5faf6;
}
.prosthetic-column-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #f3f7ef;
    border-radius: 18px 18px 0 0;
}
.prosthetic-column-head span {
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #dff0e7;
    color: var(--primary-strong);
    font-weight: 700;
}
.prosthetic-column-body {
    padding: 12px;
    display: grid;
    gap: 12px;
    align-content: start;
}
.prosthetic-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 10px 20px rgba(16, 33, 24, 0.05);
    cursor: grab;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.prosthetic-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(16, 33, 24, 0.08);
}
.prosthetic-card.is-dragging {
    opacity: 0.55;
    transform: rotate(1deg) scale(0.99);
    cursor: grabbing;
}
.prosthetic-card.priority-alta { border-color: #e3b6b1; background: #fff7f5; }
.prosthetic-card.priority-baixa { border-color: #d7e3db; }
.prosthetic-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 8px;
}
.prosthetic-card p {
    margin: 0 0 8px;
}
.prosthetic-card-values {
    display: grid;
    gap: 4px;
    font-size: .92rem;
    color: var(--primary-strong);
    margin: 10px 0;
}
.prosthetic-move-form {
    margin-top: 10px;
}
.confirmation-panel { margin-bottom: 22px; }
.confirmation-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    align-items: start;
}
.confirmation-side-stack,
.confirmation-main-stack {
    display: grid;
    gap: 16px;
    align-content: start;
}
.confirmation-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.confirmation-column {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: #fbfcf8;
    display: grid;
    gap: 12px;
    align-content: start;
}
.confirmation-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.confirmation-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: #fff;
    display: grid;
    gap: 8px;
}
.confirmation-card p { margin: 0; color: var(--muted); }
.confirmation-config-card { margin-bottom: 0; }
.confirmation-meta {
    margin-top: 14px;
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: .92rem;
}
.confirmation-meta p {
    margin: 0;
}
.confirmation-mini-list,
.confirmation-log-list {
    display: grid;
    gap: 10px;
}
.confirmation-mini-item,
.confirmation-log-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 12px 14px;
    display: grid;
    gap: 6px;
}
.confirmation-mini-item span,
.confirmation-log-item p {
    margin: 0;
    color: var(--muted);
}
.confirmation-log-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: .9rem;
}
.confirmation-log-text {
    white-space: pre-wrap;
}
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef5ed;
    color: var(--primary-strong);
    font-size: .85rem;
    font-weight: 700;
}
.badge.danger {
    background: #ffe4df;
    color: #b2402b;
}
.pill.danger-soft {
    background: #fff0ec;
    color: #a64a32;
}
.reminder-trigger {
    gap: 8px;
}
.reminder-alert-strip {
    padding: 18px 22px;
}
.reminder-alert-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.reminder-alert-list,
.reminder-board {
    display: grid;
    gap: 14px;
}
.reminder-alert-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.reminder-alert-card,
.reminder-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcf8;
    padding: 14px 16px;
}
.reminder-alert-card strong,
.reminder-card strong {
    display: block;
    margin-bottom: 6px;
}
.reminder-alert-card span,
.reminder-card p {
    color: var(--muted);
}
.reminder-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.reminder-card.priority-urgente { border-color: rgba(178, 64, 43, 0.45); background: #fff8f6; }
.reminder-card.priority-alta { border-color: rgba(214, 140, 50, 0.45); background: #fffaf3; }
.reminder-card.priority-media { border-color: rgba(36, 106, 158, 0.22); }
.reminder-card.priority-baixa { border-color: rgba(17, 97, 73, 0.18); }
.badge.enviada {
    background: #eef5ed;
}
.badge.recebida {
    background: #edf3fb;
    color: #215d99;
}
.confirmation-log-card {
    margin-bottom: 0;
}
.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.media-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 14px;
    display: grid;
    gap: 10px;
    align-content: start;
}
.media-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.media-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}
.media-file-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    border: 1px dashed var(--line);
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-strong);
    background: #f7faf6;
}
.document-preview {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfcf8;
    padding: 18px;
    line-height: 1.7;
    white-space: normal;
}
.report-export-links {
    margin: 12px 0 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.empty-state {
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    color: var(--muted);
    background: rgba(243, 247, 239, 0.45);
}
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1100px) {
    .app-shell, .split { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 20px 18px;
    }
    .nav {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 4px;
        scroll-snap-type: x proximity;
    }
    .nav-section-label {
        display: none;
    }
    .nav-link {
        white-space: nowrap;
        min-width: max-content;
        scroll-snap-align: start;
    }
    .topbar,
    .context-subnav {
        position: static;
    }
    .confirmation-layout,
    .confirmation-columns { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .content { padding: 18px; }
    .topbar, .panel, .auth-card { padding: 18px; }
    .topbar, .panel-head { flex-direction: column; }
    .topbar-actions { width: 100%; justify-content: stretch; }
    .topbar-actions > * { width: 100%; }
    .inline-form,
    .inline-form select { width: 100%; min-width: 0; }
    .form-grid-2,
    .grid-two,
    .patient-registration-layout,
    .patient-form-grid,
    .patient-inline-form { grid-template-columns: 1fr; }
    .odontogram-workspace { grid-template-columns: 1fr; }
    .toolbar-grid,
    .calendar-grid,
    .calendar-layout { grid-template-columns: 1fr; }
    .agenda-board { grid-template-columns: 1fr; }
    .google-calendar-head,
    .google-calendar-body { grid-template-columns: 58px 1fr; }
    .google-event-card {
        padding: 6px 7px;
    }
    .timeline-item { grid-template-columns: 1fr; }
    .context-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .context-tab {
        white-space: nowrap;
    }
    .module-footer,
    .media-card-actions,
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .table-wrap {
        border-radius: 16px;
        border: 1px solid var(--line);
        background: #fff;
    }
}
