:root {
    /* Color Palette - Modern SaaS */
    --primary-color: #ffca18; /* Acento da marca */
    --primary-hover: #e6b615;
    --accent-blue: #4318FF; /* Azul/Roxo Tech */
    --secondary-color: #A3AED0;
    --success-color: #05CD99;
    --danger-color: #EE5D50;
    --warning-color: #FFCE20;
    --info-color: #3965FF;

    --bg-body: #F4F7FE;
    --bg-card: #FFFFFF;
    --bg-hover: #F4F7FE;
    --bg-input: #F8FAFC;
    --text-main: #2B3674;
    --text-muted: #A3AED0;
    --border-color: #E0E5F2;

    --sidebar-width: 280px;
    --header-height: 80px;
    --transition-speed: 0.3s;

    --shadow-sm: 0 1px 2px rgba(112, 144, 176, 0.08);
    --shadow-md: 0px 18px 40px rgba(112, 144, 176, 0.12);
    --shadow-lg: 0px 20px 50px rgba(112, 144, 176, 0.15);
    
    --radius-md: 14px;
    --radius-lg: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

body.dark-theme {
    --bg-body: #0B1437;
    --bg-card: #111C44;
    --bg-hover: #1B254B;
    --bg-input: #0F172A;
    --text-main: #FFFFFF;
    --text-muted: #A3AED0;
    --border-color: #1B254B;
}

body.dark-theme .menu-item.active {
    color: #FFFFFF;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

h1 {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    letter-spacing: -0.02em;
}

h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

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

/* Sidebar (Super Clean White) */
.sidebar {
    width: 80px;
    background-color: var(--bg-card);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    overflow: hidden;
    box-shadow: 14px 17px 40px 4px rgba(112, 144, 176, 0.08);
}

.sidebar:hover { width: var(--sidebar-width); }

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
    max-width: 45px;
    height: auto;
    transition: all 0.3s ease;
}

.sidebar:hover .sidebar-header img { max-width: 140px; }

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 0;
    color: var(--text-muted);
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    cursor: pointer;
    margin: 0.25rem 1rem;
    border-radius: var(--radius-md);
}

.menu-item i {
    width: 50px;
    text-align: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.menu-item span {
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar:hover .menu-item span { opacity: 1; }

.menu-item:hover {
    color: var(--accent-blue);
    background-color: var(--bg-hover);
}

.menu-item.active {
    color: var(--accent-blue);
    background-color: var(--bg-hover);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    right: -1rem;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: var(--accent-blue);
    border-radius: 4px 0 0 4px;
}

.nav-section-title {
    padding: 1.5rem 0 0.5rem 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
}

.sidebar:hover .nav-section-title {
    opacity: 1;
    text-align: left;
    padding-left: 1.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 80px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* Header */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-body);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    border-bottom: none;
}

.top-header .header-left { display: none; }
#sidebar-toggle { display: none; }

.page-content { padding: 2rem; flex: 1; }

/* Components */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #FFFFFF !important;
}

.btn-primary:hover {
    background-color: #3311db;
    box-shadow: 0 10px 20px -10px rgba(67, 24, 255, 0.5);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background-color: var(--bg-hover);
}

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

/* Forms */
.form-group { margin-bottom: 1.5rem; }

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    font-family: inherit;
    background-color: var(--bg-input);
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(67, 24, 255, 0.1);
}

/* Tables */
.table-responsive { overflow-x: auto; border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-md); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; }

.table th {
    background-color: var(--bg-card);
    text-align: left;
    padding: 1.25rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
}

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

.status-badge {
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
    letter-spacing: 0.02em;
}

.status-active, .status-paid { background-color: rgba(5, 205, 153, 0.1); color: #05CD99; }
.status-inactive, .status-pending { background-color: rgba(238, 93, 80, 0.1); color: #EE5D50; }

/* Utilities */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Overlay for Mobile */
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(11, 20, 55, 0.5); backdrop-filter: blur(4px);
    z-index: 95; display: none; opacity: 0; transition: opacity var(--transition-speed);
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar { width: 280px !important; transform: translateX(-100%); transition: transform var(--transition-speed); box-shadow: var(--shadow-lg); overflow-y: auto !important; }
    .sidebar.active { transform: translateX(0); }
    .sidebar .menu-item i { width: 50px !important; text-align: center; }
    .sidebar .menu-item span { opacity: 1 !important; visibility: visible !important; display: inline-block !important; }
    .sidebar .nav-section-title { opacity: 1 !important; visibility: visible !important; text-align: left !important; padding: 1.5rem 0 0.5rem 1.5rem !important; display: block !important; }
    .sidebar .sidebar-header img { max-width: 140px !important; }
    .main-content { margin-left: 0; }
    .top-header { position: sticky; padding: 0 1rem; background-color: var(--bg-body); }
    .top-header .header-left { display: block !important; }
    #sidebar-toggle { display: inline-flex !important; }
    
    /* Espaçamentos e Estruturas Otimizados */
    .page-content { padding: 1rem !important; }
    
    /* Helpers Globais para Mobile */
    .flex-col-mobile { flex-direction: column !important; align-items: stretch !important; gap: 0.75rem !important; }
    .w-full-mobile { width: 100% !important; max-width: 100% !important; }
    .text-center-mobile { text-align: center !important; justify-content: center !important; }
    .hide-mobile { display: none !important; }
    .grid-1-mobile { grid-template-columns: 1fr !important; }
    
    /* Tabelas sempre roláveis */
    .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-responsive::-webkit-scrollbar { height: 6px; }
    .table-responsive::-webkit-scrollbar-track { background: transparent; }
    .table-responsive::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
}

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11, 20, 55, 0.5); backdrop-filter: blur(4px);
    z-index: 1000; display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: var(--bg-card); padding: 2.5rem; border-radius: var(--radius-lg);
    width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto;
    position: relative; box-shadow: var(--shadow-lg); border: none;
}
.modal-close { position: absolute; top: 1.5rem; right: 1.5rem; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }