.clinical-shell-frame {
    display: contents;
}

.clinical-nav-toggle {
    display: none;
}

.clinical-nav-backdrop {
    display: none;
}

.sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    width: var(--df-sidebar, 232px);
    background: var(--df-surface, #fff);
    border-right: 1px solid var(--df-border, #dce4dd);
    min-height: 100vh;
    z-index: 40;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    height: var(--df-header, 64px);
    padding: 0 1rem;
    border-bottom: 1px solid var(--df-border, #dce4dd);
}

.sidebar__brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--df-ink, #173d35);
}

.sidebar__wordmark {
    font-family: var(--df-font-editorial, "Fraunces", serif);
    font-size: 1.2rem;
    font-weight: 560;
    letter-spacing: -0.02em;
}

.sidebar__mark {
    flex: none;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.sidebar__link {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--df-text, #203831);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    width: 100%;
    text-align: left;
    position: relative;
    transition: background-color var(--df-duration, 160ms) var(--df-ease, ease), color var(--df-duration, 160ms) var(--df-ease, ease);
}

.sidebar__link:hover {
    background: var(--df-sage, #e5eee7);
    color: var(--df-ink, #173d35);
}

.sidebar__link.active {
    background: var(--df-sage, #e5eee7);
    color: var(--df-primary, #185e50);
}

.sidebar__link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45rem;
    bottom: 0.45rem;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--df-primary, #185e50);
}

.sidebar__link--button {
    cursor: pointer;
    font: inherit;
}

.sidebar__label {
    line-height: 1.2;
}

.sidebar__section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--df-border, #dce4dd);
}

.sidebar__status {
    margin: 0.35rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--df-muted, #5b6d64);
}

.clinical-breadcrumb {
    margin: 0 0 0.85rem;
}

.clinical-breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.clinical-breadcrumb__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.clinical-breadcrumb__link {
    color: var(--df-primary, #185e50);
    text-decoration: none;
}

.clinical-breadcrumb__link:hover {
    text-decoration: underline;
}

.clinical-breadcrumb__sep {
    color: var(--df-muted, #5b6d64);
}

.clinical-breadcrumb__current {
    color: var(--df-muted, #5b6d64);
}

.top-row {
    grid-area: header;
    min-height: var(--df-header, 64px);
    height: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.65rem 1.5rem 0.65rem 1.25rem;
    background: var(--df-surface, #fff);
    border-bottom: 1px solid var(--df-border, #dce4dd);
    position: sticky;
    top: 0;
    z-index: 30;
}

.top-row__context {
    min-width: 0;
}

.top-row__clinic {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--df-ink, #173d35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(42vw, 20rem);
}

.top-row__unit {
    margin: 0.1rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--df-muted, #5b6d64);
}

.top-row__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.top-row__select {
    max-width: 14rem;
    min-height: var(--df-control-height, 44px);
    height: auto;
    border: 1px solid var(--df-control-border, #788d80);
    border-radius: var(--df-radius-control, 8px);
    background: var(--df-canvas, #f5f7f4);
    color: var(--df-text, #203831);
    padding: 0 0.65rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.top-row__action,
.top-row__profile {
    display: inline-flex;
    align-items: center;
    min-height: var(--df-control-height, 44px);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--df-primary, #185e50);
    text-decoration: none;
}

.top-row__error {
    flex: 1 0 100%;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--df-danger, #b42318);
}

.top-row__bootstrap {
    flex: 1 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.top-row__bootstrap .top-row__error {
    flex: 1 1 auto;
}

.top-row__bootstrap .top-row__action {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.top-row__hint {
    flex: 1 0 100%;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--df-muted, #5b6d64);
}

@media (max-width: 899.98px) {
    .clinical-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 50;
        width: 2.75rem;
        height: 2.75rem;
        border: 1px solid var(--df-border, #dce4dd);
        border-radius: 10px;
        background: var(--df-surface, #fff);
        box-shadow: var(--df-shadow-menu, 0 12px 32px rgb(23 61 53 / 12%));
        cursor: pointer;
    }

    .clinical-nav-toggle__bars,
    .clinical-nav-toggle__bars::before,
    .clinical-nav-toggle__bars::after {
        display: block;
        width: 1.1rem;
        height: 2px;
        background: var(--df-ink, #173d35);
        border-radius: 1px;
    }

    .clinical-nav-toggle__bars {
        position: relative;
    }

    .clinical-nav-toggle__bars::before,
    .clinical-nav-toggle__bars::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .clinical-nav-toggle__bars::before { top: -5px; }
    .clinical-nav-toggle__bars::after { top: 5px; }

    .clinical-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        border: 0;
        background: rgb(23 61 53 / 35%);
        cursor: pointer;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(20rem, 86vw);
        transform: translateX(-105%);
        transition: transform var(--df-duration, 160ms) var(--df-ease, ease);
        box-shadow: var(--df-shadow-menu);
    }

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

    .top-row {
        padding-left: 4rem;
    }
}

@media (min-width: 900px) and (max-width: 1199.98px) {
    /* Tablet: sidebar recolhível em largura, rótulos permanecem. */
    .sidebar {
        width: 11.5rem;
    }

    .sidebar__label {
        font-size: 0.875rem;
    }
}
