/* PsiClinic — painel clínico (layout conforme mockups) */

:root {
    --pc-bp-tablet: 960px;
    --pc-bp-mobile-m: 720px;
    --pc-bp-mobile-p: 480px;
    --pc-touch-target-min: 44px;

    --pc-sidebar: #0b1120;
    --pc-sidebar-border: rgba(255, 255, 255, 0.06);
    --pc-main: #f1f5f9;
    --pc-card: #ffffff;
    --pc-text: #0f172a;
    --pc-muted: #64748b;
    --pc-primary: #2563eb;
    --pc-primary-hover: #1d4ed8;
    --pc-radius: 12px;
    --pc-radius-sm: 10px;
    --pc-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
    --pc-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.pc-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--pc-font);
    color: var(--pc-text);
    background: var(--pc-main);
}

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

/* Coluna principal + app bar (Fase R2) */
.pc-shell__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.pc-appbar {
    display: none;
}

.pc-sidebar__brand-text {
    min-width: 0;
    flex: 1;
}

.pc-sidebar__close {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--pc-touch-target-min);
    height: var(--pc-touch-target-min);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--pc-radius-sm);
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pc-sidebar__close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.pc-sidebar__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Sidebar */
.pc-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--pc-sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 24px 16px 20px;
    border-right: 1px solid var(--pc-sidebar-border);
}

.pc-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 28px;
}

.pc-logo {
    flex-shrink: 0;
}

.pc-sidebar__title {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    color: #fff;
}

.pc-sidebar__tag {
    font-size: 0.8125rem;
    color: #94a3b8;
    margin-top: 2px;
}

.pc-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.pc-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--pc-touch-target-min);
    padding: 12px 14px;
    box-sizing: border-box;
    border-radius: var(--pc-radius-sm);
    color: #cbd5e1;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.pc-nav__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.pc-nav__link.is-active {
    background: var(--pc-primary);
    color: #fff;
}

.pc-nav__link--ghost {
    color: #94a3b8;
}

.pc-nav__link--ghost:hover {
    color: #e2e8f0;
}

.pc-nav__ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.pc-nav__ico svg {
    display: block;
}

.pc-sidebar__foot {
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid var(--pc-sidebar-border);
}

/* Main */
.pc-main {
    flex: 1;
    min-width: 0;
    padding: 32px 36px 48px;
}

/* Fase R3 — cadeias flex: permite encolher dentro de colunas / toolbar */
.pc-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    min-width: 0;
}

.pc-page-head > div {
    min-width: 0;
}

.pc-toolbar {
    min-width: 0;
}

.pc-toolbar__form {
    min-width: 0;
}

.pc-panel__title {
    min-width: 0;
}

.pc-week-nav {
    min-width: 0;
}

.pc-week-range {
    min-width: 0;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-page-head h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.pc-page-head__sub {
    margin: 6px 0 0;
    font-size: 0.9375rem;
    color: var(--pc-muted);
}

.pc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--pc-touch-target-min);
    padding: 11px 18px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--pc-primary);
    border: none;
    border-radius: var(--pc-radius-sm);
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
    transition: background 0.15s;
}

.pc-btn:hover {
    background: var(--pc-primary-hover);
    color: #fff;
}

/* Stat cards — grid fluido: evita 4 colunas espremidas em telas estreitas */
.pc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 1100px) {
    .pc-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px;
    }
}

.pc-stat {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    padding: 18px 16px 16px;
    box-shadow: var(--pc-shadow);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
    min-width: 0;
}

.pc-stat > div:first-of-type {
    display: contents;
}

