/* ═══════════════════════════════════════════════════════════════
   CARRINHO — Design System
   Aesthetic: Warm Market / Organic Premium
   Fonts: Plus Jakarta Sans (headings) + DM Sans (body)
═══════════════════════════════════════════════════════════════ */

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

/* ─── Tokens ─────────────────────────────────────────────────── */
:root {
    color-scheme: light;

    /* Brand — Fresh Green */
    --brand-50:  #F0FDF4;
    --brand-100: #DCFCE7;
    --brand-200: #BBF7D0;
    --brand-300: #86EFAC;
    --brand-400: #4ADE80;
    --brand-500: #22C55E;
    --brand-600: #16A34A;
    --brand-700: #15803D;
    --brand-800: #166534;
    --brand-900: #14532D;
    --brand-gradient: linear-gradient(135deg, #16A34A 0%, #22C55E 100%);
    --brand-glow: 0 8px 24px -6px rgba(22, 163, 74, 0.45);

    /* Accent — Amber */
    --amber-50:  #FFFBEB;
    --amber-100: #FEF3C7;
    --amber-200: #FDE68A;
    --amber-400: #FBBF24;
    --amber-500: #F59E0B;
    --amber-600: #D97706;
    --amber-700: #B45309;
    --amber-800: #92400E;
    --amber-gradient: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);

    /* Blue / Info */
    --blue-50:  #EFF6FF;
    --blue-100: #DBEAFE;
    --blue-200: #BFDBFE;
    --blue-400: #60A5FA;
    --blue-500: #3B82F6;
    --blue-600: #2563EB;
    --blue-700: #1D4ED8;
    --blue-800: #1E40AF;

    /* Danger */
    --red-50:   #FEF2F2;
    --red-100:  #FEE2E2;
    --red-200:  #FECACA;
    --red-400:  #F87171;
    --red-500:  #EF4444;
    --red-600:  #DC2626;
    --red-700:  #B91C1C;
    --red-800:  #991B1B;

    /* Neutrals — Warm Stone */
    --stone-50:  #FAFAF9;
    --stone-100: #F5F5F4;
    --stone-200: #E7E5E4;
    --stone-300: #D6D3D1;
    --stone-400: #A8A29E;
    --stone-500: #78716C;
    --stone-600: #57534E;
    --stone-700: #44403C;
    --stone-800: #292524;
    --stone-900: #1C1917;

    /* Surfaces */
    --bg:              var(--stone-50);
    --surface:         #FFFFFF;
    --surface-2:       var(--stone-100);
    --surface-3:       var(--stone-200);
    --surface-checked: #F8FAFC;
    --surface-hover:   var(--stone-100);
    --card-bg:         #FFFFFF;
    --border:          var(--stone-200);
    --border-subtle:   var(--stone-100);
    --border-hover:    var(--stone-300);
    --border-focus:    var(--brand-500);

    /* Text */
    --text-primary:   var(--stone-900);
    --text-secondary: var(--stone-500);
    --text-tertiary:  var(--stone-400);
    --text-inverse:   #FFFFFF;

    /* Semantic States */
    --surface-danger:  var(--red-50);
    --border-danger:   var(--red-200);
    --text-danger:     var(--red-600);

    --surface-warning: var(--amber-50);
    --border-warning:  var(--amber-200);
    --text-warning:    var(--amber-800);

    --surface-info:    var(--blue-50);
    --border-info:     var(--blue-200);
    --text-info:       var(--blue-700);

    --surface-success: var(--brand-50);
    --border-success:  var(--brand-200);
    --text-success:    var(--brand-700);

    /* Generic accent aliases — several component stylesheets reference
       these short names (var(--primary), var(--danger), etc.) without a
       fallback. They were never defined here, so those rules silently
       fell back to transparent/initial (e.g. the "Salvar" button on
       AddEditItemModal rendering as a colorless ghost button). */
    --primary:        var(--brand-600);
    --primary-dark:   var(--brand-700);
    --primary-subtle: var(--brand-300);
    --danger:         var(--red-500);
    --warning:        var(--amber-500);
    --info:           var(--blue-700);

    --overlay-bg: rgba(15, 23, 42, 0.6);

    /* Admin Sidebar */
    --sidebar-bg:     #0D1F12;
    --sidebar-border: rgba(255,255,255,0.06);
    --sidebar-text:   rgba(255,255,255,0.65);
    --sidebar-active: rgba(255,255,255,0.08);
    --sidebar-active-text: #FFFFFF;
    --sidebar-width:  264px;

    /* Radius */
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-xl:   20px;
    --r-2xl:  24px;
    --r-full: 9999px;

    /* Shadow */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.06);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg:  0 20px 48px rgba(0,0,0,0.10);
    --shadow-xl:  0 32px 64px rgba(0,0,0,0.12);

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    /* Bottom nav (mobile) */
    --bottom-nav-height: 64px;
}

/* ─── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* ─── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.display-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.label-xs {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stone-300); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--stone-400); }

/* ═══════════════════════════════════════════════════════════════
   ADMIN LAYOUT (Dark Sidebar)
═══════════════════════════════════════════════════════════════ */
.admin-page {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.admin-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
}

.admin-sidebar-logo .logo-icon {
    width: 34px;
    height: 34px;
    background: var(--brand-gradient);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.admin-sidebar-logo .logo-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: white;
    letter-spacing: -0.03em;
}

.admin-sidebar-logo .logo-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-500);
    background: rgba(34, 197, 94, 0.12);
    padding: 2px 6px;
    border-radius: var(--r-full);
    margin-left: auto;
}

