/* ================================================================
   GESTÃO FAMILIAR v1.0 — app.css
   Design System completo conforme 04_UI_UX_Design_System.md
================================================================ */

/* ----------------------------------------------------------------
   1. VARIÁVEIS CSS (Design Tokens)
---------------------------------------------------------------- */
:root {
    /* Marca */
    --color-primary:        #5B6AF0;
    --color-primary-dark:   #4352D1;
    --color-primary-light:  #EEF0FE;

    /* Secundária */
    --color-secondary:      #F0A500;
    --color-secondary-dark: #C8871A;
    --color-secondary-light:#FFF8E7;

    /* Semânticas */
    --color-success:        #22C55E;
    --color-success-dark:   #16A34A;
    --color-success-light:  #DCFCE7;
    --color-danger:         #EF4444;
    --color-danger-dark:    #DC2626;
    --color-danger-light:   #FEE2E2;
    --color-warning:        #F59E0B;
    --color-warning-light:  #FEF3C7;
    --color-info:           #3B82F6;
    --color-info-light:     #DBEAFE;

    /* Neutros */
    --color-gray-50:        #F9FAFB;
    --color-gray-100:       #F3F4F6;
    --color-gray-200:       #E5E7EB;
    --color-gray-300:       #D1D5DB;
    --color-gray-400:       #9CA3AF;
    --color-gray-500:       #6B7280;
    --color-gray-600:       #4B5563;
    --color-gray-700:       #374151;
    --color-gray-800:       #1F2937;
    --color-gray-900:       #111827;

    /* Superfícies — Light Theme */
    --color-bg:             #F4F6FB;
    --color-surface:        #FFFFFF;
    --color-border:         #E5E7EB;
    --color-text:           #1F2937;
    --color-text-muted:     #6B7280;
    --color-text-light:     #9CA3AF;

    /* Sidebar */
    --color-sidebar-bg:     #1E2235;
    --color-sidebar-text:   #A8B2D8;
    --color-sidebar-active: #5B6AF0;
    --color-sidebar-hover:  rgba(91, 106, 240, 0.12);

    /* Cores por módulo */
    --mod-events:   #F0A500;
    --mod-finance:  #22C55E;
    --mod-gallery:  #EC4899;
    --mod-library:  #8B5CF6;
    --mod-list:     #14B8A6;
    --mod-timeline: #F97316;
    --mod-recipes:  #EF4444;
    --mod-members:  #5B6AF0;

    /* Fontes */
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;

    /* Escala de texto */
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    /* Espaçamento */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm:   0.375rem;
    --radius-md:   0.75rem;
    --radius-lg:   1rem;
    --radius-xl:   1.5rem;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:  0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);
    --shadow-xl:  0 20px 50px rgba(0,0,0,.12);
    --shadow-primary: 0 4px 16px rgba(91, 106, 240, .30);

    /* Transições */
    --transition-fast:   150ms ease;
    --transition-base:   250ms ease;
    --transition-slow:   400ms ease;

    /* Layout */
    --topbar-h:      64px;
    --sidebar-w:     260px;
    --sidebar-w-sm:  68px;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg:           #0F1117;
    --color-surface:      #1A1D2E;
    --color-border:       #2D3150;
    --color-text:         #E2E8F0;
    --color-text-muted:   #8892B0;
    --color-text-light:   #64748B;
    --color-primary-light: rgba(91, 106, 240, .15);
    --color-sidebar-bg:   #0F1117;
}

/* Reducão de movimento */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ----------------------------------------------------------------
   2. RESET E BASE
---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size:   var(--text-base);
    color:       var(--color-text);
    background:  var(--color-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
    margin-bottom: var(--space-4);
}
h1 { font-family: var(--font-display); font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); font-weight: 600; }
h4 { font-size: var(--text-lg); font-weight: 600; }

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

img { max-width: 100%; height: auto; }

/* Skip link (acessibilidade) */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    background: var(--color-primary);
    color: #fff;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    z-index: 9999;
    transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-4); }

/* ----------------------------------------------------------------
   3. LAYOUT PRINCIPAL (app com sidebar)
---------------------------------------------------------------- */
.app-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* TOPBAR */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.topbar__left,
.topbar__right { display: flex; align-items: center; gap: var(--space-3); }

.topbar__center { flex: 1; display: flex; justify-content: center; }

.topbar__menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.topbar__menu-btn:hover { background: var(--color-gray-100); color: var(--color-text); }

.topbar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--color-text);
    text-decoration: none;
}
.topbar__brand-icon { color: var(--color-primary); font-size: 1.5rem; }

