/* =============================================================================
   CLINICA ESTETICA — Design System (layout IGUAL Serasa.com.br)
   Cores oficiais Serasa/Experian:
     Magenta #E80070 | Rosa claro #FF4F9A / #FFE0EE | Texto #1B1B32 | Branco #FFF
   SEM sidebar roxo escuro. Header magenta sólido + menu claro + fundo branco.
   ============================================================================= */

:root {
    /* --- Serasa (site) --- */
    --serasa-pink: #E80070;
    --serasa-pink-hover: #C4005F;
    --serasa-pink-soft: #FFE0EE;
    --serasa-pink-mid: #FF4F9A;
    --serasa-pink-wash: #FFF5F9;
    --serasa-navy: #1B1B32;
    --serasa-muted: #5C5C70;
    --serasa-line: #E8E8EF;
    --serasa-strip: #F7F7FA;

    --primary: #E80070;
    --primary-dark: #C4005F;
    --primary-light: #FF4F9A;
    --primary-soft: #FFE0EE;
    --primary-grad: #E80070; /* sólido Serasa — sem roxo */
    --secondary: #E80070;
    --secondary-soft: #FFE0EE;

    --bg: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --surface: #FFFFFF;
    --text: #1B1B32;
    --muted: #5C5C70;
    --border: #E8E8EF;
    --border-strong: #D4D4DE;

    --success: #00875A;
    --success-soft: #E3FCEF;
    --warning: #FF8B00;
    --warning-soft: #FFFAE6;
    --danger: #DE350B;
    --danger-soft: #FFEBE6;
    --info: #0052CC;
    --info-soft: #DEEBFF;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 999px;
    --shadow: 0 2px 8px rgba(27, 27, 50, .06);
    --shadow-md: 0 8px 24px rgba(27, 27, 50, .08);
    --shadow-lg: 0 16px 40px rgba(27, 27, 50, .12);
    --sidebar-w: 280px;
    --topbar-h: 64px;
    --header-h: 64px;
    --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: .18s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    height: 100%;
    background: var(--bg);
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    min-height: 100dvh;
    background: #FFFFFF;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    background: #FFFFFF;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3 { margin: 0 0 .5rem; font-weight: 800; letter-spacing: -.03em; color: var(--serasa-navy); }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
code {
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: .1rem .35rem;
    border-radius: 6px;
    font-size: .85em;
}

/* ========================= APP SHELL — Serasa (header pink + drawer claro) == */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #FFFFFF;
}

/* Faixa superior fina (site Serasa) */
.serasa-strip {
    background: var(--serasa-strip);
    border-bottom: 1px solid var(--border);
    font-size: .75rem;
    color: var(--muted);
    padding: .35rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.25rem;
}
.serasa-strip span { opacity: .85; }

/* Header magenta sólido — IGUAL Serasa */
.serasa-header {
    height: var(--header-h);
    background: var(--serasa-pink);
    color: #fff;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem 0 1.1rem;
    position: sticky;
    top: 0;
    z-index: 60;
    box-shadow: 0 2px 0 rgba(0,0,0,.04);
}

.serasa-header .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border: none;
    background: transparent;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    padding: .55rem .75rem;
    border-radius: 8px;
    min-height: 44px;
    font-family: inherit;
}
.serasa-header .menu-toggle:hover { background: rgba(255,255,255,.12); }

.serasa-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: #fff;
    text-decoration: none;
    min-width: 0;
    flex: 1;
}
.serasa-brand:hover { color: #fff; }
.serasa-brand-mark {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 10px;
    background: #fff;
    color: var(--serasa-pink);
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 1rem;
    flex-shrink: 0;
}
.serasa-brand strong {
    font-size: 1.05rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(42vw, 220px);
}
.serasa-brand small {
    display: block;
    font-size: .68rem;
    font-weight: 500;
    opacity: .9;
}

.serasa-header-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}
.serasa-header .user-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.28);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: .35rem .75rem .35rem .35rem;
    font-size: .8rem;
    font-weight: 650;
    max-width: 200px;
}
.serasa-header .user-pill .user-avatar {
    width: 28px;
    height: 28px;
    font-size: .75rem;
    background: #fff;
    color: var(--serasa-pink);
}
.serasa-header .user-pill span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.serasa-header .btn-header-out {
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.45);
    background: transparent;
    border-radius: var(--radius-pill);
    padding: .4rem .9rem;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}
.serasa-header .btn-header-out:hover {
    background: rgba(255,255,255,.14);
    color: #fff !important;
}