.admin-nav-section {
    padding: 1.25rem 0.875rem;
    flex: 1;
    overflow-y: auto;
}

.admin-nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 0 0.5rem;
    margin-bottom: 0.375rem;
    margin-top: 1.25rem;
}

.admin-nav-label:first-child { margin-top: 0; }

.admin-nav-item { margin-bottom: 2px; }

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.625rem 0.75rem;
    border-radius: var(--r-md);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.admin-nav-link:hover {
    background: var(--sidebar-active);
    color: white;
}

.admin-nav-link.active {
    background: var(--brand-gradient);
    color: white;
    box-shadow: var(--brand-glow);
}

.admin-nav-link .nav-icon {
    font-size: 1rem;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.admin-nav-link:hover .nav-icon,
.admin-nav-link.active .nav-icon { opacity: 1; }

.admin-sidebar-footer {
    padding: 1rem 0.875rem;
    border-top: 1px solid var(--sidebar-border);
}

.admin-sidebar-footer .version-text {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.25);
    text-align: center;
    display: block;
}

/* Admin Main */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
}

.admin-topbar {
    height: 3.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 0.75rem;
}

.admin-content {
    padding: 2.5rem;
    flex: 1;
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badge-admin-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--brand-gradient);
    color: white;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    letter-spacing: 0.03em;
}

.btn-ver-app {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    text-decoration: none;
    transition: all 0.15s;
}
.btn-ver-app:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
}

/* Admin Layout — Mobile: the fixed sidebar becomes a horizontally
   scrollable top strip instead of eating the whole viewport. */
@media (max-width: 768px) {
    .admin-page {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 950;
        flex-direction: row;
        align-items: center;
    }

    .admin-sidebar-logo {
        padding: 0.6rem 0.75rem;
        border-bottom: none;
        border-right: 1px solid var(--sidebar-border);
        flex-shrink: 0;
    }

    .admin-sidebar-logo .logo-text,
    .admin-sidebar-logo .logo-badge {
        display: none;
    }

    .admin-nav-section {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        padding: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }

    .admin-nav-label {
        display: none;
    }

    .admin-nav-item {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .admin-nav-link {
        white-space: nowrap;
    }

    .admin-sidebar-footer {
        display: none;
    }

    .admin-topbar {
        padding: 0 1rem;
    }

    .admin-content {
        padding: 1rem;
    }
}

.badge-admin-app {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--brand-gradient);
    color: white;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: opacity 0.15s;
}
.badge-admin-app:hover {
    opacity: 0.85;
    color: white;
}

/* ═══════════════════════════════════════════════════════════════
   APP LAYOUT (User-Facing — Centered, Top Nav)
═══════════════════════════════════════════════════════════════ */
.app-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.app-topnav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.app-topnav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}

.app-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--brand-gradient);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.app-logo .logo-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.04em;
}

.app-logo .logo-text span { color: var(--brand-600); }

.app-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1.5rem;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.75rem;
    border-radius: var(--r-full);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.app-nav-link:hover {
    background: var(--stone-100);
    color: var(--text-primary);
}

.app-nav-link.active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.app-nav-spacer { flex: 1; }

.app-main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1.5rem;
}

/* ─── Bottom Nav (Mobile) ───────────────────────────────────────
   Hidden by default; shown only on small screens via the media
   query below, replacing .app-nav-links so destinations aren't
   duplicated. Pure CSS — no JS/state involved. */
.app-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 900;
    align-items: stretch;
}