.topbar__icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.topbar__icon-btn:hover { background: var(--color-gray-100); color: var(--color-text); }

.topbar__avatar-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: var(--radius-full);
}
.topbar__avatar-btn::after { display: none; } /* remove dropdown caret */

.topbar__avatar-img {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-border);
}
.topbar__avatar-initials {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--color-sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), transform var(--transition-slow);
}

.sidebar__nav { flex: 1; padding: var(--space-4) 0; }
.sidebar__section { padding: 0 var(--space-3); margin-bottom: var(--space-2); }

.sidebar__section-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(168, 178, 216, 0.5);
    padding: var(--space-2) var(--space-3) var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-slow);
}

.sidebar__menu { list-style: none; padding: 0; margin: 0; }

.sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-sidebar-text);
    font-weight: 500;
    font-size: var(--text-sm);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: var(--space-1);
    border-left: 3px solid transparent;
}

.sidebar__item:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}

.sidebar__item.is-active {
    background: var(--color-sidebar-hover);
    color: #fff;
    border-left-color: var(--color-sidebar-active);
}

.sidebar__item--logout { color: rgba(239, 68, 68, .7); }
.sidebar__item--logout:hover { background: rgba(239, 68, 68, .12); color: #EF4444; }

.sidebar__item-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.sidebar__item-text { transition: opacity var(--transition-slow); }

.sidebar__divider {
    border-color: rgba(255,255,255,.08);
    margin: var(--space-2) var(--space-4);
}

.sidebar__footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar__version {
    font-size: var(--text-xs);
    color: rgba(168, 178, 216, 0.35);
}

/* Sidebar colapsada */
.sidebar--collapsed {
    width: var(--sidebar-w-sm);
}
.sidebar--collapsed .sidebar__item-text,
.sidebar--collapsed .sidebar__section-label { opacity: 0; pointer-events: none; }
.sidebar--collapsed .sidebar__item { justify-content: center; }

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 850;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.is-visible { display: block; }

/* CONTEÚDO PRINCIPAL */
.main-content {
    margin-top: var(--topbar-h);
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--topbar-h));
    padding: var(--space-8);
    transition: margin-left var(--transition-slow);
}

.main-content--collapsed { margin-left: var(--sidebar-w-sm); }

/* ----------------------------------------------------------------
   4. LAYOUT DE AUTENTICAÇÃO
---------------------------------------------------------------- */
.auth-body {
    min-height: 100vh;
    background: var(--color-bg);
    font-family: var(--font-body);
}

.auth-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Painel esquerdo */
.auth-panel-left {
    flex: 0 0 45%;
    background: linear-gradient(135deg, #3a4be0 0%, #5b6af0 50%, #7c4dc9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    position: relative;
    overflow: hidden;
}

.auth-panel-left__content { position: relative; z-index: 2; color: #fff; }

.auth-panel-left__headline {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: var(--space-4);
}
.auth-panel-left__sub {
    font-size: var(--text-lg);
    color: rgba(255,255,255,.80);
    line-height: 1.6;
    margin-bottom: var(--space-8);
}

.auth-features { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: rgba(255,255,255,.9);
    font-weight: 500;
}
.auth-feature-item i { font-size: 1.125rem; color: rgba(255,255,255,.7); }

/* Círculos decorativos */
.auth-deco {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}
.auth-deco--1 { width: 350px; height: 350px; bottom: -80px; right: -80px; }
.auth-deco--2 { width: 200px; height: 200px; top: -50px; left: -50px; }

/* Painel direito */
.auth-panel-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    background: var(--color-surface);
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--text-xl);
    color: var(--color-text);
    text-decoration: none;
}
.auth-brand__icon { color: var(--color-primary); font-size: 1.75rem; }
.auth-brand--mobile { justify-content: center; }

.auth-form-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}
.auth-form-subtitle {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    margin-bottom: 0;
}

.auth-back-link {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
}
.auth-back-link:hover { color: var(--color-primary); }

/* ----------------------------------------------------------------
   5. FORMULÁRIOS
---------------------------------------------------------------- */
.form-label {
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.form-control, .form-select {
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-surface);
    padding: 0.6rem 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
    outline: none;
}

.form-control.is-invalid { border-color: var(--color-danger); }
.form-control.is-valid   { border-color: var(--color-success); }

.input-group-text {
    background: var(--color-gray-50);
    border: 1.5px solid var(--color-border);
    color: var(--color-text-muted);
}

