/**
 * Pet & Buddy - Estilos SaaS Premium
 * Diseño basado en la identidad de marca Pet & Buddy y mockup comercial
 * Desarrollado por VisibleAhora
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --pyb-primary: #0F3A5D;
    --pyb-primary-dark: #0A2540;
    --pyb-primary-light: #E0F2FE;
    --pyb-primary-border: #BAE6FD;
    --pyb-secondary: #00A896;
    --pyb-accent: #0284C7;
    --pyb-bg: #EDF3F8;
    --pyb-card-bg: #FFFFFF;
    --pyb-border: #E2E8F0;
    --pyb-text-main: #0F172A;
    --pyb-text-muted: #64748B;
    --pyb-sidebar-width: 260px;
    --pyb-sidebar-collapsed-width: 78px;
    --pyb-transition-speed: 0.22s;
    --pyb-radius-sm: 8px;
    --pyb-radius-md: 14px;
    --pyb-radius-lg: 20px;
    --pyb-shadow: 0 4px 16px rgba(15, 35, 60, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    --pyb-shadow-hover: 0 10px 24px rgba(15, 58, 93, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--pyb-bg);
    color: var(--pyb-text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =====================================================================
   LAYOUT PRINCIPAL (SIDEBAR + TOPBAR + MAIN)
   ===================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow-x: clip;
    max-width: 100%;
}

.sidebar {
    width: var(--pyb-sidebar-width);
    background: #FFFFFF;
    border-right: 1px solid var(--pyb-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: width var(--pyb-transition-speed) cubic-bezier(0.4, 0, 0.2, 1),
                transform var(--pyb-transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* 1. ZONA SUPERIOR FIJA */
.sidebar-header {
    height: 70px;
    padding: 0 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--pyb-border);
    flex-shrink: 0;
    background: #FFFFFF;
    transition: padding var(--pyb-transition-speed) ease-in-out,
                height var(--pyb-transition-speed) ease-in-out;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--pyb-text-main);
    overflow: hidden;
    min-width: 0;
}

.sidebar-logo {
    height: 40px;
    width: auto;
    max-width: 42px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform var(--pyb-transition-speed) ease-in-out;
}

.sidebar-brand-text {
    font-weight: 800;
    font-size: 1.18rem;
    color: var(--pyb-primary);
    line-height: 1.15;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--pyb-transition-speed) ease-in-out;
}

.sidebar-brand-text small {
    display: block;
    font-size: 0.68rem;
    color: var(--pyb-text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.sidebar-collapse-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--pyb-border);
    background: #F8FAFC;
    color: #64748B;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.15s ease-in-out;
}

.sidebar-collapse-btn:hover {
    background: var(--pyb-primary-light);
    color: var(--pyb-primary);
    border-color: var(--pyb-primary-border);
}

.sidebar-collapse-btn i {
    font-size: 0.92rem;
    transition: transform var(--pyb-transition-speed) ease-in-out;
}

.sidebar-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--pyb-border);
    background: #F8FAFC;
    color: #64748B;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

/* 2. ZONA CENTRAL DESPLAZABLE */
.sidebar-nav {
    padding: 0.75rem 0.65rem;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #CBD5E1;
}

.sidebar-nav .nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94A3B8;
    padding: 0.65rem 0.75rem 0.25rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: opacity var(--pyb-transition-speed) ease-in-out;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out, padding var(--pyb-transition-speed) ease-in-out;
    position: relative;
    white-space: nowrap;
}

.sidebar-nav .nav-link i:first-child {
    font-size: 1.18rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--pyb-transition-speed) ease-in-out;
}

.sidebar-nav .nav-link:hover {
    background-color: #F0F9FF;
    color: #0284C7;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
}

.sidebar-nav .nav-link.active i {
    color: #FFFFFF !important;
}

.sidebar-nav .nav-link .nav-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35) !important;
    border-radius: 20px;
    padding: 0.2rem 0.55rem;
    transition: all var(--pyb-transition-speed) ease-in-out;
}

