:root {
    --brand-primary: #9168e8;
    --brand-secondary: #33d1e6;
    --brand-dark: #242082;
    --brand-primary-dim: rgba(145, 104, 232, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(145, 104, 232, 0.2);
    --ice-white: #f8fafc;
    --dark-gray: #1e293b;
    --text-accent: #9168e8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--ice-white);
    color: var(--dark-gray);
    overflow-x: hidden;
    font-size: 18px;
    line-height: 1.5;
}

/* ─── Prevent iOS auto-zoom on input focus ────────────────────────────────
   iOS Safari zooms in whenever an input has font-size < 16px.
   Setting 16px prevents zoom while keeping visual size via transform scale.
   ───────────────────────────────────────────────────────────────────────── */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (max-width: 768px) {

    input,
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important;
        touch-action: manipulation;
    }
}

/* Background Animation */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(145, 104, 232, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(145, 104, 232, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(145, 104, 232, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: -1;
    animation: float 20s infinite ease-in-out;
}

.bg-glow:nth-child(2) {
    top: 20%;
    right: 10%;
    animation-delay: -5s;
    background: radial-gradient(circle, rgba(145, 104, 232, 0.08) 0%, transparent 70%);
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.05),
        0 8px 10px -6px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.7s;
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 20px 40px rgba(145, 104, 232, 0.1),
        inset 0 0 0 1px rgba(145, 104, 232, 0.05);
    border-color: rgba(145, 104, 232, 0.4);
}

/* Accent Effects */
.accent-text {
    color: var(--brand-secondary);
    font-weight: 600;
}

.accent-border {
    border: 1px solid rgba(145, 104, 232, 0.4);
}

.accent-icon {
    color: var(--brand-secondary);
}

/* Typography */
.font-orbitron {
    font-family: 'Orbitron', sans-serif;
}

.font-rajdhani {
    font-family: 'Rajdhani', sans-serif;
}

/* Navigation Trigger */
.nav-trigger {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-trigger:hover {
    transform: translateY(-2px);
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(145, 104, 232, 0.1);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(145, 104, 232, 0.1);
    backdrop-filter: blur(4px);
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-menu {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    z-index: 3000;
    border-right: 1px solid var(--glass-border);
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--brand-primary-dim);
    border-radius: 10px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary);
}

.sidebar-menu.active {
    left: 0;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header img {
    width: 55px;
    height: 55px;
    object-fit: contain;
}

.header-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .header-logo {
        width: 55px;
        height: 55px;
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    color: var(--dark-gray);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    /* Slightly larger */
    transition: all 0.3s;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--brand-orange);
}

.sidebar-link:hover {
    background: rgba(255, 77, 0, 0.05);
    transform: translateX(5px);
}

.sidebar-link.active {
    background: rgba(145, 104, 232, 0.1);
    border-color: var(--brand-orange);
    color: var(--brand-primary);
    font-weight: 600;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(145, 104, 232, 0.25);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(145, 104, 232, 0.7);
}

/* Input Styling */
.glass-input {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    color: var(--dark-gray);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.glass-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 20px rgba(145, 104, 232, 0.2);
}

/* Button Effects */
.accent-button {
    background: linear-gradient(135deg, rgba(145, 104, 232, 0.1), rgba(145, 104, 232, 0.05));
    border: 1px solid rgba(145, 104, 232, 0.5);
    color: var(--brand-secondary);
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.accent-button:hover {
    background: rgba(145, 104, 232, 0.2);
    box-shadow: 0 10px 25px rgba(145, 104, 232, 0.2);
    transform: scale(1.02);
}

.accent-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.accent-button:hover::after {
    opacity: 1;
    left: 100%;
}

/* Table Styling */
.glass-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.glass-table tr {
    background: rgba(0, 0, 0, 0.01);
    transition: all 0.3s;
}

.glass-table tr:hover {
    background: rgba(145, 104, 232, 0.05);
    transform: scale(1.01);
}

.glass-table td {
    padding: 18px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 1.05rem;
}

.glass-table td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px 0 0 12px;
}

.glass-table td:last-child {
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0 12px 12px 0;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-success {
    background: rgba(145, 104, 232, 0.05);
    color: var(--brand-secondary);
    border: 1px solid rgba(145, 104, 232, 0.3);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.6s ease-out forwards;
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Floating Particles */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--brand-primary);
    border-radius: 50%;
    opacity: 0.2;
    animation: particle-float 10s infinite;
    pointer-events: none;
}

@keyframes particle-float {

    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 0.3;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--brand-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(145, 104, 232, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: none;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 15px 35px rgba(145, 104, 232, 0.4);
    background: var(--brand-secondary);
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.modal-body {
    padding: 2rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--slate-500);
    border: 1px solid var(--glass-border);
    background: white;
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
    transform: rotate(90deg);
}

/* Custom Scrollbar for Modal */
.modal-container::-webkit-scrollbar {
    width: 6px;
}

.modal-container::-webkit-scrollbar-track {
    background: transparent;
}

.modal-container::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.modal-container::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary-dim);
}