.app-bottom-nav-item {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 44px;
    min-height: 44px;
    padding: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.app-bottom-nav-item .bi {
    font-size: 1.25rem;
    line-height: 1;
}

.app-bottom-nav-item span:last-child {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.app-bottom-nav-item:hover {
    color: var(--text-primary);
}

.app-bottom-nav-item.active {
    color: var(--brand-600);
}

@media (max-width: 768px) {
    .app-nav-links { display: none; }

    .app-bottom-nav {
        display: flex;
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .app-main {
        padding: 1rem 0.75rem calc(2rem + var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px)) 0.75rem;
    }

    .item-row,
    .list-card,
    .group-card {
        scroll-margin-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 20px);
    }

    .summary-bar {
        bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        padding: 0.5rem 0.85rem;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    }

    .summary-bar-totals {
        gap: 0.85rem;
    }

    .summary-total-divided {
        padding-left: 0.85rem;
    }

    .summary-value {
        font-size: 1.15rem;
    }

    .summary-label {
        font-size: 0.65rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH LAYOUT
═══════════════════════════════════════════════════════════════ */
.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-brand {
    width: 42%;
    background: var(--sidebar-bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(22, 163, 74, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(34, 197, 94, 0.08) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.auth-brand-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--brand-gradient);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.auth-brand-logo .logo-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: white;
    letter-spacing: -0.04em;
}

.auth-brand-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.auth-brand-headline {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 800;
    color: white;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.auth-brand-sub {
    color: rgba(255,255,255,0.55);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 320px;
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2.5rem;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.auth-feature-icon {
    width: 28px;
    height: 28px;
    background: rgba(34, 197, 94, 0.15);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-500);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.auth-brand-footer {
    color: rgba(255,255,255,0.25);
    font-size: 0.75rem;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 4rem;
    background: var(--surface);
    overflow-y: auto;
}

.auth-form-box {
    width: 100%;
    max-width: 380px;
}

.auth-form-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.auth-form-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .auth-brand { display: none; }
    .auth-form-panel { padding: 2rem 1.5rem; }
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTS
═══════════════════════════════════════════════════════════════ */

/* ─── Card ────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-hover {
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-body { padding: 1.5rem; }
.card-body-sm { padding: 1rem; }

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

.card-header h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--r-md);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.6rem 1.25rem;
    min-height: 40px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
    box-shadow: var(--brand-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -6px rgba(22, 163, 74, 0.55);
    color: white;
}

.btn-primary:active { transform: translateY(0); }

/* Feedback tátil imediato em cliques e toques (responsividade instantânea) */
.btn:active:not(:disabled),
button:active:not(:disabled),
.item-checkbox:active,
.interactive-checkbox:active,
.stat-card:active,
.mobile-action-btn:active,
.row-action-btn:active,
.invite-tab-btn:active {
    transform: scale(0.97) !important;
    opacity: 0.88;
    transition: transform 0.04s ease-out, opacity 0.04s ease-out;
}

.btn-loading {
    opacity: 0.85 !important;
    cursor: wait !important;
    pointer-events: none;
}

.btn-secondary {
    background: var(--stone-100);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--stone-200);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--red-100);
    color: var(--red-500);
}

.btn-danger:hover {
    background: var(--red-500);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--stone-100);
    color: var(--text-primary);
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; min-height: 32px; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.95rem; min-height: 48px; border-radius: var(--r-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: 0.5rem; aspect-ratio: 1; }
.btn-icon-sm { padding: 0.35rem; aspect-ratio: 1; }

/* ─── Form ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-section {
    border-top: 1px solid var(--border);
    padding-top: 1.1rem;
    margin-top: 1.1rem;
}

.form-section-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.form-control::placeholder { color: var(--text-tertiary); }
.form-control:disabled { background: var(--stone-100); opacity: 0.7; }

.form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--red-500);
    margin-top: 0.375rem;
}

.input-with-icon { position: relative; }
.input-with-icon .form-control { padding-left: 2.5rem; }
.input-with-icon .input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 1rem;
    pointer-events: none;
}

/* ─── Avatar ──────────────────────────────────────────────────── */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-full);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }
.avatar-md { width: 36px; height: 36px; font-size: 0.8rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }

.avatar-group { display: flex; }
.avatar-group .avatar {
    border: 2px solid var(--surface);
    margin-left: -8px;
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* ─── Badge ───────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: var(--r-full);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-green  { background: var(--brand-100); color: var(--brand-700); }
.badge-amber  { background: #FEF3C7; color: #92400E; }
.badge-red    { background: var(--red-100); color: var(--red-500); }
.badge-stone  { background: var(--stone-100); color: var(--stone-600); }
.badge-dark   { background: var(--stone-800); color: white; }

/* ─── Table ───────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    background: var(--stone-50);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
    color: var(--text-primary);
}
.table tr:last-child td { border-bottom: none; }
.table-hover tr:hover td { background: var(--stone-50); }

/* ─── Stat Card ───────────────────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-card-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.375rem;
}

.stat-card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-card-accent {
    background: var(--brand-gradient);
}

.stat-card-accent .stat-card-label,
.stat-card-accent .stat-card-value,
.stat-card-accent .stat-card-meta {
    color: white;
}

.stat-card-accent .stat-card-label { opacity: 0.8; }
.stat-card-accent .stat-card-meta { opacity: 0.7; }

/* ─── Group Card ──────────────────────────────────────────────── */
.group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
    color: inherit;
}

.group-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--group-color, var(--brand-gradient));
    border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.group-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
    color: inherit;
}

.group-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-lg);
    background: var(--stone-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.group-card-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.group-card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.group-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ─── List Card ───────────────────────────────────────────────── */
.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.list-card:hover {
    border-color: var(--brand-200);
    box-shadow: var(--shadow-sm);
    color: inherit;
}

.list-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    background: var(--brand-50);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-600);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.list-card-body { flex: 1; min-width: 0; }

.list-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── Shopping Item ───────────────────────────────────────────── */
.item-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--r-lg);
    transition: background 0.1s ease;
    cursor: pointer;
}

.item-row:hover { background: var(--stone-50); }
.item-row.is-checked { opacity: 0.5; }
.item-row.is-checked .item-name { text-decoration: line-through; color: var(--text-secondary); }

.item-checkbox {
    width: 22px;
    height: 22px;
    border-radius: var(--r-sm);
    border: 2px solid var(--stone-300);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s var(--ease-spring);
    cursor: pointer;
    background: transparent;
}

.item-checkbox.checked {
    background: var(--brand-gradient);
    border-color: transparent;
    color: white;
    transform: scale(0.95);
}

.item-thumb {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--stone-100);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.item-thumb img { width: 100%; height: 100%; object-fit: cover; }

.item-body { flex: 1; min-width: 0; }

.item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1px;
}

.item-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.item-assignee { flex-shrink: 0; }

/* ─── Category Section ────────────────────────────────────────── */
.category-section { margin-bottom: 0.5rem; }
/* Toggle "Agrupar por categoria" desligado: sem header, sem respiro entre seções — parece lista única */
.category-section.is-flat { margin-bottom: 0; }

.category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.category-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--r-full);
    background: currentColor;
    flex-shrink: 0;
}

/* ─── Progress Bar ────────────────────────────────────────────── */
.progress-bar-wrap {
    height: 6px;
    background: var(--stone-100);
    border-radius: var(--r-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--brand-gradient);
    border-radius: var(--r-full);
    transition: width 0.4s var(--ease-out);
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--r-2xl);
    background: var(--stone-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    color: var(--text-tertiary);
}

.empty-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.empty-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 280px;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* ─── Divider ─────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin: 1.25rem 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ─── Social Buttons ──────────────────────────────────────────── */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    min-height: 44px;
}