.pc-stat__label {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.875rem;
    color: var(--pc-muted);
    font-weight: 500;
    margin: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pc-stat__value {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    font-size: clamp(1.35rem, 4.5vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.pc-stat__ico {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .pc-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pc-stat {
        padding: 16px 14px 14px;
    }

    .pc-stat__ico {
        width: 40px;
        height: 40px;
    }

    .pc-stat__ico svg {
        width: 20px;
        height: 20px;
    }
}

.pc-stat__ico--blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.pc-stat__ico--green {
    background: #dcfce7;
    color: #166534;
}

.pc-stat__ico--orange {
    background: #ffedd5;
    color: #c2410c;
}

.pc-stat__ico--money {
    background: #d1fae5;
    color: #047857;
}

.pc-stat__ico--yellow {
    background: #fef9c3;
    color: #a16207;
}

.pc-stat__ico--red {
    background: #fee2e2;
    color: #b91c1c;
}

.pc-stat__ico svg {
    width: 24px;
    height: 24px;
}

/* Charts row */
.pc-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 960px) {
    .pc-charts {
        grid-template-columns: 1fr;
    }
}

.pc-panel {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    padding: 22px 24px 24px;
    box-shadow: var(--pc-shadow);
}

.pc-panel__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    font-size: 1.0625rem;
    font-weight: 600;
}

.pc-panel__title svg {
    color: var(--pc-muted);
}

.pc-chart-wrap {
    position: relative;
    height: 260px;
    max-width: 280px;
    margin: 0 auto;
}

.pc-chart-wrap--bar {
    max-width: none;
    height: 280px;
}

/* Fase R8 — gráficos: alturas em viewport baixa (Chart.js: maintainAspectRatio false) */
@media (max-width: 720px) {
    .pc-chart-wrap {
        height: 220px;
        max-width: min(280px, 100%);
    }

    .pc-chart-wrap--bar {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .pc-chart-wrap {
        height: 200px;
    }

    .pc-chart-wrap--bar {
        height: 200px;
    }
}

@media (max-height: 460px) and (orientation: landscape) {
    .pc-chart-wrap {
        height: min(200px, 42vh);
        max-width: min(260px, 42vw);
    }

    .pc-chart-wrap--bar {
        height: min(200px, 48vh);
    }
}

.pc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 20px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 8px;
}

.pc-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--pc-muted);
}

.pc-legend__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Toolbar (search + select) */
.pc-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    align-items: center;
}

.pc-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.pc-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pc-muted);
    pointer-events: none;
}

.pc-search input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
    outline: none;
}

.pc-search input::placeholder {
    color: #94a3b8;
}

.pc-search input:focus {
    border-color: var(--pc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pc-select {
    padding: 12px 36px 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    color: var(--pc-text);
    min-width: 140px;
}

.pc-select:focus {
    border-color: var(--pc-primary);
    outline: none;
}

/* Patient list */
.pc-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pc-list--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.pc-list--grid .pc-patient {
    flex-direction: column;
    height: 100%;
}

.pc-toolbar--form {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.pc-toolbar--form .pc-view-toggle {
    margin-left: auto;
}

.pc-view-toggle {
    display: inline-flex;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.pc-view-toggle__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2rem;
    padding: 0;
    color: #64748b;
    text-decoration: none;
    background: #fff;
}

.pc-view-toggle__btn svg {
    display: block;
}

.pc-view-toggle__btn:hover {
    background: #f8fafc;
    color: #334155;
}

.pc-view-toggle__btn.is-active {
    background: var(--pc-primary);
    color: #fff;
}

.pc-view-toggle__btn.is-active:hover {
    color: #fff;
}

.pc-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0 0;
    padding: 0.75rem 0;
}

.pc-pagination__info {
    margin: 0;
    font-size: 0.875rem;
    color: var(--pc-muted);
}

.pc-pagination__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pc-pagination__pages {
    font-size: 0.875rem;
    color: var(--pc-text);
}

.pc-btn--sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.pc-patient {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    padding: 18px 20px;
    box-shadow: var(--pc-shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.pc-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #dbeafe;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.pc-avatar--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pc-phone-field {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.pc-phone-field__code {
    flex: 0 0 160px;
    min-width: 140px;
}

.pc-phone-field__number {
    flex: 1 1 180px;
    min-width: 0;
}

.pc-photo-field__row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.pc-photo-field__preview {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    flex-shrink: 0;
}

.pc-photo-field__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pc-photo-field__actions {
    flex: 1 1 200px;
    min-width: 0;
}

.pc-photo-field__remove {
    margin-top: 8px;
}

.pc-patient__body {
    flex: 1;
    min-width: 0;
}

.pc-patient__row1 {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pc-patient__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.pc-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: lowercase;
}

.pc-badge--ativo {
    background: #dcfce7;
    color: #166534;
}

.pc-badge--inativo {
    background: #f1f5f9;
    color: #64748b;
}

.pc-badge--alta {
    background: #dbeafe;
    color: #1d4ed8;
}

.pc-badge--pago {
    background: #dcfce7;
    color: #166534;
}

.pc-badge--pendente {
    background: #ffedd5;
    color: #9a3412;
}

.pc-patient__meta {
    margin: 8px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    font-size: 0.875rem;
    color: var(--pc-muted);
}

.pc-patient__meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pc-patient__prof {
    margin: 6px 0 0;
    font-size: 0.875rem;
    color: var(--pc-muted);
}

.pc-patient-historico {
    margin-top: 10px;
    font-size: 0.8125rem;
}

.pc-patient-historico__sum {
    cursor: pointer;
    color: var(--pc-primary);
    font-weight: 600;
}

.pc-patient-historico__list {
    margin: 8px 0 0;
    padding-left: 1.15rem;
    color: var(--pc-muted);
    line-height: 1.45;
}

.pc-patient-historico__list li {
    margin-bottom: 4px;
}

.pc-badge--consulta-agendada {
    background: #f1f5f9;
    color: #475569;
}

.pc-badge--consulta-realizada {
    background: #dcfce7;
    color: #166534;
}

.pc-badge--consulta-cancelada {
    background: #fee2e2;
    color: #991b1b;
}

.pc-badge--consulta-falta {
    background: #ffedd5;
    color: #9a3412;
}

.pc-iconbtn {
    border: none;
    background: transparent;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--pc-muted);
    line-height: 0;
}

.pc-iconbtn:hover {
    background: #f1f5f9;
    color: var(--pc-text);
}

.pc-actions-menu {
    position: relative;
}

.pc-actions-menu > summary {
    list-style: none;
    cursor: pointer;
}

.pc-actions-menu > summary::-webkit-details-marker {
    display: none;
}

.pc-actions-menu[open] {
    z-index: 20;
}

.pc-actions-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 6px;
    z-index: 10;
}

.pc-actions-menu__item {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--pc-text);
    text-decoration: none;
    cursor: pointer;
}