.form-text { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.form-link { font-size: var(--text-sm); font-weight: 500; color: var(--color-primary); }
.form-link:hover { color: var(--color-primary-dark); }

/* ----------------------------------------------------------------
   6. BOTÕES
---------------------------------------------------------------- */
.btn {
    font-weight: 500;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.25rem;
    transition: all var(--transition-base);
    border-width: 1.5px;
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-primary);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--color-primary);
}
.btn-ghost:hover { background: var(--color-primary-light); color: var(--color-primary-dark); }

.btn-lg { padding: 0.75rem 1.75rem; font-size: var(--text-base); border-radius: var(--radius-md); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: var(--text-xs); }

/* ----------------------------------------------------------------
   7. CARDS
---------------------------------------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
    overflow: hidden;
}

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

.card-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    display: flex;
    align-items: center;
}
.card-title {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}
.card-body { padding: var(--space-6); }

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.stat-card__body {
    flex: 1;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card__icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}
.stat-card__value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: var(--space-1);
    white-space: nowrap;
}
.stat-card__label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* ----------------------------------------------------------------
   8. PAGE HEADER
---------------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-1);
}
.page-title__wave { font-style: normal; }
.page-subtitle { font-size: var(--text-base); margin: 0; }

/* ----------------------------------------------------------------
   9. BREADCRUMB
---------------------------------------------------------------- */
.breadcrumb-wrapper {
    margin-bottom: var(--space-6);
}
.breadcrumb {
    font-size: var(--text-sm);
    background: none;
    padding: 0;
    margin: 0;
}
.breadcrumb-item a { color: var(--color-text-muted); }
.breadcrumb-item.active { color: var(--color-text); font-weight: 500; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--color-gray-400); }

/* ----------------------------------------------------------------
   10. SKELETON LOADERS
---------------------------------------------------------------- */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--color-gray-100) 25%,
        var(--color-gray-200) 50%,
        var(--color-gray-100) 75%
    );
    background-size: 800px 100%;
    animation: shimmer 1.5s linear infinite;
    border-radius: var(--radius-sm);
    min-height: 1em;
    display: block;
}

.skeleton-text { height: 0.875rem; }
.skeleton-text.w-30 { width: 30%; }
.skeleton-text.w-40 { width: 40%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-60 { width: 60%; }
.skeleton-text.w-70 { width: 70%; }

.skeleton-avatar {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.skeleton-avatar--sm { width: 32px; height: 32px; }
.skeleton-square  { width: 48px; height: 48px; border-radius: var(--radius-md); flex-shrink: 0; }
.skeleton-img     { width: 100%; aspect-ratio: 1; border-radius: var(--radius-md); }

/* ----------------------------------------------------------------
   11. GALERIA GRID
---------------------------------------------------------------- */
.gallery-grid--2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

/* ----------------------------------------------------------------
   12. ACTIVITY FEED
---------------------------------------------------------------- */
.activity-item { border-bottom: 1px solid var(--color-border); }
.activity-item:last-child { border-bottom: none; }

/* ----------------------------------------------------------------
   13. PASSWORD STRENGTH
---------------------------------------------------------------- */
.password-strength-bar {
    height: 4px;
    background: var(--color-gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-1);
}
.password-strength-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-full);
    transition: width var(--transition-base), background var(--transition-base);
}
.password-strength-label { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ----------------------------------------------------------------
   14. ERROR PAGES
---------------------------------------------------------------- */
.error-page__icon  { font-size: 5rem; display: block; margin-bottom: var(--space-4); }
.error-page__code  { font-size: 6rem; font-weight: 700; line-height: 1; color: var(--color-primary); margin-bottom: var(--space-2); }
.error-page__title { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
.error-page__text  { max-width: 400px; margin: 0 auto; }

/* ----------------------------------------------------------------
   15. FAMILY SWITCHER
---------------------------------------------------------------- */
.family-switcher__btn {
    background: var(--color-gray-50);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--color-text);
}
.family-switcher__btn:hover { border-color: var(--color-primary); }

/* ----------------------------------------------------------------
   16. DROPDOWN (override Bootstrap)
---------------------------------------------------------------- */
.dropdown-menu {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2);
}
.dropdown-item {
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    color: var(--color-text);
}
.dropdown-item:hover { background: var(--color-gray-50); }
.dropdown-item.active { background: var(--color-primary-light); color: var(--color-primary); }
.dropdown-header {
    font-size: var(--text-sm);
    color: var(--color-text);
    padding: var(--space-2) var(--space-3);
}