.btn-social:hover {
    border-color: var(--stone-300);
    background: var(--stone-50);
    color: var(--text-primary);
}

/* ─── Spinner ─────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--stone-200);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast / Alert ───────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--r-lg);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-success { background: var(--brand-50); color: var(--brand-800); border: 1px solid var(--brand-200); }
.alert-error   { background: var(--red-100); color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ─── Floating Summary Bar ─────────────────────────────────────── */
.summary-bar {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 50;
}

.summary-total {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.summary-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
}

.summary-bar-totals {
    display: flex;
    gap: 1.5rem;
}

.summary-total-divided {
    border-left: 1px solid var(--border);
    padding-left: 1.5rem;
}

.summary-value-paid {
    color: var(--primary);
}

.summary-bar-meta {
    text-align: right;
}

.summary-meta-progress {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

/* ─── Page Header ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.page-header-left { flex: 1; min-width: 0; }

.page-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.15s;
}

.page-back:hover { color: var(--text-primary); }

.page-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ─── Modal / Dialog ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease;
}

@media (min-width: 640px) {
    .modal-overlay { align-items: center; }
}

.modal-box {
    background: var(--surface);
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    padding: 2rem;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s var(--ease-out);
}

@media (min-width: 640px) {
    .modal-box {
        border-radius: var(--r-2xl);
        animation: scaleIn 0.2s var(--ease-out);
    }
}

.modal-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.modal-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ─── Misc ────────────────────────────────────────────────────── */
.text-brand { color: var(--brand-600); }
.text-muted  { color: var(--text-secondary) !important; }
.text-xs     { font-size: 0.75rem; }
.text-sm     { font-size: 0.875rem; }
.text-lg     { font-size: 1.125rem; }
.fw-medium   { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold     { font-weight: 700; }
.fw-extrabold{ font-weight: 800; }

.gap-xs { gap: 0.375rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.875rem; }
.gap-lg { gap: 1.25rem; }

.d-flex { display: flex; }
.flex-row { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.rounded-full { border-radius: var(--r-full); }
.rounded-lg { border-radius: var(--r-lg); }
.rounded-xl { border-radius: var(--r-xl); }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

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

@media (max-width: 768px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

@media (max-width: 480px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 0.5rem; }

    .stat-card {
        padding: 0.75rem 0.85rem;
    }

    .stat-card-value {
        font-size: 1.2rem;
    }

    .modal-box {
        padding: 1.25rem 1rem;
    }
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes checkPop { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(0.95); } }

.animate-fade-up  { animation: fadeUp 0.35s var(--ease-out) both; }
.animate-fade-up-delay-1 { animation: fadeUp 0.35s var(--ease-out) 0.06s both; }
.animate-fade-up-delay-2 { animation: fadeUp 0.35s var(--ease-out) 0.12s both; }
.animate-fade-up-delay-3 { animation: fadeUp 0.35s var(--ease-out) 0.18s both; }

/* ─── Blazor Error UI ─────────────────────────────────────────── */
#blazor-error-ui {
    background: #FEF2F2;
    border-top: 2px solid var(--red-500);
    bottom: 0;
    left: 0;
    padding: 1rem 2rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    display: none;
    color: #991B1B;
    font-size: 0.875rem;
    align-items: center;
    justify-content: space-between;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
}

#blazor-error-ui .dismiss:hover { opacity: 1; }

/* ─── Syncfusion Overrides ────────────────────────────────────── */
.e-input-group { border-radius: var(--r-md) !important; }
.e-input-group input { font-family: 'DM Sans', sans-serif !important; }
.e-btn { border-radius: var(--r-md) !important; font-family: 'DM Sans', sans-serif !important; }

/* ═══════════════════════════════════════════════════════════════
   DARK THEME — [data-theme="dark"]
═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    color-scheme: dark;

    /* Neutrals — Dark Obsidian / Slate */
    --stone-50:  #141721;
    --stone-100: #1a1e2b;
    --stone-200: #252a3d;
    --stone-300: #333a52;
    --stone-400: #64748b;
    --stone-500: #94a3b8;
    --stone-600: #cbd5e1;
    --stone-700: #e2e8f0;
    --stone-800: #f1f5f9;
    --stone-900: #ffffff;

    /* Surfaces */
    --bg:              #0f1117;
    --surface:         #1a1d27;
    --surface-2:       #22263a;
    --surface-3:       #2d3248;
    --surface-checked: rgba(34, 197, 94, 0.08);
    --surface-hover:   #252a3d;
    --card-bg:         #1a1d27;
    --border:          rgba(255, 255, 255, 0.09);
    --border-subtle:   rgba(255, 255, 255, 0.05);
    --border-hover:    rgba(255, 255, 255, 0.18);
    --border-focus:    var(--brand-500);

    /* Text */
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary:  #64748b;
    --text-inverse:   #0f1117;

    /* Semantic States in Dark */
    --surface-danger:  rgba(239, 68, 68, 0.12);
    --border-danger:   rgba(239, 68, 68, 0.3);
    --text-danger:     #f87171;

    --surface-warning: rgba(245, 158, 11, 0.12);
    --border-warning:  rgba(245, 158, 11, 0.3);
    --text-warning:    #fbbf24;

    --surface-info:    rgba(59, 130, 246, 0.12);
    --border-info:     rgba(59, 130, 246, 0.3);
    --text-info:       #60a5fa;

    --surface-success: rgba(34, 197, 94, 0.12);
    --border-success:  rgba(34, 197, 94, 0.3);
    --text-success:    #4ade80;

    --overlay-bg: rgba(0, 0, 0, 0.78);

    /* Bootstrap Dark Overrides */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border);
    --bs-card-bg: var(--surface);
    --bs-tertiary-bg: var(--surface-2);
    --bs-secondary-bg: var(--surface-2);

    --shadow-xs:  0 1px 2px rgba(0,0,0,0.4);
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.5);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.6);
    --shadow-lg:  0 20px 48px rgba(0,0,0,0.7);
    --shadow-xl:  0 32px 64px rgba(0,0,0,0.8);
}