.pc-actions-menu__item:hover {
    background: #f8fafc;
}

.pc-actions-menu__item--danger {
    color: #b91c1c;
}

.pc-pro-collection--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.pc-pro-collection--grid > .pc-pro-card {
    min-width: 0;
}

.pc-pro-collection--list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pc-pro-collection--list .pc-pro-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
}

.pc-pro-collection--list .pc-pro-card__head {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
}

.pc-pro-collection--list .pc-pro-card__head .pc-actions-menu {
    margin-left: auto;
    flex-shrink: 0;
}

.pc-pro-collection--list .pc-pro-card__info {
    flex: 1 1 220px;
}

.pc-pro-collection--list .pc-pro-card__foot {
    flex: 1 1 auto;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.pc-pro-card {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    padding: 20px;
    box-shadow: var(--pc-shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
}

.pc-pro-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pc-pro-card__who {
    display: flex;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.pc-pro-card__who > div {
    min-width: 0;
}

.pc-pro-card__name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-pro-card__crp {
    margin: 2px 0 0;
    font-size: 0.8125rem;
    color: var(--pc-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-pro-card__info {
    font-size: 0.875rem;
    color: var(--pc-muted);
    line-height: 1.5;
    min-width: 0;
}

.pc-pro-card__info > div:first-child {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pc-pro-card__info strong {
    color: var(--pc-text);
    font-weight: 500;
}

.pc-pro-card__contacts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    min-width: 0;
}

.pc-pro-card__contact-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.pc-pro-card__contact-line svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.pc-pro-card__contact-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-pro-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.875rem;
    color: var(--pc-muted);
}

/* Agenda */
.pc-week-card {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    padding: 20px 16px 18px;
    box-shadow: var(--pc-shadow);
    margin-bottom: 18px;
}

.pc-week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.pc-week-nav button {
    border: none;
    background: #f8fafc;
    width: var(--pc-touch-target-min);
    height: var(--pc-touch-target-min);
    min-width: var(--pc-touch-target-min);
    min-height: var(--pc-touch-target-min);
    flex-shrink: 0;
    box-sizing: border-box;
    border-radius: 10px;
    cursor: pointer;
    color: var(--pc-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.pc-week-nav button:hover {
    background: #e2e8f0;
    color: var(--pc-text);
}

.pc-week-nav__btn {
    border: none;
    background: #f8fafc;
    width: var(--pc-touch-target-min);
    height: var(--pc-touch-target-min);
    min-width: var(--pc-touch-target-min);
    min-height: var(--pc-touch-target-min);
    flex-shrink: 0;
    box-sizing: border-box;
    border-radius: 10px;
    cursor: pointer;
    color: var(--pc-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.pc-week-nav__btn:focus-visible {
    outline: 2px solid var(--pc-primary);
    outline-offset: 2px;
}

.pc-week-nav__btn:hover {
    background: #e2e8f0;
    color: var(--pc-text);
}

.pc-week-range {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--pc-text);
}

.pc-week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* Fase R6 — Agenda: grade em 2/4/7 colunas + paisagem + toque */
@media (max-width: 720px) {
    .pc-week-days {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .pc-week-days {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .pc-day.pc-day--link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: var(--pc-touch-target-min);
        padding: 10px 6px;
        box-sizing: border-box;
    }

    .pc-week-card {
        padding: 16px 14px 16px;
    }
}

@media (max-height: 480px) and (orientation: landscape) and (max-width: 960px) {
    .pc-week-days {
        grid-template-columns: repeat(7, 1fr);
        gap: 6px;
    }

    .pc-day.pc-day--link {
        min-height: 0;
        padding: 8px 4px;
    }

    .pc-day__num {
        font-size: 1rem;
    }

    .pc-day__label {
        font-size: 0.625rem;
        margin-bottom: 2px;
    }

    .pc-week-card {
        padding: 12px 12px 12px;
        margin-bottom: 14px;
    }
}

@media (max-width: 360px) {
    .pc-week-range {
        font-size: 0.8125rem;
    }

    .pc-week-nav {
        gap: 8px;
    }
}

.pc-day {
    text-align: center;
    padding: 12px 6px;
    border-radius: var(--pc-radius-sm);
    cursor: default;
}

.pc-day--link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: block;
    border: 1px solid transparent;
    touch-action: manipulation;
}

.pc-day--link:hover:not(.is-selected) {
    background: #f1f5f9;
}

.pc-day--link.is-selected:hover {
    filter: brightness(1.05);
}

.pc-day__label {
    display: block;
    font-size: 0.6875rem;
    color: var(--pc-muted);
    text-transform: lowercase;
    margin-bottom: 4px;
}

.pc-day__num {
    font-size: 1.125rem;
    font-weight: 700;
}

.pc-day.is-selected {
    background: var(--pc-primary);
    color: #fff;
}

.pc-day.is-selected .pc-day__label {
    color: rgba(255, 255, 255, 0.85);
}

.pc-empty {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    box-shadow: var(--pc-shadow);
    padding: 80px 24px;
    text-align: center;
    color: var(--pc-muted);
    font-size: 0.9375rem;
}

.pc-input--time {
    min-height: 46px;
}

.pc-agenda-list {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    box-shadow: var(--pc-shadow);
    overflow: visible;
    margin-bottom: 22px;
}

.pc-agenda-item {
    display: flex;
    position: relative;
    gap: 16px;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    overflow: visible;
    min-width: 0;
}

.pc-agenda-item:last-child {
    border-bottom: none;
}

.pc-agenda-item__time {
    flex-shrink: 0;
    min-width: 52px;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--pc-primary);
}

.pc-agenda-item__body {
    flex: 1;
    min-width: 0;
}

.pc-agenda-item .pc-actions-menu {
    flex-shrink: 0;
    margin-left: auto;
}

.pc-agenda-item .pc-actions-menu__panel {
    min-width: 240px;
}

.pc-agenda-item .pc-actions-menu > summary.pc-iconbtn {
    min-width: var(--pc-touch-target-min);
    min-height: var(--pc-touch-target-min);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: var(--pc-radius-sm);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.pc-agenda-item .pc-actions-menu > summary.pc-iconbtn:focus-visible {
    outline: 2px solid var(--pc-primary);
    outline-offset: 2px;
}

.pc-agenda-ce-wrap {
    padding: 8px 6px 4px;
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
}

.pc-agenda-ce-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pc-agenda-ce-form__lbl {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pc-muted);
}

.pc-agenda-ce-form__sel,
.pc-agenda-ce-form__ta {
    width: 100%;
}

.pc-agenda-ce-form__ta {
    min-height: 48px;
    resize: vertical;
}

.pc-actions-menu__item--submit {
    margin-top: 2px;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    font-weight: 600;
}

.pc-agenda-item__body strong {
    font-size: 0.9375rem;
    font-weight: 600;
}

.pc-agenda-item__meta {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    color: var(--pc-muted);
}

.pc-agenda-item__obs {
    margin: 8px 0 0;
    font-size: 0.875rem;
    color: var(--pc-text);
    line-height: 1.45;
}

/* Financeiro table */
.pc-table-wrap {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    box-shadow: var(--pc-shadow);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.pc-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.pc-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pc-muted);
    border-bottom: 1px solid #f1f5f9;
}

.pc-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.9375rem;
}

.pc-table tr:last-child td {
    border-bottom: none;
}

.pc-table strong {
    font-weight: 600;
}

.pc-table .sub {
    display: block;
    font-size: 0.8125rem;
    color: var(--pc-muted);
    font-weight: 400;
    margin-top: 4px;
}

/* Fase R5 — tabelas: detalhe longo, forms em célula, painel de ações */
.pc-table__detail {
    max-width: 280px;
    word-break: break-word;
    font-size: 0.85rem;
}

.pc-table-form--cell {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
}

.pc-actions-menu__panel--wide {
    min-width: 250px;
}

/* Vista empilhada (≤720px): rótulos via data-label */
@media (max-width: 720px) {
    .pc-table__detail {
        max-width: none;
    }

    .pc-table-form--cell {
        max-width: none;
    }

    .pc-actions-menu__panel--wide {
        min-width: 0;
        max-width: min(300px, calc(100vw - 32px));
    }

    .pc-table.pc-table--stack-md {
        min-width: 0 !important;
        width: 100%;
        display: block;
    }

    .pc-table.pc-table--stack-md thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .pc-table.pc-table--stack-md tbody {
        display: block;
    }

    .pc-table.pc-table--stack-md tbody tr {
        display: block;
        margin-bottom: 14px;
        border: 1px solid #e2e8f0;
        border-radius: var(--pc-radius-sm);
        background: #fff;
        overflow: hidden;
    }

    .pc-table.pc-table--stack-md td {
        position: relative;
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 12px 14px 12px calc(42% + 18px) !important;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        vertical-align: top;
        text-align: right;
        font-size: 0.9375rem;
    }

    .pc-table.pc-table--stack-md tbody tr td:last-child {
        border-bottom: none;
    }

    .pc-table.pc-table--stack-md td::before {
        position: absolute;
        left: 14px;
        top: 12px;
        width: 38%;
        max-width: 11rem;
        content: attr(data-label);
        font-size: 0.6875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--pc-muted);
        text-align: left;
        line-height: 1.35;
        word-break: break-word;
    }

    .pc-table.pc-table--stack-md td.pc-table__cell--stack {
        padding: 14px 14px 16px !important;
        text-align: left;
    }

    .pc-table.pc-table--stack-md td.pc-table__cell--stack::before {
        position: static;
        display: block;
        width: 100%;
        max-width: none;
        margin-bottom: 8px;
    }
}

/* Alerts (painel clínico) */
.pc-alert {
    padding: 14px 18px;
    border-radius: var(--pc-radius-sm);
    margin-bottom: 20px;
    font-size: 0.9375rem;
    font-weight: 500;
}

.pc-alert--success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.pc-alert--error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.pc-alert--warning {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde047;
}

.pc-alert--info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

.pc-badge--encaixe {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.pc-agenda-item__remarcacao {
    margin: 6px 0 0;
    font-size: 0.8125rem;
    color: #64748b;
}

.pc-field__label--checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
}

.pc-field__label--checkbox input {
    margin-top: 3px;
    flex-shrink: 0;
}

.pc-agenda-ce-hint {
    margin: 0 0 8px;
    max-width: 42rem;
}

/* Modal overlay — mesmo padrão visual (centrado, fundo escurecido, cartão branco) */
body.pc-modal-open {
    overflow: hidden;
}

div.pc-modal[hidden] {
    display: none !important;
}

div.pc-modal:not([hidden]) {
    display: flex;
}

div.pc-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}

.pc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    cursor: pointer;
}

.pc-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(520px, calc(100vw - 48px));
    max-width: min(520px, calc(100vw - 48px));
    max-height: min(92vh, calc(100vh - 48px));
    max-height: min(92dvh, calc(100dvh - 48px));
    overflow: hidden;
    background: #fff;
    border-radius: var(--pc-radius);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

.pc-modal__dialog--wide {
    width: min(640px, calc(100vw - 48px));
    max-width: min(640px, calc(100vw - 48px));
    max-height: min(92vh, calc(100vh - 48px));
    max-height: min(92dvh, calc(100dvh - 48px));
}

.pc-modal__head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    min-width: 0;
}