/* ----------------------------------------------------------------
   17. ALERTS
---------------------------------------------------------------- */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: var(--text-sm);
}
.alert-success { background: var(--color-success-light); border-color: var(--color-success); color: #166534; }
.alert-danger   { background: var(--color-danger-light);  border-color: var(--color-danger);  color: #991B1B; }
.alert-warning  { background: var(--color-warning-light); border-color: var(--color-warning); color: #92400E; }
.alert-info     { background: var(--color-info-light);    border-color: var(--color-info);    color: #1D4ED8; }

/* ----------------------------------------------------------------
   18. TOGGLE PASSWORD BUTTON
---------------------------------------------------------------- */
.btn-toggle-password {
    border-left: none;
    color: var(--color-text-muted);
}
.btn-toggle-password:hover { color: var(--color-primary); }

/* ----------------------------------------------------------------
   19. UTILITÁRIOS
---------------------------------------------------------------- */
.text-sm   { font-size: var(--text-sm); }
.text-xs   { font-size: var(--text-xs); }
.flex-1    { flex: 1; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------------------------------------------
   20. MEMBER CARDS (F03)
---------------------------------------------------------------- */
.member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-4);
    box-shadow: var(--shadow-sm);
    color: var(--color-text);
    transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
    height: 100%;
}
.member-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: var(--color-primary);
    color: var(--color-text);
}
.member-card__avatar {
    width: 80px; height: 80px;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-3);
    flex-shrink: 0;
}
.member-card__avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}
.member-card__avatar-initials {
    width: 80px; height: 80px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-xl);
}
.member-card__info { width: 100%; }
.member-card__name {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}
.member-card__fullname { font-size: var(--text-xs); }

/* Invite card */
.member-card--invite {
    border-style: dashed;
    border-color: var(--color-primary-light);
    background: var(--color-primary-light);
}
.member-card--invite:hover { border-color: var(--color-primary); }
.member-card__avatar--invite {
    background: rgba(91,106,240,.15);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Avatar para perfil de membro (grande) */
.member-avatar-lg { flex-shrink: 0; }
.member-avatar-lg__img {
    width: 80px; height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--color-border);
}
.member-avatar-lg__initials {
    width: 80px; height: 80px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-xl);
}

