:root {
    --primary: #0f766e;
    --primary-light: #ecfdf5;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e5e7eb;
    --shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
    --radius: 18px;
    --sidebar-width: 270px;
    --sidebar-collapsed: 86px;
}

html[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #111827;
    --surface-soft: #1e293b;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #334155;
    --primary-light: rgba(15, 118, 110, 0.18);
    --shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    transition: 0.25s ease;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    margin-bottom: 36px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.brand-text {
    font-size: 23px;
    font-weight: 800;
    white-space: nowrap;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu a {
    text-decoration: none;
    color: var(--muted);
    padding: 13px 14px;
    border-radius: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s ease;
    white-space: nowrap;
}

.sidebar-menu a i {
    font-size: 20px;
    min-width: 22px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: 0.25s ease;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .sidebar-menu a span {
    display: none;
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

.topbar {
    height: 84px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-content {
    padding: 32px;
}

.card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    min-height: 175px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.modern-card {
    min-height: 320px;
}

.empty-state {
    margin-top: 24px;
    padding: 50px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 18px;
    color: var(--muted);
}

.empty-state i {
    font-size: 44px;
    margin-bottom: 12px;
    display: block;
}

.btn {
    border-radius: 12px;
    font-weight: 500;
}

.btn-light {
    background: var(--surface-soft);
    border-color: var(--border);
    color: var(--text);
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    padding: 7px 12px 7px 7px;
    border-radius: 999px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.user-info small {
    color: var(--muted);
}

.form-control,
.form-select {
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    min-height: 44px;
    border-color: var(--border);
}

.form-control:focus,
.form-select:focus {
    background: var(--surface);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.table {
    color: var(--text);
    margin-bottom: 0;
}

.table thead th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table tbody td {
    padding: 16px 8px;
    border-bottom: 1px solid var(--border);
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.badge {
    border-radius: 999px;
    padding: 7px 10px;
}

/* Login */

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 35%),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.14), transparent 35%),
        var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 26px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.login-logo {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
}

/* Prontuário */

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 30px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 900;
}

.patient-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    margin-top: 24px;
}

.patient-info div {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
}

.patient-info span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.patient-info strong {
    display: block;
    margin-top: 2px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.summary-grid div {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.summary-grid strong {
    display: block;
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
}

.summary-grid span {
    color: var(--muted);
    font-size: 13px;
}

.clinical-editor {
    min-height: 180px;
}

.clinical-text {
    white-space: pre-line;
}

.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    display: flex;
    gap: 18px;
    position: relative;
}

.timeline-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex: 0 0 auto;
    z-index: 2;
}

.timeline-content {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    width: 100%;
}

/* Odontograma */

.odontograma-wrapper {
    overflow-x: auto;
    padding-bottom: 8px;
}

.odontograma-grid {
    display: grid;
    grid-template-columns: repeat(8, 92px);
    gap: 14px;
    align-items: center;
    justify-content: start;
}

.tooth-card {
    width: 92px;
    min-height: 122px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    text-align: center;
}

.tooth-number {
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.tooth-svg {
    width: 70px;
    height: 70px;
    display: block;
    margin: 0 auto;
    overflow: visible;
}

.face {
    stroke: #94a3b8;
    stroke-width: 2;
    cursor: pointer;
    transition: 0.18s ease;
}

.face:hover {
    opacity: 0.8;
    filter: brightness(0.95);
}

.face-empty {
    fill: #ffffff;
}

html[data-theme="dark"] .face-empty {
    fill: #0f172a;
}

.face-primary {
    fill: #0f766e;
}

.face-danger {
    fill: #dc2626;
}

.face-success {
    fill: #16a34a;
}

.face-warning {
    fill: #facc15;
}

.face-dark {
    fill: #111827;
}

.odontograma-history {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
}

@media (max-width: 1200px) {
    .odontograma-grid {
        grid-template-columns: repeat(4, 92px);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar-collapsed .sidebar {
        transform: translateX(0);
        width: var(--sidebar-width);
    }

    .sidebar-collapsed .brand-text,
    .sidebar-collapsed .sidebar-menu a span {
        display: inline;
    }

    .main-content,
    .sidebar-collapsed .main-content {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        padding: 16px;
    }

    .page-content {
        padding: 16px;
    }

    .user-info {
        display: none;
    }

    .odontograma-grid {
        grid-template-columns: repeat(3, 92px);
    }
}

.odontograma-profissional {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 28px;
    overflow-x: auto;
}

html[data-theme="dark"] .odontograma-profissional {
    background: var(--surface);
}

.arcada {
    display: grid;
    grid-template-columns: repeat(16, 64px);
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
    min-width: 1100px;
}

.dente-pro-card {
    text-align: center;
    padding: 4px;
}

.tooth-check {
    width: 15px;
    height: 15px;
    border-radius: 5px;
    accent-color: var(--primary);
    margin-bottom: 6px;
}

.tooth-number-top {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 6px;
}

.tooth-image {
    font-size: 34px;
    line-height: 1;
    margin-bottom: 8px;
    filter: grayscale(0.1);
}

.tooth-superior {
    transform: rotate(180deg);
}

.tooth-inferior {
    transform: rotate(0deg);
}

.tooth-faces {
    width: 38px;
    height: 38px;
    display: block;
    margin: 0 auto;
}

.face {
    stroke: #94a3b8;
    stroke-width: 2;
    cursor: pointer;
    transition: 0.18s ease;
}

.face:hover {
    opacity: 0.75;
}

.face-empty {
    fill: #ffffff;
}

html[data-theme="dark"] .face-empty {
    fill: #1e293b;
}

.face-primary {
    fill: #0f766e;
}

.face-danger {
    fill: #dc2626;
}

.face-success {
    fill: #16a34a;
}

.face-warning {
    fill: #facc15;
}

.face-dark {
    fill: #111827;
}

.odontograma-page {
    max-width: 100%;
}

.odonto-card {
    border-radius: 22px;
    border: 1px solid var(--border);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

.arcada-pro {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 12px;
    min-width: 920px;
    overflow-x: auto;
}

.dente-pro-card {
    text-align: center;
    min-width: 48px;
}

.tooth-check {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    margin-bottom: 7px;
}

.tooth-number {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}

.tooth-drawing {
    width: 38px;
    height: 50px;
    margin: 0 auto 10px;
    position: relative;
}

.tooth-drawing.superior {
    transform: rotate(180deg);
}

.root {
    position: absolute;
    width: 13px;
    height: 34px;
    background: linear-gradient(180deg, #ffffff, #e5e7eb);
    border: 2px solid #9ca3af;
    top: 14px;
    border-radius: 50% 50% 45% 45%;
}

.root-left {
    left: 6px;
    transform: rotate(-9deg);
}

.root-right {
    right: 6px;
    transform: rotate(9deg);
}

.crown {
    position: absolute;
    width: 32px;
    height: 24px;
    left: 3px;
    top: 0;
    background: linear-gradient(180deg, #ffffff, #eef2f7);
    border: 2px solid #9ca3af;
    border-radius: 45% 45% 40% 40%;
    z-index: 2;
}

.gum {
    position: absolute;
    width: 34px;
    height: 10px;
    left: 2px;
    top: 18px;
    background: linear-gradient(180deg, #fbbf24, #fb923c);
    border-radius: 50%;
    z-index: 3;
    opacity: 0.9;
}

.tooth-faces {
    width: 28px;
    height: 28px;
    display: block;
    margin: 0 auto;
}

.face {
    stroke: #94a3b8;
    stroke-width: 2.2;
    cursor: pointer;
    transition: 0.18s ease;
}

.face:hover {
    filter: brightness(0.92);
    stroke: var(--primary);
    stroke-width: 4;
}

.face-empty {
    fill: #ffffff;
}

html[data-theme="dark"] .face-empty {
    fill: #1e293b;
}

.face-primary {
    fill: #0f766e;
}

.face-danger {
    fill: #ef4444;
}

.face-success {
    fill: #16a34a;
}

.face-warning {
    fill: #f59e0b;
}

.face-dark {
    fill: #111827;
}

.face-secondary {
    fill: #64748b;
}

.odonto-legenda {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--muted);
}

.odonto-legenda span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}

.dot.red {
    background: #ef4444;
}

.dot.blue {
    background: #0f766e;
}

.dot.green {
    background: #16a34a;
}

.dot.black {
    background: #111827;
}

.dot.yellow {
    background: #f59e0b;
}

.dot.gray {
    background: #64748b;
}

.sticky-panel {
    position: sticky;
    top: 104px;
}

.selected-box {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    border-radius: 14px;
    padding: 14px;
}

.selected-box span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.selected-box strong {
    font-size: 18px;
}

.face-preview {
    display: flex;
    justify-content: center;
}

.face-preview svg {
    width: 250px;
    height: 250px;
    filter: drop-shadow(0 12px 22px rgba(15, 23, 42, 0.16));
}

.face-preview polygon,
.face-preview rect {
    fill: #ffffff;
    stroke: #111827;
    stroke-width: 2;
}

.color-palette {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.color-option {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15);
}

.color-option i {
    display: none;
    font-size: 20px;
}

.color-option.active {
    outline: 4px solid rgba(15, 118, 110, 0.18);
}

.color-option.active i {
    display: block;
}

.color-option.blue {
    background: #0f766e;
}

.color-option.red {
    background: #ef4444;
}

.color-option.green {
    background: #16a34a;
}

.color-option.yellow {
    background: #f59e0b;
}

.color-option.black {
    background: #111827;
}

.color-option.gray {
    background: #64748b;
}

.history-pro {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.history-pro:last-child {
    border-bottom: 0;
}

.history-color {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex: 0 0 auto;
}

.history-info {
    flex: 1;
}

.history-info p {
    color: var(--muted);
    margin: 6px 0 0;
}

@media (max-width: 1200px) {
    .arcada-pro {
        grid-template-columns: repeat(16, 54px);
        overflow-x: auto;
    }

    .face-preview svg {
        width: 210px;
        height: 210px;
    }
}

.config-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 24px;
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: 0.2s ease;
}

.config-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    color: var(--text);
}

.config-card i {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.config-card strong {
    font-size: 18px;
}

.config-card span {
    color: var(--muted);
    font-size: 14px;
}

.agenda-card {
    border-radius: 24px;
}

#calendar {
    background: var(--surface);
    border-radius: 22px;
    padding: 8px;
}

.fc {
    color: var(--text);
    font-family: inherit;
}

.fc .fc-toolbar-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

.fc .fc-button {
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    background: var(--surface-soft) !important;
    color: var(--text) !important;
    box-shadow: none !important;
    font-weight: 600 !important;
    padding: 8px 14px !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

.fc .fc-today-button {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
    border-color: var(--border) !important;
}

.fc .fc-col-header-cell-cushion {
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
    padding: 12px;
}

.fc .fc-timegrid-slot-label {
    color: var(--muted);
    font-size: 12px;
}

.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
    color: var(--text);
    text-decoration: none;
}

.fc .fc-timegrid-now-indicator-line {
    border-color: var(--primary);
}

.fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--primary);
}

.fc-event {
    border: none !important;
    border-radius: 12px !important;
    padding: 4px !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.evento-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    line-height: 1.2;
}

.evento-card strong {
    font-size: 12px;
    color: #ffffff;
}

.evento-card span {
    font-size: 11px;
    color: rgba(255,255,255,0.95);
}

.evento-card small {
    font-size: 10px;
    color: rgba(255,255,255,0.8);
}

.evento-agendado {
    background: linear-gradient(135deg, #0f766e, #1d4ed8) !important;
}

.evento-confirmado {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
}

.evento-cancelado {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

.evento-concluido {
    background: linear-gradient(135deg, #64748b, #334155) !important;
}

.fc .fc-list-event:hover td {
    background: var(--surface-soft) !important;
}

.fc .fc-list-event-title a,
.fc .fc-list-event-time {
    color: var(--text) !important;
}

@media (max-width: 900px) {
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 12px;
    }

    .fc .fc-toolbar-title {
        font-size: 20px;
    }
}

.anamnese-box {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    height: 100%;
}

.option-card {
    display: block;
    cursor: pointer;
}

.option-card input {
    display: none;
}

.option-card span {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    color: var(--muted);
    font-weight: 600;
    transition: 0.2s ease;
}

.option-card input:checked + span {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.option-card i {
    font-size: 18px;
}

.doc-shortcut {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: 0.2s ease;
}

.doc-shortcut:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    color: var(--text);
}

.doc-shortcut i {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.documento-editor {
    min-height: 360px;
    line-height: 1.7;
}

.documento-print {
    max-width: 900px;
    margin: 0 auto;
    min-height: 1120px;
}

.documento-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.documento-logo {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.documento-paciente {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
}

.documento-conteudo {
    white-space: pre-line;
    font-size: 17px;
    line-height: 1.9;
    min-height: 420px;
}

.documento-assinatura {
    margin-top: 90px;
    text-align: center;
}

.linha-assinatura {
    width: 320px;
    border-top: 1px solid var(--text);
    margin: 0 auto 12px;
}

.documento-assinatura span {
    display: block;
    color: var(--muted);
    font-size: 14px;
}

@media print {
    .sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .page-content {
        padding: 0 !important;
    }

    body {
        background: #ffffff !important;
    }

    .documento-print {
        box-shadow: none !important;
        border: none !important;
        min-height: auto;
    }
}

.arquivo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.arquivo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.arquivo-preview {
    height: 190px;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.arquivo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.arquivo-icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
}

.arquivo-icon.pdf {
    background: #fee2e2;
    color: #dc2626;
}

.arquivo-body {
    padding: 18px;
}

@media (max-width: 1200px) {
    .arquivo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .arquivo-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

.dre-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dre-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
}

.dre-item span {
    color: var(--muted);
    font-weight: 600;
}

.dre-item strong {
    font-size: 18px;
}

.dre-item.total {
    background: var(--primary-light);
    border-color: var(--primary);
}

.dre-item.total span,
.dre-item.total strong {
    font-size: 20px;
    font-weight: 900;
}

.dre-item.muted {
    opacity: 0.8;
}

.indicator-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
}

.indicator-box span {
    color: var(--muted);
    font-weight: 600;
}

.indicator-box strong {
    font-size: 22px;
}

.mobile-backdrop {
    display: none;
}

@media (max-width: 900px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: 0.25s ease;
        z-index: 1000;
    }

    .app-wrapper.sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .mobile-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 900;
    }

    .app-wrapper.sidebar-mobile-open .mobile-backdrop {
        display: block;
    }
}

.crm-period-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px;
    min-height: 150px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: 0.2s ease;
}

.crm-period-card:hover,
.crm-period-card.active {
    transform: translateY(-3px);
    border-color: var(--primary);
    color: var(--text);
}

.crm-period-card i {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.crm-period-card strong {
    font-size: 22px;
}

.crm-period-card span {
    color: var(--muted);
    font-size: 14px;
}


.ia-result-card {
    min-height: 100%;
}

.ia-result {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    min-height: 430px;
    white-space: pre-wrap;
    font-family: inherit;
    color: var(--text);
    line-height: 1.7;
}

.campaign-preview {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
}

.campaign-preview pre {
    white-space: pre-wrap;
    font-family: inherit;
    color: var(--text);
    line-height: 1.7;
}

.integration-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.integration-status div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}

.integration-status span {
    color: var(--muted);
    font-weight: 600;
}

.treatment-card {
    min-height: 260px;
}

.treatment-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.treatment-summary div,
.payment-box,
.treatment-total {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
}

.treatment-summary span,
.payment-box span,
.treatment-total span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.treatment-summary strong,
.payment-box strong {
    font-size: 18px;
}

.treatment-total strong {
    font-size: 30px;
    font-weight: 900;
    color: var(--primary);
}

@media print {
    .sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .page-content {
        padding: 0 !important;
    }

    body {
        background: #fff !important;
    }

    .card {
        box-shadow: none !important;
        border: none !important;
    }
}

/* VETPRO */
.brand > div:last-child { display:flex; flex-direction:column; line-height:1.05; }
.brand-subtitle { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.08em; margin-top:4px; }
.sidebar-collapsed .brand-subtitle { display:none; }
.section-title { font-size:14px; text-transform:uppercase; letter-spacing:.08em; font-weight:800; color:var(--primary); border-bottom:1px solid var(--border); padding-bottom:10px; }
.badge-soft { background:var(--primary-light); color:var(--primary); border:1px solid rgba(15,118,110,.12); }
.animal-icon { width:58px; height:58px; border-radius:18px; background:var(--primary-light); color:var(--primary); display:flex; align-items:center; justify-content:center; font-size:25px; flex:0 0 auto; }
.info-box { background:var(--surface-soft); border:1px solid var(--border); border-radius:14px; padding:12px; display:flex; flex-direction:column; gap:3px; height:100%; }
.info-box span { color:var(--muted); font-size:12px; }
.info-box strong { font-size:14px; }
.timeline-item { position:relative; padding:10px 0 20px 28px; border-left:2px solid var(--border); margin-left:8px; }
.timeline-dot { position:absolute; width:13px; height:13px; background:var(--primary); border-radius:50%; left:-7.5px; top:15px; box-shadow:0 0 0 4px var(--primary-light); }
.timeline-content { background:var(--surface-soft); border:1px solid var(--border); border-radius:14px; padding:14px; }
.vaccine-item { display:flex; flex-direction:column; padding:12px 0; border-bottom:1px solid var(--border); }
.vaccine-item:last-child { border-bottom:0; }
.vaccine-item small { color:var(--muted); }
.empty-state.compact { padding:25px 12px; }
.empty-state.compact i { font-size:30px; }
.clinical-dl dt { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.05em; margin-top:18px; }
.clinical-dl dd { margin:5px 0 0; white-space:pre-line; }
.info-list { display:flex; flex-direction:column; }
.info-list > div { display:flex; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--border); }
.info-list span { color:var(--muted); }
.pre-line { white-space:pre-line; }
.dropdown-menu { background:var(--surface); border-color:var(--border); }
.dropdown-item { color:var(--text); border-radius:8px; }
.dropdown-item:hover { background:var(--surface-soft); color:var(--primary); }

@media (max-width: 600px) {
  .user-info { display:none; }
  .page-content { padding:18px 14px; }
  .topbar { padding:14px; }
}
.sidebar-section-label{padding:18px 18px 6px;font-size:.68rem;font-weight:800;letter-spacing:.08em;color:var(--text-muted,#94a3b8)}
.clinical-action-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:.75rem}.clinical-action-grid .btn{padding:.85rem;text-align:left}.clinical-action-grid i{font-size:1.1rem;margin-right:.35rem}

.sidebar { overflow-y: auto; }
.sidebar-section-label{font-size:10px;font-weight:800;letter-spacing:.08em;color:var(--muted);padding:12px 14px 3px;}
.stat-card-mini{min-height:110px;}

/* VETPRO v0.5.0 - identidade da clínica */
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 46px;
    padding: 4px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
}
.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.brand-copy {
    min-width: 0;
}
.brand-copy .brand-text {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.login-clinic-logo {
    width: 130px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
}
.login-clinic-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.clinic-logo-preview {
    min-height: 190px;
    border: 1px dashed var(--bs-border-color);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, .06);
    padding: 20px;
}
.clinic-logo-preview img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
}
.clinic-logo-placeholder {
    color: #94a3b8;
    text-align: center;
}
.clinic-logo-placeholder i {
    display: block;
    font-size: 3rem;
    margin-bottom: .5rem;
}

/* =========================================================
   VETPRO v0.5.1 - MENU LATERAL COMPACTO
   Mantém todos os módulos visíveis em telas desktop comuns.
   ========================================================= */

.sidebar {
    padding: 12px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.brand {
    gap: 10px;
    margin-bottom: 12px;
    min-height: 42px;
}

.brand-logo,
.brand-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
}

.brand-icon {
    font-size: 19px;
}

.brand-text {
    font-size: 19px;
    line-height: 1.05;
}

.brand-subtitle {
    font-size: 10px;
    line-height: 1.1;
}

.sidebar-menu {
    gap: 2px;
}

.sidebar-menu a {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 10px;
    gap: 9px;
    font-size: 14px;
    line-height: 1.15;
}

.sidebar-menu a i {
    font-size: 17px;
    min-width: 19px;
}

.sidebar-section-label {
    padding: 7px 10px 2px;
    margin: 1px 0 0;
    font-size: 9px;
    line-height: 1.1;
    letter-spacing: .07em;
}

/* Barra de rolagem discreta, usada apenas quando necessário */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

/* Em notebooks com pouca altura, compacta um pouco mais */
@media (min-width: 769px) and (max-height: 780px) {
    .sidebar {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .brand {
        margin-bottom: 7px;
    }

    .sidebar-menu {
        gap: 0;
    }

    .sidebar-menu a {
        min-height: 30px;
        padding: 4px 9px;
        font-size: 13px;
    }

    .sidebar-menu a i {
        font-size: 16px;
    }

    .sidebar-section-label {
        padding-top: 5px;
        padding-bottom: 1px;
        font-size: 8px;
    }
}

/* ================================================================
   VETPRO v0.5.2 - Agenda / Status
   Evita dropdown cortado dentro de .table-responsive e deixa a troca
   de status explícita na própria linha da consulta.
   ================================================================ */
.agenda-table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

.agenda-table {
    min-width: 980px;
}

.agenda-actions-cell {
    min-width: 280px;
    white-space: nowrap;
}

.agenda-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .45rem;
}

.agenda-status-form {
    display: inline-flex;
    margin: 0;
}

.agenda-status-select {
    width: 142px;
    min-width: 142px;
    cursor: pointer;
    border-radius: 9px;
    font-size: .78rem;
    padding-top: .28rem;
    padding-bottom: .28rem;
}

.agenda-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: .28rem .58rem;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}

.agenda-status-badge.status-agendada {
    background: rgba(59, 130, 246, .10);
    color: #2563eb;
    border-color: rgba(59, 130, 246, .18);
}

.agenda-status-badge.status-confirmada {
    background: rgba(16, 185, 129, .10);
    color: #047857;
    border-color: rgba(16, 185, 129, .18);
}

.agenda-status-badge.status-em-atendimento {
    background: rgba(245, 158, 11, .12);
    color: #b45309;
    border-color: rgba(245, 158, 11, .20);
}

.agenda-status-badge.status-concluida {
    background: rgba(6, 182, 212, .10);
    color: #0e7490;
    border-color: rgba(6, 182, 212, .20);
}

.agenda-status-badge.status-cancelada,
.agenda-status-badge.status-faltou {
    background: rgba(239, 68, 68, .10);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, .18);
}

@media (max-width: 1100px) {
    .agenda-actions-cell {
        min-width: 250px;
    }

    .agenda-status-select {
        width: 132px;
        min-width: 132px;
    }
}