.pc-modal__title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.pc-modal__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--pc-touch-target-min);
    height: var(--pc-touch-target-min);
    margin: -8px -8px 0 0;
    padding: 0;
    border: none;
    border-radius: var(--pc-radius-sm);
    background: transparent;
    color: var(--pc-muted);
    cursor: pointer;
    line-height: 0;
    transition: background 0.15s, color 0.15s;
}

.pc-modal__close:hover {
    background: #f1f5f9;
    color: var(--pc-text);
}

.pc-modal__dialog > .pc-modal__banner {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 24px;
    font-size: 0.875rem;
    font-weight: 500;
}

.pc-modal__banner--error {
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fecaca;
}

.pc-modal__subhead {
    margin: 4px 0 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--pc-text);
}

.pc-modal__form {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pc-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .pc-form-row {
        grid-template-columns: 1fr;
    }
}

.pc-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pc-field--full {
    grid-column: 1 / -1;
}

.pc-field__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.pc-req {
    color: #dc2626;
    font-weight: 600;
}

/* Fase R7 — controles de formulário: 1rem (16px) mínimo para evitar zoom automático no iOS ao focar */
.pc-input,
textarea.pc-input,
textarea.pc-input.pc-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--pc-text);
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.pc-textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.45;
}

.pc-input::placeholder,
textarea.pc-input::placeholder {
    color: #94a3b8;
}