/* 3. ZONA INFERIOR FIJA */
.sidebar-user {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--pyb-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #FAFAFC;
    flex-shrink: 0;
    transition: padding var(--pyb-transition-speed) ease-in-out;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex-grow: 1;
    overflow: hidden;
    min-width: 0;
    transition: opacity var(--pyb-transition-speed) ease-in-out;
}

.sidebar-user-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--pyb-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.74rem;
    color: var(--pyb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-logout {
    color: #94A3B8;
    font-size: 1.15rem;
    padding: 0.25rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
    flex-shrink: 0;
}

.sidebar-user-logout:hover {
    color: #EF4444;
}

/* =====================================================================
   SIDEBAR CONTRAÍDO (COLLAPSED) — ESCRITORIO Y TABLET
   ===================================================================== */
html.sidebar-collapsed .sidebar,
body.sidebar-collapsed .sidebar {
    width: var(--pyb-sidebar-collapsed-width);
}

html.sidebar-collapsed .main-wrapper,
body.sidebar-collapsed .main-wrapper {
    margin-left: var(--pyb-sidebar-collapsed-width);
}

html.sidebar-collapsed .sidebar-header,
body.sidebar-collapsed .sidebar-header {
    padding: 0.65rem 0.5rem;
    justify-content: center;
    flex-direction: column;
    height: 82px;
    gap: 0.35rem;
}

html.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    width: 100%;
}

html.sidebar-collapsed .sidebar-logo,
body.sidebar-collapsed .sidebar-logo {
    height: 32px;
    max-width: 32px;
}

html.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    display: none;
}

html.sidebar-collapsed .sidebar-collapse-btn,
body.sidebar-collapsed .sidebar-collapse-btn {
    width: 26px;
    height: 20px;
    border-radius: 6px;
}

html.sidebar-collapsed .sidebar-collapse-btn i,
body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

html.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .sidebar-nav {
    padding: 0.5rem 0.4rem;
}

html.sidebar-collapsed .sidebar-nav .nav-label,
body.sidebar-collapsed .sidebar-nav .nav-label {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0.5rem 0.4rem;
    border-top: 1px solid var(--pyb-border);
    overflow: hidden;
}

html.sidebar-collapsed .sidebar-nav .nav-link,
body.sidebar-collapsed .sidebar-nav .nav-link {
    padding: 0.7rem 0;
    justify-content: center;
    border-radius: 10px;
}

html.sidebar-collapsed .sidebar-nav .nav-link i:first-child,
body.sidebar-collapsed .sidebar-nav .nav-link i:first-child {
    margin: 0;
}

html.sidebar-collapsed .sidebar-nav .nav-link span,
body.sidebar-collapsed .sidebar-nav .nav-link span {
    display: none;
    opacity: 0;
}

html.sidebar-collapsed .sidebar-nav .nav-external-icon,
body.sidebar-collapsed .sidebar-nav .nav-external-icon {
    display: none;
}

html.sidebar-collapsed .sidebar-nav .nav-link .nav-badge,
body.sidebar-collapsed .sidebar-nav .nav-link .nav-badge {
    position: absolute;
    top: 5px;
    right: 8px;
    margin: 0;
    font-size: 0.65rem;
    padding: 0.15em 0.4em;
    min-width: 16px;
}

html.sidebar-collapsed .sidebar-user,
body.sidebar-collapsed .sidebar-user {
    padding: 0.75rem 0.4rem;
    flex-direction: column;
    justify-content: center;
    gap: 0.4rem;
    height: auto;
}

html.sidebar-collapsed .sidebar-user-avatar,
body.sidebar-collapsed .sidebar-user-avatar {
    width: 36px;
    height: 36px;
}

html.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .sidebar-user-info {
    display: none;
    opacity: 0;
}

html.sidebar-collapsed .sidebar-user-logout,
body.sidebar-collapsed .sidebar-user-logout {
    font-size: 1rem;
}

/* =====================================================================
   MAIN CONTENT & TOPBAR
   ===================================================================== */
