/* Premium Glassmorphism & Dark Space Theme */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* HSL Colors */
    --color-bg-deep: #090c15;
    --color-bg-card: rgba(17, 24, 39, 0.7);
    --color-bg-card-hover: rgba(31, 41, 55, 0.8);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-light: rgba(255, 255, 255, 0.04);
    --color-border-hover: rgba(124, 58, 237, 0.4);
    
    --color-text-primary: #f8fafc;
    --color-text-secondary: #94a3b8;
    --color-text-tertiary: #64748b;
    --color-white: #ffffff;
    
    /* Branding Accent & Gradients */
    --color-accent-primary: #8b5cf6; /* Violet */
    --color-accent-secondary: #3b82f6; /* Blue */
    --color-accent-gradient: linear-gradient(135deg, #7c3aed, #2563eb);
    --color-accent-gradient-hover: linear-gradient(135deg, #8b5cf6, #3b82f6);
    --color-accent-glow: rgba(124, 58, 237, 0.3);
    
    /* Alert Status Colors (Soft glass colors) */
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.15);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.15);
    --color-error: #ef4444;
    --color-error-bg: rgba(239, 68, 68, 0.15);
    --color-info: #06b6d4;
    --color-info-bg: rgba(6, 182, 212, 0.15);

    /* Fonts & Radii */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;

    /* Elevation / Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.25);
    --shadow-glass: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-deep);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-deep);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-primary);
}

/* Typography */
.text-display { font-size: 2.25rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.text-headline { font-size: 1.875rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
.text-title { font-size: 1.25rem; line-height: 1.4; font-weight: 600; }
.text-body { font-size: 0.925rem; line-height: 1.6; font-weight: 400; }
.text-label { font-size: 0.75rem; line-height: 1.5; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-white { color: var(--color-white); }
.text-danger-500 { color: var(--color-error); }

/* Layout Structure */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(10, 15, 30, 0.95);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 40;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-brand .text-title {
    color: var(--color-text-primary);
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand .text-sm {
    color: var(--color-text-secondary);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text-primary);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--color-text-primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.15);
}

.icon {
    width: 20px;
    height: 20px;
    color: currentColor;
    transition: transform 0.25s;
}

.nav-item:hover .icon {
    transform: scale(1.1);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2.5rem;
    background: rgba(9, 13, 22, 0.8);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 30;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.content-wrapper {
    padding: 2.5rem;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    background: var(--color-bg-deep);
}

/* Cards (Glassmorphism) */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm), var(--shadow-glass);
    backdrop-filter: blur(16px);
}

.card:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--color-border-hover);
    background: var(--color-bg-card-hover);
    transform: translateY(-2px);
}

/* Stats Cards */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm), var(--shadow-glass);
    backdrop-filter: blur(16px);
}

.stat-card:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--color-border-hover);
    background: var(--color-bg-card-hover);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 28px;
    color: var(--color-text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent-primary);
    transition: transform 0.3s;
}

.stat-card:hover .stat-icon {
    transform: rotate(5deg) scale(1.05);
}

/* Grid & Flex */
.grid { display: grid; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Spacing */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* Borders & Rounded */
.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-16 { width: 4rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-32 { height: 8rem; }

/* Buttons (Modern Gradient Look) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-accent-gradient);
    color: var(--color-white);
    box-shadow: 0 4px 14px var(--color-accent-glow);
}

.btn-primary:hover {
    background: var(--color-accent-gradient-hover);
    box-shadow: 0 6px 20px var(--color-accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--color-error);
    color: var(--color-white);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

/* Forms styling */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.form-input {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: all 0.25s;
    box-shadow: var(--shadow-glass);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2), var(--shadow-glass);
    background: rgba(0, 0, 0, 0.3);
}

.form-input::placeholder {
    color: var(--color-text-tertiary);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.75rem;
}

select.form-input option {
    background: var(--color-bg-deep);
    color: var(--color-text-primary);
}

/* Authentication pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: var(--color-bg-deep);
    background-image: radial-gradient(circle at top right, rgba(124, 58, 237, 0.08), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.08), transparent 40%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-card);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    backdrop-filter: blur(20px);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 2.5rem;
}

.auth-brand .text-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-white);
    background: linear-gradient(to right, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-brand .text-sm {
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-error {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    background: var(--color-error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-error);
    font-size: 0.875rem;
    font-weight: 500;
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 2rem;
}

.auth-footer a {
    color: var(--color-accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Tables Redesign */
.table-container {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.825rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-primary);
    transition: background-color 0.2s;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

tr:last-child td {
    border-bottom: none;
}

/* Badges (Glassy Pill style) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.badge-pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-cleared, .badge-approved, .badge-processed {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-failed, .badge-cancelled {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Links */
a {
    color: var(--color-accent-primary);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--color-accent-secondary);
}

/* Utilities */
.cursor-pointer { cursor: pointer; }
.transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
.transition-all { transition-property: all; transition-duration: 200ms; }

/* Animations */
.animate-pulse {
    animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.3; }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .topbar {
        justify-content: space-between;
        padding: 0 1.5rem;
    }
    .mobile-menu-btn {
        display: block;
    }
    .content-wrapper {
        padding: 1.5rem;
    }
}

@media (max-width: 640px) {
    .grid-cols-1 { grid-template-columns: 1fr; }
    .content-wrapper {
        padding: 1rem;
    }
    .card {
        padding: 1.5rem;
    }
}

/* Aviso neutro do fluxo de cadastro: "recebido, em análise" não é erro,
   e pintar de vermelho faria a primeira tela do parceiro parecer recusa. */
.auth-notice { background: rgba(56, 189, 248, 0.10); border: 1px solid rgba(56, 189, 248, 0.35); color: #7dd3fc; padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; }

/* Dicas do cadastro: dizem no formulário o que hoje só se descobria no primeiro
   pagamento (PF não recebe ainda; o documento é conferido na Receita). */
.form-hint { margin-top: 0.35rem; font-size: 0.78rem; line-height: 1.45; color: rgba(148, 163, 184, 0.9); }
.form-check { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.85rem; line-height: 1.45; cursor: pointer; }
.form-check input { margin-top: 0.2rem; flex-shrink: 0; }