.pc-input:focus,
textarea.pc-input:focus {
    border-color: var(--pc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: #fff;
}

.pc-input--select,
select.pc-input {
    cursor: pointer;
    appearance: none;
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.pc-input--select:focus,
select.pc-input:focus {
    background-color: #fff;
}

.pc-input-wrap {
    position: relative;
}

.pc-input--date {
    padding-right: 42px;
    min-height: 46px;
}

.pc-input-wrap__ico {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
}

.pc-input--with-action {
    padding-right: 46px;
}

.pc-input-wrap__btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--pc-touch-target-min);
    height: var(--pc-touch-target-min);
    padding: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 999px;
}

.pc-input-wrap__btn:hover,
.pc-input-wrap__btn:focus-visible {
    color: #0f172a;
    background: rgba(148, 163, 184, 0.12);
    outline: none;
}

.pc-password-toggle__icon--hide {
    display: none;
}

.pc-password-toggle.is-visible .pc-password-toggle__icon--show {
    display: none;
}

.pc-password-toggle.is-visible .pc-password-toggle__icon--hide {
    display: block;
}

.pc-auth input[type="password"]::-ms-reveal,
.pc-auth input[type="password"]::-ms-clear {
    display: none;
}

.pc-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
    padding-top: 8px;
}

.pc-modal__actions--inline {
    justify-content: flex-start;
    margin-top: 0;
    padding-top: 0;
}