.main-wrapper {
    flex-grow: 1;
    margin-left: var(--pyb-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
    transition: margin-left var(--pyb-transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    height: 70px;
    background: #FFFFFF;
    border-bottom: 2px solid #E2E8F0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 0.75rem;
    box-shadow: 0 2px 12px rgba(15, 35, 60, 0.04);
}

.topbar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #0284C7 0%, #00A896 50%, #3B82F6 100%);
    opacity: 0.9;
}

.topbar-search {
    position: relative;
    width: clamp(160px, 24vw, 360px);
    max-width: 100%;
}

.topbar-search input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    border-radius: 20px;
    border: 1.5px solid #CBD5E1;
    background-color: #F1F5F9;
    font-size: 0.88rem;
    transition: all 0.2s;
}

.topbar-search input:focus {
    background: #FFFFFF;
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
    outline: none;
}

.topbar-search i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.topbar-actions .btn-outline-primary {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(0, 168, 150, 0.12) 100%);
    border: 1.5px solid #0284C7 !important;
    color: #0284C7 !important;
    font-weight: 700;
    transition: all 0.2s;
}

.topbar-actions .btn-outline-primary:hover {
    background: linear-gradient(135deg, #0284C7 0%, #00A896 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0284C7;
    background: #F0F9FF;
    border: 1.5px solid #BAE6FD;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
    background: linear-gradient(135deg, #0284C7 0%, #00A896 100%);
    color: #FFFFFF;
    border-color: #0284C7;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transform: scale(1.05);
}

.btn-icon .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #EF4444;
    border: 2px solid #FFFFFF;
}

.content-body {
    padding: 1.75rem;
    flex-grow: 1;
}

/* =====================================================================
   CARDS & STATS (VIBRANT DENTAL SAAS REFRESH)
   ===================================================================== */
.stat-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid #E2E8F0;
    box-shadow: 0 4px 16px rgba(15, 35, 60, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 58, 93, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    border-color: #CBD5E1;
}

/* Borde superior de acento con gradientes clínicos vivos */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0284C7, #00A896);
}