/* === MOBILE RESPONSIVENESS === */

/* Prevent text overflow everywhere */
* {
    -webkit-overflow-scrolling: touch;
}

/* Tables: Always show as table (Excel style), enable horizontal scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Compact table that stays as table on all screen sizes */
.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    white-space: nowrap;
    min-width: 400px;
    /* force scroll before collapsing */
}

.compact-table thead tr {
    background: rgba(248, 250, 252, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.compact-table thead th {
    padding: 8px 10px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #94a3b8;
    text-align: left;
    white-space: nowrap;
}

.compact-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 11px;
    color: #334155;
    vertical-align: middle;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-table tbody tr:hover {
    background: rgba(145, 104, 232, 0.04);
}

.compact-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 768px) {

    /* Body: zero padding so content fills edge to edge */
    body {
        padding: 0 !important;
        overflow-x: hidden;
    }

    /* Wrapper inside body: small inner padding */
    body>.glass-card,
    body>div:not(#particles):not(.bg-grid):not(.bg-glow):not(.sidebar-overlay):not(.sidebar-menu):not(.modal-overlay) {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Header compact: stick to top edge */
    .main-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 0.6rem 0.75rem !important;
        border-radius: 0 0 16px 16px !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-top: none !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
        z-index: 2000 !important;
        /* Ensure it stays above everything */
    }

    .main-header h1 {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
    }

    .main-header p {
        display: none;
    }

    .header-logo {
        width: 34px !important;
        height: 34px !important;
    }

    .header-divider,
    .header-user-badge,
    .header-info-day {
        display: none !important;
    }

    /* Sidebar */
    .sidebar-menu {
        width: 82% !important;
        max-width: 280px !important;
    }

    /* Stats grid: 2 columns on mobile */
    .grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .grid-cols-1.md\\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Stats cards: compact */
    .glass-card {
        border-radius: 14px !important;
    }

    .glass-card.p-6 {
        padding: 0.75rem !important;
    }

    .glass-card .text-3xl,
    .glass-card .text-4xl {
        font-size: 1.5rem !important;
        /* Increased for mobile visibility */
    }

    .glass-card .mb-4 {
        margin-bottom: 0.5rem !important;
    }

    .glass-card .w-12.h-12 {
        width: 2rem !important;
        height: 2rem !important;
    }

    .glass-card .text-xl {
        font-size: 0.9rem !important;
    }

    /* glass-table: keep as table, enable horizontal scroll */
    .glass-table {
        width: 100%;
        border-spacing: 0 1px;
        font-size: 14px;
        /* Larger text in tables on mobile */
        white-space: nowrap;
    }

    .glass-table thead {
        display: table-header-group !important;
        /* KEEP header visible */
    }

    .glass-table,
    .glass-table tbody,
    .glass-table tr,
    .glass-table td {
        display: revert !important;
        /* DO NOT stack into cards */
    }

    .glass-table thead th {
        padding: 8px 8px 8px 8px !important;
        font-size: 8px !important;
    }

    .glass-table td {
        padding: 7px 8px !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
        border-radius: 0 !important;
    }

    .glass-table td:first-child {
        border-radius: 0 !important;
    }

    .glass-table td:last-child {
        border-radius: 0 !important;
    }

    .glass-table td::before {
        display: none !important;
        /* no label prefix */
    }

    /* Wrap all tables in horizontal scroll */
    .overflow-x-auto {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Remove hover scale on table rows for mobile */
    .glass-table tr:hover {
        transform: none !important;
    }

    /* Section padding: edge-to-edge cards */
    .glass-card {
        border-radius: 12px !important;
        margin-left: 0.375rem !important;
        margin-right: 0.375rem !important;
    }

    .glass-card.p-6.slide-in {
        padding: 0.75rem !important;
    }

    .p-8 {
        padding: 0.75rem !important;
    }

    /* Stats grid: near edge-to-edge */
    .mb-8,
    .mb-6 {
        margin-bottom: 0.5rem !important;
    }

    /* Main page content: small horizontal padding */
    .min-h-screen {
        padding: 0 0.375rem !important;
    }

    /* Search bar */
    .glass-input {
        font-size: 15px !important;
        padding: 0.75rem 1rem !important;
    }

    /* FAB */
    .fab {
        bottom: 1rem !important;
        right: 1rem !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 1.2rem !important;
    }

    /* Modal: TRUE full screen on mobile */
    .modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal-container {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transform: translateY(100%) !important;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .modal-overlay.active .modal-container {
        transform: translateY(0) !important;
    }

    .modal-header {
        padding: 1rem 1rem !important;
    }

    .modal-body {
        padding: 1rem 1rem !important;
        padding-bottom: 5rem !important;
        /* space for FABs */
    }

    /* Grid sections inside glass-card */
    .grid.grid-cols-1.md\\:grid-cols-2.gap-6,
    .grid.grid-cols-2.gap-4,
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    /* Font sizes */
    .font-orbitron.text-xl {
        font-size: 1.1rem !important;
    }

    .font-orbitron.text-lg {
        font-size: 0.85rem !important;
    }

    /* Chart */
    .chart-container {
        height: 200px !important;
    }

    /* Profile page buttons */
    .fixed.bottom-6 {
        bottom: 0.75rem !important;
    }

    /* Flex wrap prevention */
    .flex-col.md\\:flex-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* Table section header */
    .mb-8 {
        margin-bottom: 0.75rem !important;
    }

    /* History tables on profile page */
    #dividasHistory tr td,
    #pagamentosHistory tr td {
        padding: 10px 12px !important;
        font-size: 14px !important;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    body {
        padding: 0.75rem !important;
    }

    .main-header {
        padding: 0.75rem 1.25rem !important;
        margin-bottom: 1rem !important;
    }

    .glass-card.p-6 {
        padding: 1rem !important;
    }

    .glass-table {
        font-size: 12px;
    }

    .glass-table td {
        padding: 10px 10px !important;
    }

    .modal-container {
        max-width: 90vw !important;
    }
}


/* PWA Display Fixes */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar-menu {
        height: 100vh;
        padding-top: calc(2rem + env(safe-area-inset-top));
    }
}

/* Autocomplete System */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 77, 0, 0.2);
    border-radius: 12px;
    margin-top: 5px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 3000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
}