/* Drawer / menu lateral CLARO (não roxo) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(27, 27, 50, .35);
    z-index: 70;
    backdrop-filter: blur(2px);
}
.app-shell.nav-open .sidebar-backdrop { display: block; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(var(--sidebar-w), 88vw);
    height: 100vh;
    height: 100dvh;
    background: #FFFFFF;
    color: var(--serasa-navy);
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    z-index: 80;
    box-shadow: 8px 0 32px rgba(27, 27, 50, .12);
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .22s ease;
}
.app-shell.nav-open .sidebar { transform: translateX(0); }

.brand {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: 1rem 1.1rem;
    background: var(--serasa-pink);
    color: #fff;
}
.brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--serasa-pink);
    font-weight: 900;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: none;
}
.brand-text { min-width: 0; flex: 1; }
.brand strong {
    display: block;
    font-size: .95rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 11.5rem;
    color: #fff;
}
.brand small { color: rgba(255,255,255,.88); font-size: .72rem; display: block; }

.nav-section-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--serasa-muted);
    padding: .85rem 1.15rem .3rem;
    font-weight: 800;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
    padding: .35rem .65rem 1rem;
}

.nav-menu a {
    color: var(--serasa-navy);
    text-decoration: none;
    padding: .7rem .85rem;
    border-radius: 10px;
    font-size: .92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .65rem;
    transition: background var(--transition), color var(--transition);
    min-height: 44px;
}

.nav-menu a .nav-ico {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: .85;
    color: var(--serasa-pink);
}
.nav-menu a .nav-ico svg {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }
.agenda-loading {
    position: absolute;
    top: .65rem;
    right: 1rem;
    font-size: .78rem;
    font-weight: 700;
    color: #E80070;
    z-index: 2;
}
#agenda-panel { position: relative; }
.htmx-request#agenda-panel { opacity: .72; transition: opacity .15s; }

.nav-menu a:hover {
    background: var(--serasa-pink-soft);
    color: var(--serasa-pink);
}

.nav-menu a.active {
    background: var(--serasa-pink);
    color: #fff;
    box-shadow: none;
}
.nav-menu a.active .nav-ico { color: #fff; opacity: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: .9rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    background: var(--serasa-strip);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .25rem 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--serasa-pink);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    color: #fff;
    flex-shrink: 0;
}

.user-chip .meta { min-width: 0; }
.user-chip .meta strong {
    display: block;
    font-size: .82rem;
    color: var(--serasa-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-chip .meta span {
    display: block;
    font-size: .7rem;
    color: var(--muted);
    line-height: 1.2;
}

.btn-logout {
    color: var(--serasa-pink) !important;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 700;
    padding: .55rem .75rem;
    border-radius: 10px;
    border: 1px solid var(--serasa-pink);
    text-align: center;
    background: #fff;
    transition: background var(--transition);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-logout:hover { background: var(--serasa-pink-soft); color: var(--serasa-pink) !important; }

/* --- Main --- */
.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    background: #FFFFFF;
}

/* Sub-barra de contexto (título da página) — branca, como conteúdo Serasa */
.topbar {
    height: 52px;
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 0 1.35rem;
    border-bottom: 1px solid var(--border);
    background: #FFFFFF;
    position: sticky;
    top: var(--header-h);
    z-index: 30;
}

.topbar .menu-toggle { display: none; }

.topbar-title {
    font-weight: 700;
    color: var(--serasa-navy);
    font-size: .95rem;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--serasa-pink-soft);
    color: var(--serasa-pink);
    border: none;
    border-radius: var(--radius-pill);
    padding: .3rem .75rem;
    font-size: .75rem;
    font-weight: 700;
}

.content {
    padding: 1.5rem 1.5rem 2.5rem;
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: #FFFFFF;
    min-width: 0; /* evita overflow de grids em flex */
    overflow-x: clip;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Barra de loading global (HTMX + POST) */
.ce-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
}
.ce-loading.is-on { opacity: 1; }
.ce-loading-bar {
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, #E80070, #FF4DA6, #E80070);
    background-size: 200% 100%;
    border-radius: 0 2px 2px 0;
    animation: ceLoadSlide 1s ease-in-out infinite;
}
@keyframes ceLoadSlide {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 55%; }
    100% { transform: translateX(280%); width: 30%; }
}
.logout-form { display: inline; margin: 0; padding: 0; }
.logout-form .btn-header-out,
.logout-form .btn-logout {
    cursor: pointer;
    font: inherit;
    appearance: none;
}

.app-shell, .main {
    min-width: 0;
    max-width: 100%;
}

/* Chart.js — containers responsivos (altura fixa + canvas 100%) */
.chart-card {
    min-width: 0;
    overflow: hidden;
}
.chart-card-title {
    margin: 0 0 .85rem;
    font-size: 1rem;
    font-weight: 750;
    color: #1B1B32;
    line-height: 1.3;
}
.chart-box {
    position: relative;
    width: 100%;
    height: 240px;
    max-width: 100%;
}
.chart-box.chart-box-pie {
    height: 260px;
}
.chart-box canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
}
.chart-empty-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 120px;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
    background: #F7F7FA;
    border-radius: 12px;
}
.chart-grid > .card,
.kpi-grid > .stat-card {
    min-width: 0;
}
.dash-links .btn {
    justify-content: flex-start;
    width: 100%;
}

/* ========================= TYPOGRAPHY / PAGE ========================= */

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: .85rem;
    margin-bottom: 1.25rem;
}

.page-header .subtitle,
.page-header .muted {
    color: var(--muted);
    font-size: .9rem;
    margin: .15rem 0 0;
    font-weight: 400;
}

.muted { color: var(--muted); }
.text-right { text-align: right; }

/* ========================= CARDS ========================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.25rem;
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .85rem;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* KPI / Stat cards — Serasa (branco, borda rosa, sem roxo) */
.stat-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-left: 4px solid #E80070;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    margin-bottom: .55rem;
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-card .label {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: .15rem;
    letter-spacing: -.03em;
    color: var(--text);
    line-height: 1.15;
}