.row.mb-4 > div:nth-child(1) .stat-card::before { background: linear-gradient(90deg, #0284C7, #38BDF8); }
.row.mb-4 > div:nth-child(2) .stat-card::before { background: linear-gradient(90deg, #059669, #34D399); }
.row.mb-4 > div:nth-child(3) .stat-card::before { background: linear-gradient(90deg, #D97706, #FBBF24); }
.row.mb-4 > div:nth-child(4) .stat-card::before { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.row.mb-4 > div:nth-child(5) .stat-card::before { background: linear-gradient(90deg, #0D9488, #2DD4BF); }

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover .stat-icon {
    transform: scale(1.08);
}

.stat-icon.primary { 
    background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%); 
    color: #0284C7; 
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.2);
}
.stat-icon.success { 
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%); 
    color: #059669; 
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.2);
}
.stat-icon.warning { 
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%); 
    color: #D97706; 
    box-shadow: 0 3px 10px rgba(217, 119, 6, 0.2);
}
.stat-icon.danger  { 
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%); 
    color: #DC2626; 
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.2);
}
.stat-icon.purple  { 
    background: linear-gradient(135deg, #CCFBF1 0%, #99F6E4 100%); 
    color: #0D9488; 
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.2);
}

.stat-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748B;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    color: #0F2942;
    line-height: 1.1;
    margin: 0.35rem 0;
    letter-spacing: -0.5px;
}

.stat-value-money {
    font-size: 1.7rem;
    letter-spacing: -0.5px;
}

.stat-currency-badge {
    font-size: 0.62em;
    font-weight: 700;
    color: #64748B;
    display: inline-block;
    vertical-align: middle;
    margin-left: 2px;
}

.stat-footer {
    font-size: 0.8rem;
    color: #64748B;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

/* Hero Banner matching Mockup */
.hero-banner {
    background: linear-gradient(135deg, #0A2540 0%, #0F3A5D 50%, #00A896 100%) !important;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    color: #FFFFFF;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 58, 93, 0.22);
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -25%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, transparent 70%);
    pointer-events: none;
}

.hero-banner h4 {
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.hero-banner p {
    font-size: 0.9rem;
    opacity: 0.95;
    margin-bottom: 0;
    max-width: 70%;
}

.hero-banner-art {
    position: absolute;
    right: 1.5rem;
    bottom: -10px;
    height: 120px;
    width: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

/* =====================================================================
   BUTTONS & BADGES
   ===================================================================== */
.btn-pyb-primary {
    background: linear-gradient(135deg, #0284C7 0%, #00A896 100%) !important;
    border: none !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    border-radius: 10px;
    padding: 0.55rem 1.25rem;
    box-shadow: 0 3px 12px rgba(2, 132, 199, 0.32) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-pyb-primary:hover {
    background: linear-gradient(135deg, #0369A1 0%, #0F766E 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45) !important;
    transform: translateY(-1px);
}

.btn-pyb-primary.active,
.btn-group .btn-pyb-primary.active {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%) !important;
    border-color: #0284C7 !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
}

.btn-pyb-outline {
    background-color: transparent;
    border: 1.5px solid #0284C7;
    color: #0284C7;
    font-weight: 600;
    border-radius: 10px;
    padding: 0.55rem 1.25rem;
    transition: all 0.2s;
}

.btn-pyb-outline:hover {
    background-color: #E0F2FE;
    color: #0369A1;
    border-color: #0284C7;
}

/* Custom modern card */
.pyb-card {
    background: #FFFFFF;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 4px 18px rgba(15, 35, 60, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    padding: 1.5rem;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pyb-card:hover {
    box-shadow: 0 10px 28px rgba(15, 35, 60, 0.09), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pyb-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--pyb-border);
}

.pyb-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pyb-text-main);
    margin: 0;
}

/* Professional avatar pills in calendar header */
.prof-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.8rem;
    border-radius: 24px;
    background: #FFFFFF;
    border: 1px solid var(--pyb-border);
    font-size: 0.85rem;
    font-weight: 600;
}

.prof-pill img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Pet Avatar Thumbnails */
.pet-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: #FFF5EB;
    border: 1px solid #FFE4CC;
}

/* Agenda list items matching right column in mockup */
.agenda-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1px solid var(--pyb-border);
    margin-bottom: 0.65rem;
    transition: all 0.15s;
    max-width: 100%;
}

.agenda-item:hover {
    border-color: var(--pyb-primary-border);
    background: #FFFDFB;
}

.agenda-item-time {
    font-weight: 800;
    font-size: 0.88rem;
    color: #1E293B;
    min-width: 46px;
    flex-shrink: 0;
}

.agenda-item-info {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}

.agenda-item-pet {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-item-meta {
    font-size: 0.76rem;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom SaaS Tabs */
.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--pyb-text-muted);
    transition: color 0.15s, border-color 0.15s;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--pyb-text-main);
}

.nav-tabs .nav-link.active {
    color: var(--pyb-primary) !important;
    border: none !important;
    border-bottom: 2px solid var(--pyb-primary) !important;
    background: transparent !important;
}

/* FullCalendar styling overrides to fit modern SaaS */
.fc {
    font-family: inherit;
}

.fc .fc-toolbar.fc-header-toolbar {
    margin-bottom: 1.25rem;
}

.fc .fc-button-primary {
    background-color: #FFFFFF !important;
    border-color: #CBD5E1 !important;
    color: #334155 !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.85rem !important;
    box-shadow: none !important;
    transition: all 0.15s;
}

.fc .fc-button-primary:hover {
    background-color: #F0F9FF !important;
    border-color: #0284C7 !important;
    color: #0284C7 !important;
}

.fc .fc-button-primary.fc-button-active {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%) !important;
    border-color: #0284C7 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
}

.fc .fc-event {
    border-radius: 8px !important;
    padding: 3px 6px !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.1s;
}

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

/* =====================================================================
   MOBILE BACKDROP & RESPONSIVE BREAKPOINTS (DESKTOP, TABLET, MÓVIL)
   ===================================================================== */

/* Backdrop semitransparente para drawer móvil */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--pyb-transition-speed) ease-in-out,
                visibility var(--pyb-transition-speed) ease-in-out;
}

