* {
    box-sizing: border-box;
}

:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-light: #ccfbf1;
    --background: #f4f7f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #172033;
    --muted: #64748b;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #15803d;
    --shadow: 0 8px 25px rgba(15, 23, 42, 0.07);
    --radius: 14px;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================
   LOGIN
   ========================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #ccfbf1 0, transparent 35%),
        radial-gradient(circle at bottom right, #dbeafe 0, transparent 35%),
        #f1f5f9;
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 42px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.login-card .logo {
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: var(--primary-light);
    font-size: 34px;
}

.login-card h1 {
    margin: 0;
    text-align: center;
    font-size: 28px;
    letter-spacing: -0.5px;
}

.login-card p {
    margin: 8px 0 28px;
    text-align: center;
    color: var(--muted);
}

.login-card label {
    display: block;
    margin: 16px 0 7px;
    font-weight: 600;
    color: #334155;
}

.login-card input {
    width: 100%;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
}

/* =========================
   ESTRUTURA
   ========================= */

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

.sidebar {
    width: 250px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    background: #0f172a;
    color: #cbd5e1;
    box-shadow: 5px 0 25px rgba(15, 23, 42, 0.08);
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 8px 28px;
    color: #ffffff;
    text-decoration: none;
}

.brand:hover {
    color: #ffffff;
    text-decoration: none;
    background: transparent;
    transform: none;
}

.brand img {
    display: block;
    width: 100%;
    max-width: 215px;
    height: auto;
    object-fit: contain;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar nav a,
.logout {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 13px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    transition: 0.18s ease;
}

.sidebar nav a:hover,
.logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.logout {
    margin-top: auto;
    color: #fca5a5;
}

.main {
    width: calc(100% - 250px);
    min-height: 100vh;
    margin-left: 250px;
}

.topbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 0 34px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.topbar strong {
    font-size: 14px;
}

.topbar span {
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

/* =========================
   CONTEÚDO
   ========================= */

.main > *:not(.topbar) {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 32px 34px 22px;
}

.page-header h1 {
    margin: 0;
    font-size: 29px;
    line-height: 1.2;
    letter-spacing: -0.7px;
}

.page-header p {
    margin: 7px 0 0;
    color: var(--muted);
}

.card {
    margin: 0 34px 20px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 20px;
    font-size: 18px;
    letter-spacing: -0.2px;
}

.empty-state {
    padding: 50px 20px;
    text-align: center;
}

.empty-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: var(--primary-light);
    font-size: 30px;
}

.empty-state h2 {
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 500px;
    margin: 0 auto 22px;
    color: var(--muted);
}

/* =========================
   BOTÕES
   ========================= */

.btn,
.btn-secondary,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.btn,
button {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.btn:hover,
button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: #334155;
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.action-link {
    display: inline-block;
    margin-right: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.action-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* =========================
   FORMULÁRIOS
   ========================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group-large {
    grid-column: span 2;
}

.form-group label {
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    background: #ffffff;
    color: var(--text);
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    outline: none;
    transition: 0.18s ease;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 0 34px 30px;
}

/* =========================
   BUSCA
   ========================= */

.search-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.search-form .form-group {
    flex: 1;
}

.search-form input {
    min-height: 42px;
}

/* =========================
   TABELAS
   ========================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 13px 14px;
    background: #f8fafc;
    color: #475569;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

tbody td {
    padding: 15px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* =========================
   ALERTAS
   ========================= */

.alert {
    margin: 0 34px 20px;
    padding: 13px 16px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 600;
}

/* =========================
   DASHBOARD
   ========================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 0 34px 20px;
}

.dashboard-grid .card {
    margin: 0;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-card strong {
    font-size: 30px;
    letter-spacing: -1px;
}

/* =========================
   RESPONSIVO
   ========================= */

@media (max-width: 1000px) {
    .sidebar {
        width: 215px;
    }

    .main {
        width: calc(100% - 215px);
        margin-left: 215px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }

    .app-shell {
        display: block;
    }

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

    .sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logout {
        margin-top: 12px;
    }

    .topbar {
        justify-content: space-between;
        padding: 15px 20px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 25px 20px 18px;
    }

    .card {
        margin-left: 20px;
        margin-right: 20px;
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-full,
    .form-group-large {
        grid-column: auto;
    }

    .form-actions {
        padding-left: 20px;
        padding-right: 20px;
    }

    .search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        margin-left: 20px;
        margin-right: 20px;
    }

    .alert {
        margin-left: 20px;
        margin-right: 20px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 22px;
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 25px;
    }

    .card {
        margin-bottom: 15px;
    }
}

/* =========================================================
   INNOVA SISTEMAS — SIDEBAR MODERNA
   ========================================================= */

.sidebar .brand {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 108px !important;
    padding: 8px 8px 26px !important;
    text-decoration: none !important;
    color: inherit !important;
    background: transparent !important;
    transform: none !important;
}

.sidebar .brand img {
    display: block !important;
    width: 100% !important;
    max-width: 205px !important;
    height: auto !important;
    aspect-ratio: 1318 / 399 !important;
    object-fit: contain !important;
}

.sidebar .brand:hover {
    background: transparent !important;
    color: inherit !important;
    transform: none !important;
    text-decoration: none !important;
}

.sidebar .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    flex: 1 !important;
    overflow-y: auto !important;
}

.sidebar .sidebar-link {
    display: flex !important;
    align-items: center !important;
    gap: 13px !important;
    width: 100% !important;
    min-height: 45px !important;
    padding: 9px 12px !important;
    border-radius: 10px !important;
    color: #cbd5e1 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: background .18s ease, color .18s ease, transform .18s ease !important;
}

.sidebar .sidebar-link:hover {
    background: rgba(255,255,255,.07) !important;
    color: #ffffff !important;
    transform: translateX(2px) !important;
}

.sidebar .sidebar-link.active {
    background: rgba(20,184,166,.16) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 #2dd4bf !important;
}

.sidebar .menu-icon {
    width: 23px !important;
    height: 23px !important;
    min-width: 23px !important;
    flex: 0 0 23px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar .menu-icon svg {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.7 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

.sidebar .logout {
    margin-top: 12px !important;
    padding: 15px 12px 5px !important;
    border-top: 1px solid rgba(255,255,255,.12) !important;
    display: flex !important;
    align-items: center !important;
    gap: 13px !important;
    min-height: 52px !important;
    color: #cbd5e1 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.sidebar .logout:hover {
    color: #ffffff !important;
    background: rgba(255,255,255,.06) !important;
    transform: none !important;
}


/* =========================================================
   INNOVA SISTEMAS — AGENDA
   ========================================================= */

.agenda-page {
    padding-bottom: 30px;
}

.agenda-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.agenda-header h1 {
    margin: 3px 0 2px;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.6px;
}

.agenda-header p {
    margin: 0;
    color: var(--muted);
}

.page-kicker {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.agenda-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

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

.agenda-grid {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr);
}

.agenda-grid-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.agenda-grid-header + .agenda-grid-header {
    border-left: 1px solid var(--border);
}

.time-header {
    color: var(--muted);
}

.agenda-time {
    min-height: 58px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 10px 16px 0 8px;
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.agenda-slot {
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 7px 14px;
    border-bottom: 1px solid #edf2f7;
    border-left: 1px solid var(--border);
    text-decoration: none;
    transition: background .16s ease, transform .16s ease;
}

.agenda-slot.available {
    color: #94a3b8;
    background: #ffffff;
}

.agenda-slot.available:hover {
    background: #f0fdfa;
    color: var(--primary-dark);
}

.agenda-slot.available span {
    font-size: 13px;
    font-weight: 600;
}

.agenda-slot.available small {
    font-size: 11px;
    opacity: 0;
    transition: opacity .16s ease;
}

.agenda-slot.available:hover small {
    opacity: 1;
}

.agenda-slot.occupied {
    background: #ecfeff;
    border-left: 3px solid var(--primary);
    color: #134e4a;
}

.agenda-slot.occupied:hover {
    background: #cffafe;
}

.agenda-slot strong {
    font-size: 14px;
    line-height: 1.25;
}

.agenda-slot small {
    color: #64748b;
    font-size: 11px;
}

.agenda-slot.occupied small {
    color: #475569;
}

.agenda-closed {
    padding: 70px 30px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.agenda-closed-icon {
    margin-bottom: 12px;
    font-size: 38px;
}

.agenda-closed h2 {
    margin: 0 0 5px;
}

.agenda-closed p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 800px) {
    .agenda-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .agenda-actions {
        width: 100%;
    }

    .agenda-grid {
        grid-template-columns: 75px minmax(0, 1fr);
    }

    .agenda-time {
        padding-right: 10px;
        padding-left: 4px;
    }

    .agenda-slot {
        padding-left: 10px;
        padding-right: 10px;
    }
}


/* =========================================================
   CORREÇÃO FINAL — GRADE DA AGENDA
   ========================================================= */

.agenda-page .agenda-grid {
    display: grid !important;
    grid-template-columns: 105px minmax(0, 1fr) !important;
    width: 100% !important;
    align-items: stretch !important;
}

.agenda-page .agenda-grid-header {
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
}

.agenda-page .agenda-time {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    min-height: 58px !important;
    padding: 10px 16px 0 8px !important;
}

.agenda-page .agenda-slot {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-height: 58px !important;
    width: 100% !important;
}

.agenda-page .agenda-slot.available {
    cursor: pointer !important;
}

.agenda-page .agenda-slot.occupied {
    cursor: pointer !important;
}

@media (max-width: 800px) {
    .agenda-page .agenda-grid {
        grid-template-columns: 75px minmax(0, 1fr) !important;
    }
}


/* =========================================================
   AGENDA — BLOCOS DE CONSULTA
   ========================================================= */

.agenda-page .agenda-slot.occupied {
    background: #ecfeff !important;
    border-left: 3px solid var(--primary) !important;
    color: #134e4a !important;
}

.agenda-page .agenda-slot.occupied-start {
    border-top: 1px solid #a5f3fc !important;
    border-radius: 8px 8px 0 0 !important;
}

.agenda-page .agenda-slot.occupied-continuation {
    border-top: 0 !important;
    border-radius: 0 !important;
}

.agenda-page .agenda-slot.occupied-end {
    border-bottom: 1px solid #a5f3fc !important;
    border-radius: 0 0 8px 8px !important;
}

.agenda-page .agenda-slot.occupied:hover {
    background: #cffafe !important;
}

.agenda-page .agenda-continuation {
    display: block;
    width: 100%;
    height: 100%;
}


/* =========================================================
   AGENDA — AJUSTE VISUAL DO TEMPO DE CONSULTA
   ========================================================= */

.form-group .duration-control {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    width: 190px !important;
    max-width: 190px !important;
    height: 46px !important;
    margin-top: 6px !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border: 1px solid #dbe3ea !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
}

.form-group .duration-button {
    flex: 0 0 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 48px !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #0f8580 !important;
    color: #ffffff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

.form-group .duration-button:hover {
    background: #0b716d !important;
}

.form-group .duration-value {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 94px !important;
    height: 44px !important;
    min-height: 44px !important;
    border: 0 !important;
    background: #ffffff !important;
}

.form-group .duration-value strong {
    display: block !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #172b4d !important;
    white-space: nowrap !important;
}

.form-group .duration-end {
    margin-top: 7px !important;
    color: #64748b !important;
    font-size: 12px !important;
}

.form-group .duration-end strong {
    color: #172b4d !important;
}



/* =========================================================
   AGENDA — HORÁRIOS PASSADOS
   ========================================================= */

.agenda-slot.past-slot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: default;
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    text-decoration: none;
    opacity: .75;
}

.agenda-slot.past-slot span {
    font-size: 13px;
    font-weight: 500;
}

.agenda-slot.past-slot small {
    margin-top: 2px;
    font-size: 11px;
    color: #a0aec0;
}

.agenda-slot.available {
    cursor: pointer;
}


/* =========================================================
   AGENDA — HORÁRIO PASSADO / BLOCO VISUAL
   ========================================================= */

.agenda-slot.past-slot {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-height: 100% !important;
    padding: 0 14px !important;
    background: #fff1f2 !important;
    border-left: 3px solid #dc2626 !important;
    color: #dc2626 !important;
    cursor: default !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

.agenda-slot.past-slot:hover {
    background: #ffe4e6 !important;
}

.agenda-slot.past-slot .past-slot-mark {
    font-size: 20px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    color: #dc2626 !important;
}


/* =========================================================
   AGENDA — POSIÇÃO DO MARCADOR DE HORÁRIO PASSADO
   ========================================================= */

.agenda-slot.past-slot {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: #fff1f2 !important;
    border-left: 3px solid #dc2626 !important;
    border-radius: 0 !important;
}

.agenda-slot.past-slot .past-slot-mark {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    color: #dc2626 !important;
}

.agenda-slot.past-slot:hover {
    background: #ffe9eb !important;
}


/* =========================================================
   AGENDA — HORÁRIO DISPONÍVEL
   ========================================================= */

.agenda-slot.available {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    color: #0f8580 !important;
    text-decoration: none !important;
}

.agenda-slot.available:hover {
    background: #f0fdfa !important;
}

.agenda-slot.available .available-slot-mark {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    font-weight: 500 !important;
    color: #0f8580 !important;
}

/* Linha do paciente clicável */
.patient-row td:not(:last-child) {
    cursor: pointer !important;
}

/* =========================
   CABEÇALHO CLEAN DO PACIENTE
   ========================= */

.patient-header {
    position: fixed;
    top: 70px;
    left: 250px;
    right: 0;
    z-index: 1000;
    max-width: 1400px;
    margin: 0 auto;
    padding: 7px 28px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.patient-header-info {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.patient-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f3f5;
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 16px;
    font-weight: 700;
}

.patient-header-name {
    min-width: 0;
}

.patient-header-name h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: -0.35px;
    font-weight: 650;
}

.patient-header-name p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.patient-header-nav {
    display: flex;
    align-items: flex-end;
    gap: 26px;
    margin-top: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.patient-header-nav::-webkit-scrollbar {
    display: none;
}

.patient-header-nav a {
    position: relative;
    flex: 0 0 auto;
    padding: 0 0 8px;
    color: var(--muted);
    background: transparent;
    border: 0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.patient-header-nav a:hover {
    color: var(--text);
}

.patient-header-nav a.patient-menu-active {
    color: var(--text);
    font-weight: 650;
}

.patient-header-nav a.patient-menu-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--text);
    border-radius: 2px 2px 0 0;
}

.patient-header-nav .patient-header-back {
    margin-left: auto;
    color: var(--muted);
}

.patient-header-nav .patient-header-back:hover {
    color: var(--text);
}

/* =========================
   BARRA SUPERIOR FIXA
   ========================= */

.topbar {
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    z-index: 1100;
    min-height: 70px;
}

/* Reserva espaço para a barra superior fixa */
.main {
    padding-top: 70px;
}

/* =========================
   AÇÃO DE EDIÇÃO DA FICHA
   ========================= */

.patient-edit-action {
    margin: 0 34px 20px;
    display: flex;
    justify-content: flex-end;
}

.patient-edit-action .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* =========================
   AÇÕES MINIMALISTAS DO PACIENTE
   ========================= */

.patient-edit-action .btn {
    background: transparent !important;
    color: var(--text) !important;
    border: 1px solid #aeb7c2 !important;
    box-shadow: none !important;
    border-radius: 7px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.patient-edit-action .btn:hover {
    background: #f5f6f7 !important;
    color: var(--text) !important;
    border-color: #7d8793 !important;
    transform: none;
}

/* =========================
   CONTEÚDO DO PACIENTE
   ========================= */

.patient-page-content {
    padding-top: 108px;
}

.patient-page-content > .patient-edit-action {
    margin-top: 0;
}

.patient-page-content > .card:first-child {
    margin-top: 0;
}

/* =========================
   RESPONSIVO
   ========================= */

@media (max-width: 900px) {
    .topbar {
        left: 0;
    }

    .patient-header {
        top: 70px;
        left: 0;
    }
}

/* =========================================================
   ODONTOGRAMA
   ========================================================= */

.odontograma-page {
    max-width: 1400px;
    margin: 0 auto;
}

.odontograma-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 34px 20px;
}

.odontograma-title h2 {
    margin: 0;
    font-size: 24px;
    color: var(--text);
}

.odontograma-title p {
    margin: 5px 0 0;
    color: var(--muted);
}

.odontograma-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.odontograma-toggle button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
}

.odontograma-toggle button:hover {
    border-color: #0f766e;
}

.odontograma-toggle .odontograma-toggle-active {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
}

.odontograma-card {
    margin: 0 34px;
    overflow-x: auto;
}

.odontograma-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

.odontograma-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.odontograma-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid var(--border);
}

.odontograma-dot-normal {
    background: #ffffff;
}

.odontograma-dot-alterado {
    background: #f59e0b;
    border-color: #f59e0b;
}

.odontograma-dot-ausente {
    background: #6b7280;
    border-color: #6b7280;
}

.odontograma-arcada {
    padding: 26px 0;
}

.odontograma-arcada h3 {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--text);
}

.odontograma-dentes {
    display: flex;
    justify-content: center;
    gap: 8px;
    min-width: 850px;
}

.odontograma-dente {
    position: relative;
    width: 48px;
    height: 72px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    flex: 0 0 48px;
}

.odontograma-dente-numero {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}

.odontograma-dente-forma {
    position: absolute;
    left: 7px;
    right: 7px;
    top: 20px;
    bottom: 0;
    border: 2px solid #64748b;
    border-radius: 46% 46% 42% 42%;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
    transition: 0.15s ease;
}

.odontograma-dente:hover .odontograma-dente-forma {
    border-color: #0f766e;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}

.odontograma-status-alterado .odontograma-dente-forma {
    background: #fef3c7;
    border-color: #f59e0b;
}

.odontograma-status-ausente .odontograma-dente-forma {
    background: #e5e7eb;
    border-color: #6b7280;
    opacity: 0.7;
}

.odontograma-status-extraido .odontograma-dente-forma {
    background: #e5e7eb;
    border-color: #6b7280;
    opacity: 0.7;
}

.odontograma-separador {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.odontograma-selecao {
    margin: 20px 34px 0;
}

.odontograma-selecao h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.odontograma-selecao p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 900px) {
    .odontograma-title {
        align-items: flex-start;
        flex-direction: column;
        margin-left: 20px;
        margin-right: 20px;
    }

    .odontograma-card {
        margin-left: 20px;
        margin-right: 20px;
    }

    .odontograma-selecao {
        margin-left: 20px;
        margin-right: 20px;
    }
}

/* Espaçamento compacto entre cards da área do paciente */
.patient-page-content > .card {
    margin-bottom: 12px;
}

.patient-page-content > .card:last-child {
    margin-bottom: 0;
}