.pc-modal__divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 16px 0;
}

.pc-field-hint {
    font-size: 0.8125rem;
    color: #64748b;
    margin: 4px 0 10px;
    line-height: 1.35;
}

.pc-input--readonly {
    background: #f8fafc;
    color: #475569;
}

.pc-modal__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pc-modal__body > .pc-modal__form {
    flex: none;
    min-height: auto;
    overflow: visible;
}

.pc-modal__section--bloqueios {
    padding: 0 24px 20px;
}

.pc-modal__section--bloqueios .pc-modal__divider {
    margin: 0 0 16px;
}

.pc-modal__section--bloqueios .pc-modal__subhead {
    margin-top: 0;
}

.pc-modal__form--bloqueios {
    padding: 0;
    flex: none;
    min-height: auto;
    overflow: visible;
    gap: 16px;
}

.pc-modal__actions--footer {
    flex-shrink: 0;
    padding: 12px 24px 24px;
    border-top: 1px solid #f1f5f9;
}

.pc-bloqueios-list {
    margin-bottom: 14px;
}

.pc-bloqueio-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius-sm);
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.pc-bloqueio-row__txt {
    flex: 1;
    min-width: 200px;
}

.pc-bloqueio-row__del {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #b91c1c;
    text-decoration: none;
}