/* Avatar pequeno (lista de parentesco) */
.avatar-sm { flex-shrink: 0; }
.avatar-sm__img {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}
.avatar-sm__initials {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

/* ----------------------------------------------------------------
   21. BADGE DE PAPÉIS
---------------------------------------------------------------- */
.badge-role-admin { background: #FEF3C7; color: #92400E; }
.badge-role-adult { background: #DBEAFE; color: #1D4ED8; }
.badge-role-minor { background: #F3F4F6; color: #374151; }
.badge-role-guest { background: #F0FDF4; color: #166534; }

/* ----------------------------------------------------------------
   22. DATA LIST (ficha de dados do membro)
---------------------------------------------------------------- */
.data-list { margin: 0; }
.data-list__item {
    display: flex;
    flex-direction: column;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}
.data-list__item:last-child { border-bottom: none; }
.data-list__item dt {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}
.data-list__item dd {
    font-size: var(--text-base);
    color: var(--color-text);
    margin: 0;
}

/* ----------------------------------------------------------------
   23. CARD DE RISCO (zona de perigo)
---------------------------------------------------------------- */
.card--danger {
    border-color: var(--color-danger-light);
    background: var(--color-danger-light);
}

/* ----------------------------------------------------------------
   24. UPLOAD AREA (drag & drop)
---------------------------------------------------------------- */
.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base);
    background: var(--color-gray-50);
}
.upload-area:hover,
.upload-area.is-dragging {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}
.upload-area__icon {
    font-size: 2.5rem;
    color: var(--color-text-light);
    display: block;
    margin-bottom: var(--space-3);
}
.upload-area__link { color: var(--color-primary); cursor: pointer; font-weight: 500; }
.upload-area__img {
    max-height: 200px;
    border-radius: var(--radius-md);
    object-fit: cover;
    width: 100%;
}
.upload-area__remove {
    display: block;
    margin: var(--space-2) auto 0;
    color: var(--color-danger);
}

/* ----------------------------------------------------------------
   25. FAMILY COVER BANNER
---------------------------------------------------------------- */
.family-cover { border-radius: var(--radius-lg); overflow: hidden; max-height: 240px; }
.family-cover__img { width: 100%; height: 240px; object-fit: cover; }

/* ----------------------------------------------------------------
   26. RESPONSIVIDADE
---------------------------------------------------------------- */

/* Smart TV / UHD (Large screens) */
@media (min-width: 1920px) {
    :root {
        --text-base: 1.15rem;
        --text-lg:   1.3rem;
        --text-xl:   1.5rem;
        --text-2xl:  1.8rem;
        --text-3xl:  2.2rem;
        --text-4xl:  2.8rem;
        --space-4:   1.25rem;
        --space-5:   1.5rem;
        --space-6:   2rem;
        --topbar-h:  80px;
        --sidebar-w: 320px;
    }
    body {
        font-size: var(--text-base);
    }
}
@media (min-width: 2560px) {
    :root {
        --text-base: 1.3rem;
        --text-lg:   1.5rem;
        --text-xl:   1.8rem;
        --text-2xl:  2.2rem;
        --text-3xl:  2.8rem;
        --text-4xl:  3.5rem;
        --space-4:   1.5rem;
        --space-5:   2rem;
        --space-6:   2.5rem;
        --topbar-h:  96px;
        --sidebar-w: 380px;
    }
}

/* Sidebar Colapsada (Desktop) */
.sidebar.is-collapsed {
    width: var(--sidebar-w-sm) !important;
}
.sidebar.is-collapsed .sidebar__item-text,
.sidebar.is-collapsed .sidebar__section-label {
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    overflow: hidden !important;
}
.sidebar.is-collapsed .sidebar__item {
    justify-content: center !important;
    padding: var(--space-3) !important;
}

.main-content {
    margin-left: var(--sidebar-w);
    padding: var(--space-8);
    transition: margin-left var(--transition-slow);
}
.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-w-sm) !important;
}

/* Tablet (md) */
@media (max-width: 991.98px) {
    .sidebar {
        width: var(--sidebar-w-sm);
    }
    .sidebar .sidebar__item-text,
    .sidebar .sidebar__section-label { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
    .sidebar .sidebar__item { justify-content: center; padding: var(--space-3); }
    .main-content { margin-left: var(--sidebar-w-sm); padding: var(--space-6); }
    .page-title { font-size: var(--text-2xl); }
}

/* Mobile (sm) */
@media (max-width: 767.98px) {
    :root { --topbar-h: 56px; }

    .sidebar {
        width: var(--sidebar-w) !important;
        transform: translateX(-100%);
        transition: transform var(--transition-base) !important;
        z-index: 1050;
    }
    .sidebar.is-open {
        transform: translateX(0) !important;
        box-shadow: var(--shadow-xl);
    }
    .sidebar.is-open .sidebar__item-text,
    .sidebar.is-open .sidebar__section-label {
        opacity: 1 !important;
        pointer-events: auto !important;
        width: auto !important;
        overflow: visible !important;
    }
    .sidebar.is-open .sidebar__item { justify-content: flex-start !important; }

    .main-content { margin-left: 0 !important; padding: var(--space-4); }

    .auth-panel-left { display: none !important; }
    .auth-panel-right { padding: var(--space-6); }

    .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
    .page-title  { font-size: var(--text-xl); }
}

/* ================================================================
   8. COMPONENTES EXTRA (TOASTS E AVATAR HOVER)
================================================================ */

/* Toast System */
#gf-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gf-toast {
    min-width: 280px;
    max-width: 350px;
    padding: 16px 20px;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    border-left: 4px solid transparent;
}

.gf-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.gf-toast--error {
    border-left-color: var(--color-danger);
}
.gf-toast--error .gf-toast__icon {
    color: var(--color-danger);
}

.gf-toast--success {
    border-left-color: var(--color-success);
}
.gf-toast--success .gf-toast__icon {
    color: var(--color-success);
}

.gf-toast--warning {
    border-left-color: var(--color-warning);
}
.gf-toast--warning .gf-toast__icon {
    color: var(--color-warning);
}

.gf-toast__icon {
    font-size: 1.25rem;
}



/* Avatar Hover Rollout Effect */
.header-user-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: transparent;
    padding: 0;
    border: none;
    cursor: pointer;
    overflow: hidden;
    height: 40px;
    border-radius: 20px;
    transition: max-width 0.4s ease-in-out, background-color 0.4s ease;
    width: auto;
    max-width: 40px;
}
.header-user-badge:hover,
.header-user-badge:focus-within,
.header-user-badge[aria-expanded="true"] {
    max-width: 300px;
    background-color: var(--color-background-hover, rgba(0,0,0,0.05));
}
.header-user-badge__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
    position: absolute;
    left: 0;
    z-index: 2;
}
.header-user-badge__name {
    padding-left: 48px;
    padding-right: 12px;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
}
.header-user-badge:hover .header-user-badge__name,
.header-user-badge:focus-within .header-user-badge__name,
.header-user-badge[aria-expanded="true"] .header-user-badge__name {
    opacity: 1;
    transform: translateX(0);
}
.dropdown-toggle.header-user-badge::after {
    display: none;
}