body.drawer-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Tablet (768px a 1199.98px): Si no hay preferencia guardada, por defecto luce contraído */
@media (min-width: 768px) and (max-width: 1199.98px) {
    /* El estado contraído o expandido es controlado por la clase .sidebar-collapsed */
}

/* Móvil (< 768px): Drawer superpuesto off-canvas */
@media (max-width: 767.98px) {
    .sidebar {
        width: 260px !important;
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: none;
        transition: transform var(--pyb-transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.drawer-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .topbar {
        height: 62px !important;
        padding: 0 0.85rem !important;
        background: #FFFFFF !important;
        box-shadow: 0 2px 14px rgba(15, 35, 60, 0.06) !important;
    }

    .topbar::after {
        height: 3px !important;
        background: linear-gradient(90deg, #0284C7 0%, #00A896 50%, #3B82F6 100%) !important;
    }

    .topbar .btn-icon {
        width: 38px !important;
        height: 38px !important;
    }

    .content-body {
        padding: 0.85rem 0.65rem !important;
    }

    /* =================================================================
       TARJETAS KPI Y REPORTES EN MÓVILES
       ================================================================= */
    .stat-card {
        padding: 0.9rem 0.75rem !important;
        border-radius: 14px !important;
    }

    .stat-title {
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.25px !important;
        margin-bottom: 0.2rem !important;
        line-height: 1.2 !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
        line-height: 1.15 !important;
        margin: 0.2rem 0 !important;
    }

    .stat-value-money {
        font-size: clamp(0.95rem, 3.8vw, 1.25rem) !important;
        letter-spacing: -0.5px !important;
        white-space: nowrap !important;
    }

    .stat-currency-badge {
        font-size: 0.55em !important;
    }

    .stat-footer {
        font-size: 0.72rem !important;
        line-height: 1.2 !important;
        gap: 0.2rem !important;
    }

    /* =================================================================
       FULLCALENDAR RESPONSIVO EN DISPOSITIVOS MÓVILES
       ================================================================= */
    .fc .fc-toolbar.fc-header-toolbar {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        align-items: stretch !important;
        margin-bottom: 0.85rem !important;
    }

    /* Orden móvil: 1. Título centrado, 2. Flechas y Hoy, 3. Botones de vista */
    .fc .fc-toolbar-chunk:nth-child(2) {
        order: 1 !important;
        width: 100% !important;
        text-align: center !important;
    }

    .fc .fc-toolbar-title {
        font-size: 1.15rem !important;
        font-weight: 700 !important;
        color: #0F172A !important;
        text-align: center !important;
        white-space: normal !important;
        line-height: 1.25 !important;
        margin: 0 !important;
    }

    .fc .fc-toolbar-chunk:first-child {
        order: 2 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.4rem !important;
        width: 100% !important;
    }

    .fc .fc-toolbar-chunk:last-child {
        order: 3 !important;
        display: flex !important;
        width: 100% !important;
    }

    .fc .fc-toolbar-chunk:last-child .fc-button-group {
        display: flex !important;
        width: 100% !important;
    }

    .fc .fc-toolbar-chunk:last-child .fc-button {
        flex: 1 1 0 !important;
        padding: 0.4rem 0.25rem !important;
        font-size: 0.78rem !important;
        text-align: center !important;
    }

    .fc .fc-button-primary {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.82rem !important;
    }

    /* Scroll horizontal táctil si se cambia a vista semanal en móvil para evitar columnas aplastadas */
    .fc-timeGridWeek-view .fc-scroller,
    .fc-timeGridWeek-view .fc-scroller-liquid-absolute {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .fc-timeGridWeek-view .fc-scrollgrid-sync-table,
    .fc-timeGridWeek-view .fc-col-header,
    .fc-timeGridWeek-view .fc-timegrid-body,
    .fc-timeGridWeek-view .fc-timegrid-slots table,
    .fc-timeGridWeek-view .fc-timegrid-cols table {
        min-width: 580px !important;
    }

    .fc-col-header-cell-cushion {
        font-size: 0.78rem !important;
        padding: 4px 2px !important;
    }

    .fc-timegrid-slot-label-cushion {
        font-size: 0.75rem !important;
    }

    /* En móvil, el drawer siempre se despliega en vista completa y cómoda */
    html.sidebar-collapsed .sidebar-brand-text,
    body.sidebar-collapsed .sidebar-brand-text,
    html.sidebar-collapsed .sidebar-nav .nav-link span,
    body.sidebar-collapsed .sidebar-nav .nav-link span,
    html.sidebar-collapsed .sidebar-user-info,
    body.sidebar-collapsed .sidebar-user-info {
        display: block !important;
        opacity: 1 !important;
        width: auto !important;
        height: auto !important;
    }

    html.sidebar-collapsed .sidebar-header,
    body.sidebar-collapsed .sidebar-header {
        flex-direction: row !important;
        height: 70px !important;
        padding: 0 1.15rem !important;
        justify-content: space-between !important;
    }

    html.sidebar-collapsed .sidebar-logo,
    body.sidebar-collapsed .sidebar-logo {
        height: 40px !important;
        max-width: 42px !important;
    }

    html.sidebar-collapsed .sidebar-nav .nav-link,
    body.sidebar-collapsed .sidebar-nav .nav-link {
        padding: 0.65rem 0.85rem !important;
        justify-content: flex-start !important;
    }

    html.sidebar-collapsed .sidebar-nav .nav-label,
    body.sidebar-collapsed .sidebar-nav .nav-label {
        display: block !important;
        opacity: 1 !important;
        height: auto !important;
        border-top: none !important;
        margin: 0 !important;
        padding: 0.65rem 0.75rem 0.25rem !important;
    }

    html.sidebar-collapsed .sidebar-nav .nav-external-icon,
    body.sidebar-collapsed .sidebar-nav .nav-external-icon {
        display: inline-block !important;
    }

    html.sidebar-collapsed .sidebar-user,
    body.sidebar-collapsed .sidebar-user {
        flex-direction: row !important;
        padding: 0.85rem 1rem !important;
        height: auto !important;
    }

    html.sidebar-collapsed .sidebar-user-avatar,
    body.sidebar-collapsed .sidebar-user-avatar {
        width: 40px !important;
        height: 40px !important;
    }

    html.sidebar-collapsed .sidebar-collapse-btn,
    body.sidebar-collapsed .sidebar-collapse-btn {
        display: none !important;
    }
}

/* =====================================================================
   BUSCADOR INTERACTIVO DE TUTORES & CARGA DE FOTOS OPTIMIZADA
   ===================================================================== */
.pyb-tutor-picker .input-group-text,
.pyb-tutor-picker .form-control,
.pyb-tutor-picker .pyb-tutor-clear-btn {
    border-color: #CBD5E1;
}

.pyb-tutor-picker.is-selected .form-control {
    font-weight: 600;
    color: #0F172A;
    background-color: #FFFDFB;
}

.pyb-tutor-picker .form-control:focus {
    box-shadow: none;
    border-color: var(--pyb-primary);
}

.pyb-tutor-picker:focus-within .input-group-text,
.pyb-tutor-picker:focus-within .form-control,
.pyb-tutor-picker:focus-within .pyb-tutor-clear-btn {
    border-color: var(--pyb-primary);
}

.pyb-tutor-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1070;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
    max-height: 230px;
    overflow-y: auto;
    padding: 0.35rem;
}

.pyb-tutor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s;
}

.pyb-tutor-item:hover,
.pyb-tutor-item.active {
    background: #FFF5EB;
}

.pyb-tutor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FFEAD9;
    color: var(--pyb-primary);
    font-weight: 700;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pyb-photo-uploader {
    border: 1.5px dashed #CBD5E1;
    border-radius: 14px;
    background: #FAFAFC;
    padding: 0.75rem 0.9rem;
    transition: border-color 0.15s, background 0.15s;
}

.pyb-photo-uploader:hover {
    border-color: var(--pyb-primary);
    background: #FFFDFB;
}

.pyb-upload-preview {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border: 2px solid #FFFFFF;
    background: #F1F5F9;
}