.pc-bloqueio-row__del:hover {
    text-decoration: underline;
}

.pc-btn--secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pc-text);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius-sm);
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s;
}

.pc-btn--secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--pc-text);
}

/* Alertas (flash) */
.pc-flash {
    padding: 12px 16px;
    border-radius: var(--pc-radius-sm);
    font-size: 0.9375rem;
    margin-bottom: 20px;
    font-weight: 500;
}

.pc-flash--ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.pc-flash--err {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Toggle — menor de idade */
.pc-field--switch-row {
    margin-top: 4px;
    margin-bottom: 2px;
}

.pc-switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.pc-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.pc-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.pc-switch__ui {
    display: block;
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #e2e8f0;
    transition: background 0.2s;
}

.pc-switch__ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
    transition: transform 0.2s;
}

.pc-switch input:checked + .pc-switch__ui {
    background: var(--pc-primary);
}

.pc-switch input:checked + .pc-switch__ui::after {
    transform: translateX(20px);
}

.pc-switch input:focus-visible + .pc-switch__ui {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.pc-switch-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--pc-text);
}

/* —— Fase R2: navegação mobile (drawer + app bar) —— */
@media (max-width: 960px) {
    .pc-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 140;
        margin: 0;
        padding: 0;
        border: none;
        background: rgba(15, 23, 42, 0.48);
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .pc-nav-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .pc-appbar {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-shrink: 0;
        min-height: calc(var(--pc-touch-target-min) + 12px);
        padding: 8px 12px 8px max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(8px, env(safe-area-inset-top));
        background: var(--pc-card);
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
        position: sticky;
        top: 0;
        z-index: 130;
    }

    .pc-appbar__menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: var(--pc-touch-target-min);
        height: var(--pc-touch-target-min);
        margin: 0;
        padding: 0;
        border: none;
        border-radius: var(--pc-radius-sm);
        background: #f1f5f9;
        color: var(--pc-text);
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .pc-appbar__menu:hover {
        background: #e2e8f0;
    }

    .pc-appbar__menu:focus-visible {
        outline: 2px solid var(--pc-primary);
        outline-offset: 2px;
    }

    .pc-appbar__menu-icon {
        display: block;
    }

    .pc-appbar__title {
        flex: 1;
        min-width: 0;
        font-size: 1.0625rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        color: var(--pc-text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pc-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 150;
        width: min(280px, 88vw);
        max-width: 100%;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

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

    .pc-sidebar__brand {
        padding-right: 4px;
    }

    .pc-sidebar__close {
        display: inline-flex;
        margin-left: 4px;
    }

    body.pc-menu-open {
        overflow: hidden;
        touch-action: none;
    }

    .pc-page-head h1 {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
    .pc-sidebar {
        transition: none;
    }

    .pc-nav-backdrop {
        transition: none;
    }
}

.pc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* —— Fase R3: padding global e mínimos flexíveis (telas pequenas) —— */
@media (max-width: 960px) {
    .pc-main {
        padding-top: 20px;
        padding-bottom: 32px;
        padding-left: max(18px, env(safe-area-inset-left, 0px));
        padding-right: max(18px, env(safe-area-inset-right, 0px));
    }

    .pc-panel {
        padding: 18px 18px 20px;
    }

    .pc-week-card {
        padding: 16px 14px 14px;
    }

    .pc-flash {
        padding: 12px 14px;
    }

    .pc-stat {
        padding: 18px 16px 16px;
    }
}

@media (max-width: 480px) {
    .pc-main {
        padding-top: 16px;
        padding-bottom: 28px;
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(14px, env(safe-area-inset-right, 0px));
    }

    .pc-panel {
        padding: 16px 14px 18px;
    }

    .pc-search {
        min-width: 0;
        flex: 1 1 100%;
    }

    .pc-toolbar .pc-select {
        min-width: 0;
        flex: 1 1 10rem;
    }

    .pc-pro-collection--grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .pc-bloqueio-row__txt {
        min-width: 0;
    }

    .pc-agenda-item .pc-actions-menu__panel {
        min-width: 0;
        max-width: min(280px, calc(100vw - 24px));
    }

    .pc-empty {
        padding: 48px 16px;
    }

    .pc-agenda-item {
        padding: 14px 14px;
    }
}

/* —— Fase R4: cabeçalho de página, toolbars e modais (≤720px) —— */
@media (max-width: 720px) {
    .pc-page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .pc-page-head > .pc-btn,
    .pc-page-head > a.pc-btn {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    .pc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pc-toolbar > .pc-search,
    .pc-toolbar > .pc-select {
        width: 100%;
        max-width: none;
    }

    .pc-toolbar > .pc-toolbar__hint {
        width: 100%;
    }

    .pc-toolbar__form {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        gap: 12px !important;
    }

    .pc-toolbar__form > * {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }

    .pc-toolbar__form .pc-input,
    .pc-toolbar__form .pc-btn,
    .pc-toolbar__form a.pc-btn {
        width: 100%;
        box-sizing: border-box;
    }

    .pc-toolbar__extras {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        gap: 12px !important;
    }

    .pc-toolbar__extras .pc-btn,
    .pc-toolbar__extras a.pc-btn {
        width: 100%;
        justify-content: center;
        order: 1;
    }

    .pc-toolbar__extras .pc-toolbar__hint {
        order: 0;
    }

    .pc-modal__head {
        padding: 16px 18px 12px;
    }

    .pc-modal__form {
        padding: 16px 18px 20px;
    }

    .pc-modal__dialog > .pc-modal__banner {
        padding-left: 18px;
        padding-right: 18px;
    }

    .pc-modal__actions:not(.pc-modal__actions--inline) {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }

    .pc-modal__actions:not(.pc-modal__actions--inline) .pc-btn,
    .pc-modal__actions:not(.pc-modal__actions--inline) .pc-btn--secondary {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }
}

/* Login (painel) */
.pc-auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.pc-auth {
    width: 100%;
    max-width: 400px;
}

.pc-auth__card {
    background: var(--pc-card);
    border-radius: var(--pc-radius);
    box-shadow: var(--pc-shadow);
    padding: 28px 26px 30px;
}

.pc-auth__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.pc-auth__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.pc-auth__subtitle {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: var(--pc-muted);
}

.pc-auth__hint {
    margin: 16px 0 0;
    padding: 12px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--pc-muted);
    background: #f8fafc;
    border: 1px solid var(--pc-border);
    border-radius: 8px;
}

.pc-auth__hint code {
    font-size: 0.75rem;
}

.pc-auth__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pc-auth__submit {
    width: 100%;
    margin-top: 4px;
}

.pc-sidebar__user {
    padding: 0 8px 12px;
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.35;
}

.pc-sidebar__role {
    display: block;
    margin-top: 2px;
    font-size: 0.6875rem;
    text-transform: lowercase;
    color: #64748b;
}

.pc-notif-templates__intro {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    color: var(--pc-muted);
    line-height: 1.5;
    max-width: 52rem;
}

.pc-notif-templates__list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pc-notif-template-card {
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius);
    background: #fff;
    box-shadow: none;
}

.pc-notif-template-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.pc-notif-template-card__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--pc-text);
}