[data-theme="dark"] .card {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: var(--surface-2);
    border-color: var(--brand-500);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-tertiary);
}

[data-theme="dark"] .btn-secondary {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-ghost {
    color: var(--text-secondary);
}

[data-theme="dark"] .btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-box {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .modal-overlay {
    background: var(--overlay-bg);
}

[data-theme="dark"] .category-header {
    color: var(--text-secondary);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .app-nav {
    background: var(--surface);
    border-top-color: var(--border);
}

[data-theme="dark"] .app-header {
    background: var(--surface);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .app-nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] .app-nav-link.active,
[data-theme="dark"] .app-nav-link:hover {
    color: var(--brand-500);
    background: rgba(34, 197, 94, 0.12);
}

[data-theme="dark"] .app-bottom-nav {
    background: var(--surface);
    border-top-color: var(--border);
}

[data-theme="dark"] .app-bottom-nav-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .app-bottom-nav-item:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .app-bottom-nav-item.active {
    color: var(--brand-500);
}

[data-theme="dark"] .summary-bar {
    background: var(--surface);
    border-top-color: var(--border);
}

[data-theme="dark"] .badge-stone {
    background: var(--surface-2);
    color: var(--text-secondary);
    border-color: var(--border);
}

[data-theme="dark"] .badge-green {
    background: var(--surface-success);
    color: var(--text-success);
    border-color: var(--border-success);
}

[data-theme="dark"] .autocomplete-dropdown {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .autocomplete-item:hover {
    background: var(--surface-2);
}

[data-theme="dark"] .sugestao-chip {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .sugestao-chip:hover {
    background: var(--surface);
    border-color: var(--brand-500);
}

[data-theme="dark"] .table {
    color: var(--text-primary);
}

[data-theme="dark"] .table thead th {
    border-bottom-color: var(--border);
    color: var(--text-secondary);
    background: var(--surface-2);
}

[data-theme="dark"] .table tbody tr td {
    border-bottom-color: var(--border);
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background: var(--surface-2);
}

[data-theme="dark"] .card-header {
    border-bottom-color: var(--border);
}

[data-theme="dark"] .alert-success {
    background: var(--surface-success);
    border-color: var(--border-success);
    color: var(--text-success);
}

[data-theme="dark"] .alert-error {
    background: var(--surface-danger);
    border-color: var(--border-danger);
    color: var(--text-danger);
}

[data-theme="dark"] .alert-warning {
    background: var(--surface-warning);
    border-color: var(--border-warning);
    color: var(--text-warning);
}

[data-theme="dark"] .alert-info {
    background: var(--surface-info);
    border-color: var(--border-info);
    color: var(--text-info);
}

[data-theme="dark"] .progress-bar-wrap {
    background: var(--surface-2);
}

[data-theme="dark"] input[type="checkbox"] {
    accent-color: var(--brand-500);
    border-color: var(--border);
}

[data-theme="dark"] select option {
    background: var(--surface);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL EXTERNAL LAYOUT & COMPONENT CLASSES
   Eliminates inline styles across pages & components
   ═══════════════════════════════════════════════════════════════ */

/* Page Headers & Breadcrumbs */
.page-breadcrumb-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.page-header-slash {
    color: var(--text-tertiary);
    user-select: none;
}

.page-header-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-top: 0.25rem;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.page-header-actions-end {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-title-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.btn-header-danger {
    color: var(--red-500);
    border: 1px solid var(--border-danger);
    background: transparent;
}

.btn-header-danger:hover {
    background: var(--surface-danger);
    color: var(--red-600);
    border-color: var(--red-400);
}

/* Dashboard Layout & KPI Stats */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-kpi-green {
    border-left: 4px solid var(--brand-500);
}

.stat-kpi-blue {
    border-left: 4px solid var(--blue-500);
}

.stat-kpi-purple {
    border-left: 4px solid #8b5cf6;
}

.stat-kpi-amber {
    border-left: 4px solid var(--amber-500);
}

.stat-val-green {
    color: var(--brand-600);
}

.dashboard-layout-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 992px) {
    .dashboard-layout-cols {
        grid-template-columns: 1fr 360px;
    }
}

.stack-vertical {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stack-vertical-lg {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.stack-vertical-sm {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Progress Summary Card */
.progress-card {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
}

.progress-card-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.progress-metrics-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 220px;
}

.progress-metric-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-metric-val {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.progress-val-green {
    color: var(--brand-600);
}

.progress-val-accent {
    color: var(--brand-700);
}

[data-theme="dark"] .progress-val-accent {
    color: var(--brand-400);
}

.progress-bar-meter {
    width: 110px;
    max-width: 100%;
}

.members-online-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.avatar-gradient-member {
    background: var(--brand-gradient);
    color: #FFFFFF;
}

.progress-metric-end {
    text-align: right;
    min-width: 100px;
}

@media (max-width: 768px) {
    .progress-card {
        padding: 0.6rem 0.85rem;
        margin-bottom: 0.75rem;
        border-radius: 14px;
    }

    .progress-card-content {
        margin-bottom: 0;
        gap: 0.6rem;
    }

    .progress-metrics-group {
        gap: 0.75rem;
        min-width: 0;
    }

    .progress-metric-val {
        font-size: 0.95rem;
    }

    .progress-metric-end {
        min-width: 75px;
    }

    .progress-bar-meter {
        width: 75px;
    }

    .members-online-bar {
        display: none;
    }
}

/* Market Session Banner */
.market-banner {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--stone-300);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: all 0.2s ease;
}

.market-banner.is-active {
    border-left: 3px solid var(--brand-500);
}

.market-banner-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.market-banner-icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
}

.market-banner-body {
    flex: 1;
    min-width: 0;
}

.market-banner-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.market-banner-title.is-active {
    color: var(--brand-600);
}

.market-banner-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.market-banner-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.market-banner-input-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.market-banner-suggestions {
    margin-top: 0.75rem;
}

.market-banner-error {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--danger);
}

.btn-banner-action {
    font-size: 0.75rem;
}

.btn-banner-close {
    font-size: 0.75rem;
    color: var(--danger);
}

.market-suggestions-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.market-chip-custom {
    border-color: var(--primary-subtle);
}

/* Danger Zone (Grupos e Listas) */
.danger-zone-box {
    margin-top: 2rem;
    padding: 1.25rem;
    border: 1px solid var(--border-danger);
    border-radius: var(--r-md);
    background: var(--surface-danger);
}

.danger-zone-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-danger);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.danger-zone-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Settings Page */
.settings-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 1rem;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.settings-card-body {
    padding: 1.75rem 2rem;
}

@media (max-width: 640px) {
    .settings-card-body {
        padding: 1.25rem 1.15rem;
    }
}

.settings-section-title {
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.theme-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.theme-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 600;
    font-size: 0.875rem;
    min-height: 84px;
}

.theme-option-btn:hover {
    border-color: var(--brand-500);
    color: var(--text-primary);
    background: var(--surface-2);
}

.theme-option-btn.is-active {
    border-color: var(--brand-500);
    background: var(--surface-success);
    color: var(--brand-700);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

[data-theme="dark"] .theme-option-btn.is-active {
    color: var(--brand-400);
}

.brand-gradient-title {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.settings-switch-input {
    width: 2.5rem;
    height: 1.25rem;
    cursor: pointer;
}

.settings-select {
    border-radius: 12px;
    padding: 0.625rem 1rem;
    background-color: var(--surface);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

.settings-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
    outline: none;
}

.btn-restore-default {
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-restore-default:hover {
    background: var(--surface-2);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-back-groups {
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.15s ease;
}

.btn-back-groups:hover {
    color: var(--text-primary);
}

/* Modals Reusable Forms & Layout */
.modal-box-md {
    max-width: 520px;
    width: 100%;
}

.modal-box-sm {
    max-width: 440px;
    width: 100%;
}

.modal-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.expense-split-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.expense-split-total {
    display: flex;
    justify-content: space-between;
    padding-top: 0.75rem;
    font-size: 0.825rem;
    color: var(--text-secondary);
}

.expense-split-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.expense-diff-pos {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
}

.expense-diff-neg {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--danger);
}

.expense-tx-from {
    font-weight: 600;
    color: var(--danger);
}

.expense-tx-to {
    font-weight: 600;
    color: var(--primary);
}

.expense-balanced-banner {
    background: var(--surface-success);
    border: 1px solid var(--primary-subtle);
    border-radius: var(--r-md);
    padding: 0.875rem;
    margin-bottom: 1.25rem;
    text-align: center;
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 600;
}

.input-prefix-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix-addon {
    position: absolute;
    left: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-with-prefix {
    padding-left: 2.5rem;
}

.btn-primary-gradient {
    background: var(--brand-gradient) !important;
    color: #FFFFFF !important;
    box-shadow: var(--brand-glow);
    border: none;
}

.modal-header-space {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.avatar-user-header {
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
}

.avatar-initials-btn {
    background: var(--brand-gradient);
    color: white;
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   REUSABLE SEMANTIC LAYOUT & COMPONENT CLASSES (NO INLINE STYLES)
   ═══════════════════════════════════════════════════════════════ */

/* Recurring suggestions panel */
.recurring-panel-card {
    margin-bottom: 0;
    padding: 1rem 1.25rem;
}

.recurring-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.recurring-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recurring-panel-title-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.recurring-panel-toggle-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

.sugestoes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sugestao-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--r-full);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sugestao-chip:hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--brand-500);
    box-shadow: var(--shadow-sm);
}

.sugestao-chip:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sugestao-chip-img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.sugestao-chip-icon {
    font-size: 0.9rem;
}

.sugestao-chip-nome {
    white-space: nowrap;
}

.sugestao-chip-freq {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--brand-600);
    background: var(--surface-success);
    border-radius: var(--r-full);
    padding: 0.1rem 0.35rem;
}

.sugestao-chip-adding {
    border-color: var(--brand-500);
    background: var(--surface-success);
}

/* Purchase history panel & tables */
.history-panel-card {
    margin-bottom: 0;
    padding: 0;
}

.history-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.history-panel-icon {
    color: var(--brand-600);
}

.history-table-container {
    overflow-x: auto;
}

.history-table {
    font-size: 0.85rem;
}

.history-table thead tr {
    background: var(--surface-2);
}

.history-actions-col {
    text-align: center;
    width: 60px;
}

.text-brand-price {
    font-weight: 700;
    color: var(--brand-700);
}

[data-theme="dark"] .text-brand-price {
    color: var(--brand-400);
}

/* Danger Zone & Outline buttons */
.btn-header-danger {
    color: var(--red-500) !important;
    border: 1px solid var(--border-danger) !important;
}

.btn-header-danger:hover {
    background: var(--surface-danger) !important;
    color: var(--red-500) !important;
}

.btn-danger-outline {
    color: var(--red-500) !important;
    border: 1px solid var(--border-danger) !important;
    background: transparent;
}

.btn-danger-outline:hover {
    background: var(--surface-danger) !important;
    color: var(--red-500) !important;
}

.page-header-spaced {
    margin-bottom: 1.25rem;
}

.panel-tab-content {
    margin-bottom: 1.25rem;
}

/* Group Detail & Members Panel */
.group-header-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-top: 0.25rem;
}

.group-header-icon {
    font-size: 2rem;
}

.group-header-actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.member-invite-box {
    padding: 0.875rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.member-invite-code {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    word-break: break-all;
    color: var(--text-primary);
}

.member-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem 0.5rem;
    border-radius: var(--r-md);
}

.avatar-brand-member {
    background: var(--brand-gradient);
    color: white;
}

.group-card-dashed {
    border-style: dashed;
    cursor: pointer;
    background: transparent;
    min-height: 200px;
    color: var(--text-secondary);
}

.group-card-plus-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-lg);
    border: 2px dashed var(--border);
    font-size: 1.5rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard Elements */
.dashboard-col-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.featured-list-card {
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

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

.featured-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--r-lg);
    background: var(--surface-success);
    color: var(--brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.featured-select {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 0.25rem 0.5rem;
    height: auto;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-primary);
}

.featured-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
}

.quick-add-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    display: block;
}

.quick-add-input {
    font-size: 0.95rem;
    height: 46px;
    border-radius: var(--r-lg);
}

.quick-add-btn {
    height: 46px;
    padding: 0 1.25rem;
    white-space: nowrap;
    border-radius: var(--r-lg);
}

.quick-sugestoes-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.quick-sugestao-pill {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quick-sugestao-pill:hover {
    background: var(--surface);
    border-color: var(--brand-500);
}

.featured-progress-banner {
    margin-bottom: 1.25rem;
    background: var(--surface-2);
    padding: 0.85rem 1rem;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
}

.featured-progress-meter {
    height: 8px;
}

.interactive-item-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.interactive-item-box.is-marked {
    background: var(--surface-2);
}

.interactive-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-600);
}

.interactive-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.interactive-item-name.is-marked {
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.side-list-card {
    padding: 0.75rem;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.side-list-card.is-selected {
    border-color: var(--brand-500);
    background: var(--surface-success);
}

.share-invite-code-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0.6rem;
    text-align: center;
    margin-bottom: 0.75rem;
}

.share-code-digits {
    font-family: monospace;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--brand-600);
}

.btn-whatsapp-share {
    background: #25D366 !important;
    border-color: #25D366 !important;
    color: #FFFFFF !important;
    font-weight: 700;
}

.quick-nav-card {
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--surface-2);
}

/* Mercados, Charts & Profile */
.market-badge-icon {
    background: var(--surface-success);
    color: var(--brand-600);
    font-size: 1.2rem;
}

.market-rank-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.market-rank-avatar.is-first {
    background: var(--brand-gradient);
    color: white;
}

.market-category-card {
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 0.875rem;
    border: 1px solid var(--border);
}

.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.profile-card {
    max-width: 560px;
    margin-bottom: 1.5rem;
}

.profile-card-body {
    padding: 2rem;
}

.profile-avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.profile-avatar-rel {
    position: relative;
}

.profile-avatar-img {
    width: 96px;
    height: 96px;
    border-radius: var(--r-full);
    object-fit: cover;
    box-shadow: var(--brand-glow);
}

.profile-avatar-initials {
    width: 96px;
    height: 96px;
    font-size: 2rem;
    background: var(--brand-gradient);
    color: white;
    box-shadow: var(--brand-glow);
}

.profile-avatar-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    border-radius: var(--r-full);
    cursor: pointer;
}