.stat-card .hint {
    font-size: .72rem;
    color: var(--muted);
    margin-top: .3rem;
}

.stat-card.pink { border-left-color: #E80070; }
.stat-card.pink .stat-icon { background: #FFE0EE; color: #E80070; }
.stat-card.green { border-left-color: #00875A; }
.stat-card.green .stat-icon { background: var(--success-soft); color: #00875A; }
.stat-card.blue { border-left-color: #0052CC; }
.stat-card.blue .stat-icon { background: var(--info-soft); color: #0052CC; }
.stat-card.orange { border-left-color: #FF8B00; }
.stat-card.orange .stat-icon { background: var(--warning-soft); color: #FF8B00; }
.stat-card.purple { border-left-color: #E80070; }
.stat-card.purple .stat-icon { background: #FFE0EE; color: #E80070; }

/* ========================= BUTTONS ========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: none;
    border-radius: 12px;
    padding: .58rem 1.05rem;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
    font-size: .9rem;
    font-family: inherit;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
    line-height: 1.2;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: #E80070;
    color: #fff !important;
    box-shadow: none;
    border: none;
}
.btn-primary:hover { background: #C4005F; color: #fff !important; }

.btn-secondary {
    background: #fff;
    color: #E80070 !important;
    border: 2px solid #E80070;
}
.btn-secondary:hover { background: #FFE0EE; border-color: #E80070; }

.btn-success { background: var(--success); color: #fff !important; }
.btn-whatsapp { background: #25d366; color: #fff !important; box-shadow: 0 4px 12px rgba(37, 211, 102, .3); }
.btn-whatsapp:hover { filter: brightness(1.05); color: #fff !important; }
.btn-danger { background: var(--danger-soft); color: #991b1b !important; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 9px; }
.btn-ghost {
    background: transparent;
    color: var(--primary) !important;
    border: 1px dashed var(--border-strong);
}

.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ========================= FORMS ========================= */

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

.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field.full { grid-column: 1 / -1; }
.form-field label {
    font-size: .82rem;
    font-weight: 650;
    color: #1B1B32;
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field select,
.form-field textarea,
.form-control-native,
.toolbar input[type="search"],
.toolbar input[type="text"],
.toolbar input[type="date"],
.toolbar select,
.search-input {
    border: 1.5px solid #E8E8EF;
    border-radius: 14px;
    padding: .7rem .9rem;
    font: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    min-height: 46px;
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.form-field select:focus,
.form-field textarea:focus,
.form-control-native:focus,
.toolbar input:focus,
.search-input:focus {
    outline: none;
    border-color: #E80070;
    box-shadow: 0 0 0 3px rgba(232, 0, 112, .15);
}

/* Switch / checkbox Serasa */
.switch {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: .75rem;
    cursor: pointer;
    user-select: none;
    min-height: 44px;
    font-weight: 600;
    color: #1B1B32 !important;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.switch-ui {
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: #E8E8EF;
    position: relative;
    flex-shrink: 0;
    transition: background .18s ease;
    box-shadow: inset 0 0 0 1px rgba(27,27,50,.06);
}
.switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(27,27,50,.18);
    transition: transform .18s ease;
}
.switch input:checked + .switch-ui {
    background: #E80070;
}
.switch input:checked + .switch-ui::after {
    transform: translateX(20px);
}
.switch input:focus-visible + .switch-ui {
    box-shadow: 0 0 0 3px rgba(232, 0, 112, .2);
}
.switch-text { font-size: .92rem; line-height: 1.3; }

/* Upload Serasa */
.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    border: 2px dashed #FFB3D4;
    border-radius: 16px;
    background: #FFF5F9;
    padding: 1.35rem 1rem;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s;
    min-height: 140px;
}
.file-drop:hover {
    border-color: #E80070;
    background: #FFE0EE;
}
.file-input-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
}
.file-drop-ico {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #E80070;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: .25rem;
}
.file-drop-title {
    font-weight: 800;
    color: #E80070;
    font-size: .95rem;
}
.file-drop-hint { font-size: .78rem; color: var(--muted); }
.file-name { font-size: .82rem; margin-top: .25rem; word-break: break-all; }

/* ========================= TABLES ========================= */

.card-soft {
    border-radius: 20px !important;
    border: 1px solid #EFEFF4 !important;
    box-shadow: 0 8px 28px rgba(27, 27, 50, .06) !important;
    overflow: hidden;
}
.card-table { padding: 0 !important; }
.card-table .pagination {
    padding: .85rem 1rem 1rem;
    margin: 0;
    border-top: 1px solid #F0F0F5;
}

.table-wrap {
    overflow: auto;
    border-radius: 0;
}

table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .9rem;
}

table.data th,
table.data td {
    text-align: left;
    padding: 1rem .9rem;
    border-bottom: 1px solid #F0F0F5;
    vertical-align: middle;
}

table.data th {
    color: #E80070;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 800;
    background: #FFF5F9;
    position: sticky;
    top: 0;
}

table.data th:first-child { border-radius: 0; padding-left: 1.15rem; }
table.data td:first-child { padding-left: 1.15rem; }
table.data th:last-child,
table.data td:last-child { padding-right: 1.15rem; }

table.data tbody tr {
    transition: background var(--transition);
}
table.data.data-clickable tbody tr.row-click {
    cursor: pointer;
}
table.data tbody tr:hover td {
    background: #FFF5F9;
}
table.data tbody tr:last-child td { border-bottom: none; }

.toolbar .search-input,
.toolbar input[type="search"] {
    border-radius: 999px;
    min-width: min(320px, 100%);
    border: 1.5px solid #E8E8EF;
}

/* ========================= BADGES ========================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .22rem .65rem;
    border-radius: var(--radius-pill);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .02em;
    background: #f3f4f6;
    color: #374151;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
}

.badge.agendado { background: #dbeafe; color: #1d4ed8; }
.badge.confirmado { background: #dcfce7; color: #166534; }
.badge.realizado { background: #F0E4EC; color: #E80070; }
.badge.cancelado { background: #fee2e2; color: #991b1b; }
.badge.naocompareceu { background: #ffedd5; color: #9a3412; }
.badge.pago { background: #dcfce7; color: #166534; }
.badge.pendente { background: #fef3c7; color: #92400e; }
.badge.parcial { background: #e0e7ff; color: #3730a3; }
.badge.ativo { background: #dcfce7; color: #166534; }
.badge.inativo { background: #f3f4f6; color: #6b7280; }

/* ========================= ALERTS / TOAST STYLE ========================= */

.alert {
    padding: .85rem 1.05rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: .9rem;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    animation: fadeSlideIn .25s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: #FFF5F9; color: #E80070; border-color: #F5C6D9; }

/* ========================= TOOLBAR / PAGINATION ========================= */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1rem;
    align-items: center;
}

.toolbar input[type="search"],
.toolbar input[type="text"],
.toolbar input[type="date"] {
    min-width: min(240px, 100%);
    width: auto;
}

.pagination {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ========================= AVATAR / EMPTY ========================= */

.avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #FFE4F0, #F8E8F5);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(119, 18, 123, .12);
    color: #C1188B;
    /* evita “retângulo preto” se a imagem falhar no carregamento */
    background-color: #FFE4F0;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}

.empty-state .empty-ico {
    width: 64px;
    height: 64px;
    margin: 0 auto .85rem;
    border-radius: 20px;
    background: var(--primary-soft);
    display: grid;
    place-items: center;
    font-size: 1.6rem;
    color: var(--primary);
}

/* ========================= CALENDAR ========================= */

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .45rem;
}

.calendar-day {
    min-height: 96px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .45rem;
    background: #fff;
    font-size: .78rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.calendar-day:hover {
    border-color: #FF8FBF;
    box-shadow: var(--shadow);
}

.calendar-day.muted-day { opacity: .45; }
.calendar-day.today {
    border-color: #FF5C9A;
    box-shadow: inset 0 0 0 1px #FF8FBF, var(--shadow);
    background: #FFF0F6;
}

.calendar-day .day-num { font-weight: 750; margin-bottom: .25rem; color: #E80070; }

.calendar-event {
    background: linear-gradient(90deg, #FFE4F0, #FFF0F8);
    color: #B8005A;
    border-radius: 8px;
    padding: .2rem .35rem;
    margin-top: .22rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    border: 1px solid #FFC2DC;
    transition: transform var(--transition);
}

.calendar-event:hover { transform: scale(1.02); }

.week-col {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    min-height: 220px;
    padding: .65rem;
    box-shadow: var(--shadow);
}

/* ========================= LOGIN (Serasa) ========================= */

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    background: #FFFFFF;
    position: relative;
    overflow-x: hidden;
    box-sizing: border-box;
}
.login-page::before {
    content: "";
    position: absolute;
    width: 55%;
    height: 100%;
    right: 0;
    top: 0;
    background:
        radial-gradient(circle at 70% 30%, #FF4F9A 0%, transparent 45%),
        radial-gradient(circle at 90% 80%, #E80070 0%, transparent 40%),
        #FFE0EE;
    opacity: .55;
    pointer-events: none;
    z-index: 0;
}

.login-wrap {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(27, 27, 50, .1);
    border: 1px solid #E8E8EF;
    position: relative;
    z-index: 1;
}

.login-hero {
    background: #E80070;
    color: #fff;
    padding: 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 480px;
    position: relative;
    overflow: hidden;
}

.login-hero::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    right: -40px;
    bottom: -40px;
}

.login-hero h2 {
    color: #fff;
    font-size: 1.55rem;
    margin: .75rem 0 .5rem;
    position: relative;
    z-index: 1;
}

.login-hero p {
    color: rgba(255,255,255,.9);
    font-size: .92rem;
    position: relative;
    z-index: 1;
}

.login-hero .hero-badge {
    display: inline-flex;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--radius-pill);
    padding: .3rem .75rem;
    font-size: .75rem;
    font-weight: 650;
    width: fit-content;
}

.login-hero ul {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    position: relative;
    z-index: 1;
}

.login-hero li {
    padding: .4rem 0;
    font-size: .88rem;
    opacity: .95;
}

.login-hero li::before {
    content: "✓ ";
    font-weight: 800;
}

.login-card {
    padding: 2rem 1.85rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card h1 {
    margin-bottom: .2rem;
    font-size: 1.45rem;
}

/*
  Blazor foca o primeiro <h1> após navegar (acessibilidade).
  O navegador desenha um retângulo AZUL feio em volta de "Administrador".
  Removemos o outline nativo e usamos um anel suave da marca só se precisar.
*/
.login-card h1:focus,
.login-card h1:focus-visible,
.page-header h1:focus,
.page-header h1:focus-visible,
.login-page h1:focus,
.login-page h1:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Se quiser indicar foco por teclado, descomente:
.login-card h1:focus-visible {
    outline: 2px solid rgba(232, 0, 112, .35);
    outline-offset: 4px;
    border-radius: 8px;
}
*/

.login-card .subtitle {
    color: var(--muted);
    margin-bottom: 1.35rem;
    font-size: .92rem;
}

.login-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    margin-bottom: 1.15rem;
    background: var(--bg);
    padding: .3rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Três perfis: Admin | Funcionário | Paciente */
.login-switch.login-switch-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.login-switch a {
    text-align: center;
    padding: .55rem .35rem;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 650;
    color: var(--muted);
    transition: all var(--transition);
    text-decoration: none;
}

.login-switch a.active,
.login-switch a:hover {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: var(--shadow);
}

@media (max-width: 420px) {
    .login-switch.login-switch-3 {
        grid-template-columns: 1fr;
    }
}

/* ========================= RESPONSIVE ========================= */

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-box { height: 220px; }
    .chart-box.chart-box-pie { height: 240px; }
}

@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .content { padding: .85rem .85rem 2rem; }
    .serasa-header .user-pill span { display: none; }
    .serasa-header .user-pill { padding: .3rem; }
    .serasa-strip { display: none; }

    .login-wrap { grid-template-columns: 1fr; }
    .login-hero { min-height: auto; padding: 1.5rem; }
    .login-hero ul { display: none; }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: .65rem;
    }
    .page-header .actions,
    .page-header .actions-wrap {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: .45rem;
    }
    .page-header .actions .btn,
    .page-header .actions-wrap .btn {
        flex: 1 1 auto;
        min-width: calc(50% - .3rem);
        justify-content: center;
        text-align: center;
    }
    .card { padding: 1rem; }
    .actions-wrap { width: 100%; }
    .dash-links { grid-template-columns: 1fr !important; }
    .card-header-row {
        flex-wrap: wrap;
        gap: .5rem;
    }
}

@media (max-width: 720px) {
    /* KPIs: 2 colunas no mobile, não 1 (melhor densidade) */
    .kpi-grid.grid-4,
    .kpi-grid.grid-3,
    .grid.grid-4.kpi-grid,
    .grid.grid-3.kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: .55rem;
    }
    .chart-box {
        height: 200px;
    }
    .chart-box.chart-box-pie {
        height: 220px;
    }
    .chart-card-title {
        font-size: .92rem;
        margin-bottom: .65rem;
    }
    .calendar-toolbar {
        flex-wrap: wrap;
        gap: .4rem;
    }
    .calendar-toolbar .cal-title {
        flex: 1 1 100%;
        order: -1;
        text-align: center;
        min-width: 0;
    }
    .modo-btns {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: .35rem;
    }
    .modo-btns .btn {
        flex: 1;
    }
    .ag-layout {
        grid-template-columns: 1fr !important;
    }
    .ag-hero {
        flex-direction: column;
        align-items: stretch !important;
    }
    .detail-grid,
    .ag-info-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 560px) {
    .topbar { padding: 0 .85rem; }
    .stat-card {
        padding: .7rem .75rem;
    }
    .stat-card .value { font-size: 1.2rem; word-break: break-word; }
    .stat-card .label { font-size: .68rem; }
    .stat-card .stat-icon {
        width: 1.6rem;
        height: 1.6rem;
        font-size: .75rem;
    }
    .calendar-grid { gap: .25rem; }
    .calendar-day { min-height: 72px; padding: .25rem; font-size: .7rem; }
    .serasa-brand small { display: none; }
    .content { padding: .7rem .7rem 1.75rem; }
    .page-header h1 { font-size: 1.2rem; word-break: break-word; }
    .page-header .actions .btn,
    .page-header .actions-wrap .btn {
        min-width: 100%;
        font-size: .88rem;
    }
    .chart-box { height: 180px; }
    .chart-box.chart-box-pie { height: 200px; }
    /* em telas bem estreitas, KPI 1 col se necessário */
    .kpi-grid.grid-4,
    .grid.grid-4.kpi-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Login full width touch */
    .login-card {
        padding: 1.1rem 1rem 1.35rem;
        border-radius: 16px;
    }
    .login-card h1 { font-size: 1.25rem; }
    .login-card .btn,
    .login-card button[type="submit"] {
        width: 100%;
        min-height: 44px;
    }
    .login-switch a {
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Financeiro / grids de ação */
    .grid.grid-3,
    .ag-action-stack {
        gap: .5rem;
    }
    .form-field input,
    .form-field select,
    .form-field textarea {
        max-width: 100%;
        font-size: 16px; /* evita zoom iOS */
    }
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: .4rem;
    }
    .view-modal-panel {
        width: min(100%, 100vw - 1.2rem) !important;
        max-height: min(90vh, 640px);
        margin: .5rem;
    }
    .recibo {
        padding: .85rem !important;
    }
    .recibo-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 380px) {
    .kpi-grid.grid-4,
    .kpi-grid.grid-3,
    .grid.grid-4.kpi-grid,
    .grid.grid-3.kpi-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile final — touch e overflow */
@media (max-width: 720px) {
    .week-grid {
        display: flex;
        overflow-x: auto;
        gap: .5rem;
        -webkit-overflow-scrolling: touch;
        padding-bottom: .35rem;
    }
    .week-col {
        min-width: 8.5rem;
        flex: 0 0 auto;
    }
    .btn, .btn-sm, .m-card, .nav-menu a {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 40px;
        padding-top: .45rem;
        padding-bottom: .45rem;
    }
    .serasa-header {
        padding-left: max(.75rem, env(safe-area-inset-left));
        padding-right: max(.75rem, env(safe-area-inset-right));
    }
    .content {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
    .sidebar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ========================= BLazor error UI ========================= */

#blazor-error-ui {
    background: #FFE4F0;
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(119, 18, 123, .15);
    display: none;
    left: 0;
    padding: .75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #B8005A;
    border-top: 1px solid #FFC2DC;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .55rem;
}

#blazor-error-ui .reload { font-weight: 700; }

/* ========================= UX-4 MODAL ========================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 5, 32, .48);
    backdrop-filter: blur(3px);
    z-index: 80;
    animation: fadeIn .15s ease;
}

.modal-panel {
    position: fixed;
    z-index: 90;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 2rem));
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem 1.35rem 1.25rem;
    text-align: center;
    animation: modalPop .18s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPop {
    from { opacity: 0; transform: translate(-50%, -46%) scale(.96); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    margin: 0 auto .85rem;
    font-size: 1.4rem;
    font-weight: 800;
}

.modal-icon.warn {
    background: var(--warning-soft);
    color: var(--warning);
}

.modal-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.modal-title {
    font-size: 1.15rem;
    margin: 0 0 .45rem;
}

.modal-msg {
    color: var(--muted);
    font-size: .92rem;
    margin: 0 0 1.15rem;
    line-height: 1.45;
}

.modal-actions {
    display: flex;
    gap: .55rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions .btn { min-width: 110px; }

/* Lista de detalhes (agendamento, etc.) */
.detail-list {
    display: grid;
    gap: .75rem;
}

.detail-list > div {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
}

.detail-list > div:last-child { border-bottom: none; padding-bottom: 0; }
.detail-list .muted { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.detail-list strong { font-size: .95rem; font-weight: 650; }

/* Toast / feedback flutuante */
.toast-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: .75rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    font-size: .9rem;
    font-weight: 600;
    animation: fadeSlideIn .25s ease;
    border: 1px solid transparent;
}

.toast.success {
    background: var(--success-soft);
    color: #065f46;
    border-color: #a7f3d0;
}

.toast.danger {
    background: var(--danger-soft);
    color: #991b1b;
    border-color: #fecaca;
}

/* Skeleton loading leve */
.skeleton {
    background: linear-gradient(90deg, #FCE8F2 25%, #FFF5F9 50%, #FCE8F2 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 10px;
    min-height: 1rem;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Preview da mensagem WhatsApp (configurações) */
.wa-preview {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: .9rem;
    line-height: 1.45;
    color: #14532d;
    margin: 0;
    max-height: 420px;
    overflow: auto;
}

/* ---------- Recibo imprimível (P4 — não é NF-e) ---------- */
.recibo {
    max-width: 720px;
    margin: 0 auto;
}
.recibo-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.recibo-clinica {
    font-size: 1.25rem;
    color: #B8005A;
}
.recibo-num {
    text-align: right;
}
.recibo-hr {
    border: none;
    border-top: 1px dashed #F5C6D9;
    margin: 1rem 0;
}
.recibo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem 1.25rem;
}
.recibo-grid > div {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.recibo-valores {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #FFF5F9;
    border-radius: 12px;
}
.recibo-valores > div {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.recibo-destaque {
    font-size: 1.35rem;
    color: #B8005A;
}
.recibo-rodape {
    margin-top: 1.5rem;
    font-size: .85rem;
    line-height: 1.45;
}

/* ---------- Fotos Antes/Depois do prontuário ---------- */
.prontuario-timeline-item {
    border-left: 3px solid #E80070;
    padding-left: 1rem;
    margin: 1rem 0;
}
.foto-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}
.foto-sessao-card {
    border: 2px solid #FF8FBF;
    background: linear-gradient(180deg, #FFF0F6 0%, #fff 48%);
}
.foto-upload-box {
    border: 1px dashed #F5C6D9;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: #fff;
}
.foto-upload-title {
    display: inline-block;
    font-weight: 800;
    letter-spacing: .04em;
    font-size: .8rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    background: #FFE4F0;
    color: #B8005A;
}
.foto-upload-title.depois {
    background: #F0E4EC;
    color: #E80070;
}
.foto-upload-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
}
.foto-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.foto-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-top: .85rem;
}
.foto-thumb {
    margin: 0;
    width: 100px;
}
.foto-thumb img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #FCE8F2;
    display: block;
}
.foto-thumb figcaption {
    text-align: center;
    font-size: .72rem;
    color: #6b7280;
    margin-top: .25rem;
}

.foto-remove {
    display: block;
    width: 100%;
    margin-top: .2rem;
    font-size: .72rem !important;
    padding: .2rem .35rem !important;
    color: var(--danger) !important;
}

.foto-perfil-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
    margin-top: .65rem;
}

.foto-perfil-preview {
    max-width: 120px;
    max-height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border-strong);
    background: #FFE4F0;
}

.actions-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

/* ========== Gráficos (SVG + ranking) ========== */
.chart-empty {
    margin: 0;
    padding: 1.25rem .25rem;
    text-align: center;
    color: var(--muted);
    font-size: .88rem;
}

.chart-svg-wrap {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.chart-empty-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    color: var(--muted);
    font-size: .85rem;
    pointer-events: none;
    z-index: 1;
}

.chart-svg {
    width: 100%;
    height: auto;
    max-height: 220px;
    display: block;
}

.chart-grid {
    stroke: #EEF2F7;
    stroke-width: 1;
}

.chart-axis {
    stroke: #D1D5DB;
    stroke-width: 1.25;
}

.chart-bar {
    transition: opacity .15s ease;
}
.chart-bar:hover { opacity: .88; }

.chart-val {
    fill: var(--text);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font);
}

.chart-lbl {
    fill: var(--muted);
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font);
}

/* Ranking horizontal (status / top) */
.chart-rank {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: .15rem 0;
}

.chart-rank-row { display: flex; flex-direction: column; gap: .3rem; }

.chart-rank-head {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
}

.chart-rank-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-rank-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-rank-meta {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
    white-space: nowrap;
}

.chart-rank-track {
    height: 8px;
    background: #F1F5F9;
    border-radius: 999px;
    overflow: hidden;
}

.chart-rank-fill {
    height: 100%;
    border-radius: 999px;
    min-width: 0;
    transition: width .3s ease;
}



/* Tabelas em telas estreitas: cartões legíveis */
@media (max-width: 720px) {
    .table-wrap {
        margin: 0;
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Preferir cards mobile; se tabela desktop aparecer, permite scroll sem estourar body */
    table.data {
        min-width: 0;
        width: 100%;
        font-size: .84rem;
    }

    .table-wrap.desktop-only table.data {
        min-width: 560px;
    }

    table.data th,
    table.data td {
        padding: .65rem .5rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

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

    .toolbar input[type="text"],
    .toolbar input[type="search"],
    .toolbar input[type="date"],
    .toolbar select {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .calendar-event {
        font-size: .65rem;
        padding: .12rem .25rem;
    }

    .btn-block,
    .ag-action-stack .btn,
    .ag-action-stack form .btn {
        width: 100%;
    }
}

@media print {
    .no-print,
    .sidebar,
    .sidebar-backdrop,
    .topbar,
    .app-shell > .sidebar,
    #blazor-error-ui {
        display: none !important;
    }
    .app-shell,
    .main,
    .content {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
        background: #fff !important;
    }
    .recibo.card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    body {
        background: #fff !important;
    }
}

/* ========== Migracao UI — motion + HTMX ========== */
.animate-fade-in {
    animation: ceFadeIn .22s ease both;
}
.animate-slide-down {
    animation: ceSlideDown .22s ease both;
}
@keyframes ceFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
@keyframes ceSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in, .animate-slide-down, .stat-card, .btn, .modal-panel {
        animation: none !important;
        transition: none !important;
    }
}
.toast-inline { margin-bottom: 1rem; }
.menu-toggle {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}
.btn, .nav-menu a, .btn-logout {
    min-height: 44px;
}
.nav-menu a {
    min-height: 44px;
}
/* HTMX indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

/* ========== Lista mobile (Fase 1) ========== */
.avatar-letter {
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #E80070;
    background: #FFE0EE !important;
}
.check-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    cursor: pointer;
}
.desktop-only { display: block !important; }
.mobile-only { display: none !important; }
.mobile-cards { display: flex; flex-direction: column; gap: .65rem; }
.table-wrap.desktop-only { overflow: auto; }
.m-card {
    display: block;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.m-card:hover { border-color: #E80070; box-shadow: var(--shadow); color: inherit; }
.m-card-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.m-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.m-card-body strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 720px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
    .mobile-cards.mobile-only { display: flex !important; }
}

/* ========== Modal visualizar (lista) ========== */
.view-modal-root {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.view-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(27, 27, 50, .4);
    backdrop-filter: blur(3px);
}
.view-modal {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(27, 27, 50, .18);
    overflow: hidden;
    animation: ceSlideDown .2s ease;
}
.view-modal-head {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.15rem 1.15rem 1rem;
    background: linear-gradient(180deg, #FFF5F9 0%, #fff 100%);
    border-bottom: 1px solid #F0F0F5;
}
.view-modal-avatar,
.view-modal-avatar-wrap .avatar-letter {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}
.view-modal-avatar-wrap .avatar-letter {
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: #E80070;
    background: #FFE0EE;
}
.view-modal-titles { flex: 1; min-width: 0; }
.view-modal-titles h2 {
    margin: 0 0 .35rem;
    font-size: 1.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.view-modal-close {
    border: none;
    background: #F5F5F8;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: #5C5C70;
}
.view-modal-close:hover { background: #FFE0EE; color: #E80070; }
.view-modal-body { padding: 1rem 1.15rem 1.15rem; }
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}
.detail-grid > div {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .75rem;
    background: #F7F7FA;
    border-radius: 12px;
}
.detail-grid .muted { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.detail-grid strong { font-size: .92rem; word-break: break-word; }
.view-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: .55rem;
    padding: 0 1.15rem 1.15rem;
    flex-wrap: wrap;
}
.m-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .55rem;
    padding-top: .45rem;
    border-top: 1px solid #EEEFF3;
}
.m-card-btn {
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    border: 1px solid #EFEFF4;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(27,27,50,.04);
}
.m-card-btn:hover { border-color: #E80070; }
.btn-sm { min-height: 36px !important; border-radius: 10px; }
.btn-secondary { border-radius: 12px; }
.btn-primary { border-radius: 12px; }
.foto-perfil-preview {
    border-radius: 16px !important;
    border: 2px solid #FFE0EE !important;
}

/* WhatsApp: ícone minúsculo na frente do número (mesma linha) */
.tel-line {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: .4rem;
    margin: 0;
    padding: 0;
    line-height: 1.25;
    max-width: 100%;
}
.tel-line .tel-num {
    font-size: .92rem;
    font-weight: 650;
    color: #1B1B32;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
a.wa-ico {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50%;
    background: #25D366 !important;
    color: #fff !important;
    text-decoration: none !important;
    box-shadow: none !important;
    line-height: 0 !important;
    vertical-align: middle;
    transition: filter .12s;
}
a.wa-ico:hover {
    filter: brightness(1.1);
    color: #fff !important;
    transform: none;
}
a.wa-ico svg {
    display: block;
    width: 10px !important;
    height: 10px !important;
    flex-shrink: 0;
}
/* legado */
.tel-with-wa { display: inline-flex; align-items: center; gap: .4rem; }
.btn-wa, .btn-wa-sm { display: none; }
.tel-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Agenda Fase 2 */
.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    padding: 1rem 1rem .5rem;
}
.cal-title {
    min-width: 10rem;
    text-align: center;
    text-transform: capitalize;
    color: #1B1B32;
}
.modo-btns { margin-left: auto; }
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .5rem;
    padding: 0 1rem 1rem;
}
.calendar-event {
    display: block;
    text-decoration: none;
    color: inherit;
}
.calendar-event:hover { color: inherit; filter: brightness(0.98); }
.desktop-only-inline { display: inline-flex !important; }
@media (max-width: 720px) {
    .desktop-only-inline { display: none !important; }
    .week-grid { grid-template-columns: 1fr; }
}

/* ========== Detalhe agendamento (Serasa) ========== */
.ag-detail { max-width: 960px; margin: 0 auto; }
.ag-detail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}
.ag-back {
    font-weight: 700;
    color: #E80070;
    text-decoration: none;
    font-size: .92rem;
}
.ag-back:hover { color: #C4005F; }

.ag-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #FFF5F9 0%, #FFFFFF 55%);
    border: 1px solid #FFE0EE;
    border-radius: 20px;
}
.ag-hero-kicker {
    margin: 0 0 .25rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: capitalize;
    color: #5C5C70;
}
.ag-hero-title {
    margin: 0 0 .35rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: #1B1B32;
}
.ag-hero-sub {
    margin: 0 0 .2rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1B1B32;
}
.ag-hero-meta {
    margin: 0;
    font-size: .88rem;
    color: #5C5C70;
}
.ag-hero-side { text-align: right; }
.ag-valor {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    margin-bottom: .5rem;
}
.ag-valor strong {
    font-size: 1.35rem;
    font-weight: 800;
    color: #E80070;
}

.ag-layout {
    display: grid;
    grid-template-columns: 1.35fr .95fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 860px) {
    .ag-layout { grid-template-columns: 1fr; }
    .ag-hero-side { text-align: left; width: 100%; }
}

.ag-section-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 800;
    color: #1B1B32;
}
.ag-section-title.sm {
    font-size: .88rem;
    margin-bottom: .65rem;
    color: #5C5C70;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ag-info { padding: 1.2rem 1.25rem 1.35rem; }
.ag-info-grid {
    grid-template-columns: 1fr 1fr;
}
.ag-info-grid .full { grid-column: 1 / -1; }
.ag-info-grid .link-soft {
    font-size: .78rem;
    font-weight: 700;
    color: #E80070;
    margin-top: .25rem;
}

.ag-actions { padding: 1.2rem 1.25rem 1.35rem; }
.ag-action-stack {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.ag-action-stack form { margin: 0; }
.btn-block {
    width: 100%;
    justify-content: center;
    min-height: 46px;
    border-radius: 12px;
}
.ag-divider {
    height: 1px;
    background: #F0F0F5;
    margin: 1.1rem 0;
}
.ag-status-form .form-field { margin-bottom: .75rem; }
.ag-hint {
    margin: 1rem 0 0;
    font-size: .78rem;
    line-height: 1.45;
    color: #5C5C70;
}

.toast-inline {
    border-radius: 14px !important;
    margin: 0 auto 1rem;
    max-width: 960px;
}
.alert-success.toast-inline {
    background: #E3FCEF;
    border: 1px solid #ABF5D1;
    color: #006644;
    font-weight: 650;
}