.pc-notif-template-card__desc {
    margin: 0 0 0.35rem;
    font-size: 0.875rem;
    color: var(--pc-muted);
    line-height: 1.45;
}

.pc-notif-template-card__meta {
    margin: 0;
    font-size: 0.8125rem;
    color: #94a3b8;
}

.pc-notif-template-card__ativo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pc-text);
    cursor: pointer;
    white-space: nowrap;
}

.pc-notif-template-card__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.pc-notif-template-card__edit {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.pc-notif-vars__label {
    margin: 0 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pc-text);
}

.pc-notif-vars__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pc-notif-vars__chip {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    font-family: inherit;
    color: #334155;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pc-notif-vars__chip:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.pc-notif-template-card__save {
    padding-top: 0.25rem;
}

.pc-notif-template-card__preview {
    min-width: 0;
}

.pc-notif-preview__label {
    margin: 0 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pc-text);
}

.pc-notif-preview__box {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--pc-radius-sm);
}

.pc-notif-preview__subject {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: var(--pc-text);
    word-break: break-word;
}

.pc-notif-preview__body {
    margin: 0;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #475569;
    white-space: pre-wrap;
    word-break: break-word;
}

.pc-notif-preview__hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
}

@media (max-width: 960px) {
    .pc-notif-template-card__grid {
        grid-template-columns: 1fr;
    }
}