.profile-avatar-input {
    display: none;
}

.profile-avatar-remove {
    margin-top: 0.5rem;
    color: var(--text-danger);
}

.profile-avatar-error {
    font-size: 0.78rem;
    color: var(--text-danger);
    margin-top: 0.4rem;
}

.profile-name {
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.15rem;
}

.profile-email {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.profile-section-title {
    font-weight: 700;
    margin: 1.75rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.profile-section-sub {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.8rem;
}

.profile-submit-btn {
    margin-top: 0.5rem;
}

.profile-danger-card {
    max-width: 560px;
    background: var(--surface-danger);
    border: 1px solid var(--border-danger);
}

.profile-danger-body {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-danger-title {
    font-weight: 700;
    color: var(--text-danger);
    margin-bottom: 0.2rem;
}

.profile-danger-sub {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.app-nav-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
}

.app-nav-avatar-initials {
    background: var(--brand-gradient);
    color: white;
    cursor: pointer;
}

.emoji-picker-btn {
    font-size: 1.4rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--r-md);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.emoji-picker-btn:hover {
    background: var(--surface-2);
}

.emoji-picker-btn.is-selected {
    background: var(--surface-2);
    border-color: var(--brand-500);
    box-shadow: 0 0 0 2px var(--brand-500);
}

.color-swatch-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.15s ease;
}

.color-swatch-circle.is-selected {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.list-card-compact {
    border-radius: var(--r-md);
    padding: 0.6rem 0.875rem;
}

.list-card-icon-compact {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Auth / Invite helpers */
.auth-divider {
    margin: 1.5rem 0;
}

.auth-social-stack {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.auth-switch-text {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-switch-link {
    color: var(--brand-600);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch-link:hover {
    text-decoration: underline;
}

.auth-terms-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 1rem;
    line-height: 1.5;
}

.auth-terms-link {
    color: var(--text-secondary);
}

.invite-center-box {
    text-align: center;
    padding: 3rem 1rem;
}

.invite-error-box {
    text-align: center;
    padding: 2rem 0;
}

.invite-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.invite-header-box {
    text-align: center;
    margin-bottom: 1.75rem;
}

.invite-group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 2.25rem;
    margin-bottom: 0.875rem;
    border: 1px solid var(--border);
}

.invite-badge-label {
    color: var(--brand-600);
    margin-bottom: 0.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.invite-group-title {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
}

.invite-list-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface-2);
    padding: 0.35rem 0.85rem;
    border-radius: var(--r-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.35rem;
}

.invite-sub-text {
    font-size: 0.85rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.invite-avatar-group {
    justify-content: center;
    margin-top: 0.75rem;
}

.invite-card-member {
    padding: 1.5rem;
    text-align: center;
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.invite-status-icon {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.invite-status-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.invite-status-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.invite-tabs-container {
    display: flex;
    background: var(--surface-2);
    padding: 0.25rem;
    border-radius: var(--r-md);
    margin-bottom: 1.5rem;
    gap: 0.25rem;
    border: 1px solid var(--border);
}

.invite-tab-btn {
    flex: 1;
    border-radius: var(--r-sm);
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    padding: 0.4rem 0.5rem;
}

.invite-tab-btn.is-active {
    background: var(--surface);
    color: var(--brand-600);
    box-shadow: var(--shadow-xs);
    font-weight: 700;
}

.invite-disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 1.5rem;
    line-height: 1.5;
}

.modal-footer-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.danger-center-icon {
    border-radius: var(--r-full);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: var(--surface-danger);
    color: var(--text-danger);
    margin: 0 auto 1.5rem auto;
}

.filter-select-group {
    width: auto;
    min-width: 160px;
}

.filter-select-period {
    width: auto;
    min-width: 140px;
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL MOBILE-FIRST SYSTEM ADAPTATION
   Touch targets, fluid padding, iOS safe-areas & typography
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    /* 1. Page Header & Typography */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .page-title {
        font-size: 1.4rem;
        line-height: 1.2;
    }

    .page-sub {
        font-size: 0.82rem;
    }

    /* 2. Touch Targets & Buttons */
    .btn {
        min-height: 40px;
        padding: 0.45rem 0.85rem;
        font-size: 0.85rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    /* 3. Cards & Containers */
    .card {
        padding: 1rem 1.15rem;
        border-radius: var(--r-xl);
    }

    .list-card {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }

    .group-card {
        padding: 1rem;
    }

    /* 4. Form Controls & iOS Zoom Prevention */
    .form-control,
    select.form-control,
    textarea.form-control {
        font-size: 16px; /* Impede auto-zoom no iOS Safari */
        min-height: 44px;
        padding: 0.55rem 0.85rem;
    }

    /* 5. Modais como Bottom Sheets fluidos */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-box {
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        width: 100%;
        max-width: 100%;
        padding: 1.25rem 1.15rem;
    }

    .modal-box .btn-primary,
    .modal-box .btn-secondary {
        min-height: 44px;
        font-size: 0.9rem;
    }

    /* 6. Empty States compactos */
    .empty-state {
        padding: 2.5rem 1rem;
    }

    .empty-icon {
        font-size: 2.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ADMIN & DASHBOARD REUSABLE UTILITIES
═══════════════════════════════════════════════════════════════ */
.dashboard-chart-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.25rem;
}

@media (max-width: 991px) {
    .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }
}

.search-box-320 {
    max-width: 320px;
    width: 100%;
}

.search-box-600 {
    max-width: 600px;
    width: 100%;
}

.btn-close-alert {
    padding: 0.25rem;
    min-height: auto;
    color: currentColor;
    background: transparent;
    border: none;
    cursor: pointer;
}

.table-responsive {
    overflow-x: auto;
}

.avatar-user-neutral {
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 0.65rem;
    border: 1px solid var(--border);
}

.avatar-more-count {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 2px solid var(--surface);
    margin-left: -8px;
    font-size: 0.65rem;
    font-weight: bold;
}

.action-buttons-inline {
    display: inline-flex;
    gap: 0.375rem;
}

.provider-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.provider-accent-active {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--brand-gradient);
}

.provider-accent-inactive {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border);
}

.provider-status-dot-active {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px rgba(22, 163, 74, 0.4);
}

.provider-status-dot-inactive {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.provider-status-text-active {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.provider-status-text-inactive {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-tertiary);
}

.provider-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.cache-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: var(--primary-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.35rem;
}

.cache-table-wrapper {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.cache-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.cache-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

.cache-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.cache-table-header {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.cache-term-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.cache-term-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.cache-saved-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.cache-saved-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.cache-row:hover {
    background: var(--surface-2);
}

.code-brand {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem;
}

.code-preview-box {
    background: var(--surface-2);
    padding: 1.25rem;
    border-radius: var(--r-md);
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1.25rem;
    border: 1px solid var(--border);
}

.code-preview-content {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-mono, monospace);
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.img-preview-box {
    height: 140px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid var(--border);
}

.img-preview-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
}

.img-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 6px;
}

.img-preview-fallback {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: var(--brand-gradient);
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
}

.img-result-title {
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    height: 2.6em;
    margin-bottom: 0.25rem;
}