.autocomplete-results.active {
    display: block;
    animation: fadeInAutoc 0.2s ease-out;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(145, 104, 232, 0.05);
    padding-left: 20px;
}

.autocomplete-item .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 77, 0, 0.15);
    color: #FF4D00;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.autocomplete-item .info {
    display: flex;
    flex-direction: column;
}

.autocomplete-item .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
}

.autocomplete-item .sub {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
}

/* Member Preview Panel */
.member-preview-panel {
    background: rgba(255, 77, 0, 0.03);
    border: 1px dashed rgba(255, 77, 0, 0.2);
    border-radius: 16px;
    padding: 1rem;
    margin-top: 1rem;
    display: none;
}

.member-preview-panel.active {
    display: block;
    animation: slideInPre 0.3s ease-out;
}

@keyframes fadeInAutoc {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInPre {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Main Header */
.main-header {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    width: auto;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(145, 104, 232, 0.2);
    border-top: 3px solid var(--brand-primary);
    border-radius: 60px;
    /* More rounded premium look */
    padding: 0.8rem 2.5rem;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.header-divider {
    width: 1px;
    height: 40px;
    background: rgba(0, 0, 0, 0.08);
    margin: 0 1rem;
}

.notification-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(145, 104, 232, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--brand-primary);
    transition: all 0.3s;
}

.notification-btn:hover {
    background: rgba(145, 104, 232, 0.1);
    transform: scale(1.05);
}

.notification-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.header-user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(145, 104, 232, 0.2);
}

@media (max-width: 768px) {
    /* Redundant main-header block removed */
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 70px;
    right: 0;
    width: 320px;
    max-height: 480px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: top right;
    animation: dropdownScale 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notification-dropdown.active {
    display: flex;
}

.notification-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
}

.notification-header h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.notification-list {
    overflow-y: auto;
    flex: 1;
}

.notification-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 0.75rem;
    transition: background 0.2s;
    position: relative;
}

.notification-item:hover {
    background: rgba(255, 77, 0, 0.03);
}

.notification-item:last-child {
    border-bottom: none;
}

.noti-icon {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.noti-content {
    flex: 1;
}

.noti-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 2px;
}

.noti-text {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.2;
}

.noti-time {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
}

.noti-delete {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.noti-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.notification-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: #94a3b8;
}

.notification-empty i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Toast Container for Stacking Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

#toast-container .glass-card {
    pointer-events: auto;
    width: 320px;
    margin-bottom: 0px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#toast-container .glass-card.show {
    transform: translateX(0);
}

/* Table Sorting */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.sortable-header:hover {
    color: var(--brand-primary);
}

.sortable-header i {
    margin-left: 5px;
    font-size: 0.7rem;
    opacity: 0.5;
}

.sortable-header.active {
    color: var(--brand-primary);
}

.sortable-header.active i {
    opacity: 1;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 77, 0, 0.2);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 77, 0, 0.4);
}

.active-tab-red {
    background: white !important;
    border: 1px solid #fee2e2 !important;
    color: #ef4444 !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
}

.active-tab-green {
    background: white !important;
    border: 1px solid #d1fae5 !important;
    color: #10b981 !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
}

/* Scrollbar Customization for Invoice */
.invoice-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--brand-primary) transparent;
}

.invoice-scroll::-webkit-scrollbar {
    width: 6px;
}

.invoice-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.invoice-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(145, 104, 232, 0.2);
    border-radius: 20px;
    border: 2px solid transparent;
}

.invoice-scroll:hover::-webkit-scrollbar-thumb {
    background-color: rgba(145, 104, 232, 0.5);
}