:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --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(37, 99, 235, 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(37, 99, 235, 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(37, 99, 235, 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: #2563eb;
}

.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: #2563eb;
}

.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: #2563eb;
}

.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: #2563eb;
}

.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(37, 99, 235, 0.18);
}

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

.color-option.blue {
    background: #2563eb;
}

.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, #2563eb, #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;
    }
}

/* ==========================================================
   IA CLÍNICA
========================================================== */

.ia-database-response {
    min-height: 360px;
    white-space: pre-wrap;
    line-height: 1.75;

    background: var(--surface-soft);

    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 20px;

    color: var(--text);
}

.ia-question-box {
    background: var(--primary-light);

    border: 1px solid var(--border);
    border-radius: 14px;

    padding: 14px 16px;
}

@media (max-width: 768px) {

    .ia-database-response {
        min-height: 250px;
    }

}