:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent: #059669; /* Verde AIBA */
    --accent-hover: #047857;
    --success: #10b981;
    --warning: #f59e0b; /* Amarelo/Laranja AIBA */
    --danger: #ef4444;
    --border: #e2e8f0;
    
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px rgba(5, 150, 105, 0.3);
}

html.dark {
    --bg-main: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .brand h2, 
.sidebar.collapsed .nav-item span:not(.icon) {
    display: none;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}
.brand-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand h2 {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.nav-menu {
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--bg-surface-hover);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(5, 150, 105, 0.1);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    min-width: 0;
}

.topbar {
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    z-index: 10;
    transition: background-color 0.3s;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
}

.page-title h1 {
    font-size: 20px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.icon-btn:hover {
    color: var(--text-main);
}
.badge-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: var(--danger);
    border-radius: 50%;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
}

.user-profile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 8px 0;
    min-width: 150px;
    display: none;
}

.user-profile-menu.show {
    display: block;
}

.user-profile-menu a {
    display: block;
    padding: 8px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
}
.user-profile-menu a:hover {
    background-color: var(--bg-surface-hover);
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #059669, #047857);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.notifications-panel {
    position: absolute;
    top: 60px;
    right: 120px;
    width: 320px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: none;
    flex-direction: column;
    max-height: 400px;
    overflow-y: auto;
}
.notifications-panel.show {
    display: flex;
}
.notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.content-area {
    padding: 32px;
}

/* Cards & Layout */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s, border-color 0.3s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -2px rgb(0 0 0 / 0.2);
}

/* Glassmorphism Glow Cards */
.kpi-card {
    position: relative;
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--glow-color, var(--border)) !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: visible;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: -4px; right: 0; bottom: 0;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 0 transparent;
    transition: box-shadow 0.4s ease;
    z-index: -1;
    pointer-events: none;
}

.kpi-card:hover {
    transform: translateY(-6px);
    border-color: var(--glow-color, var(--border));
}

.kpi-card:hover::before {
    box-shadow: 0 14px 28px -5px var(--glow-shadow, rgba(0,0,0,0.1));
}

.card-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
}

/* Tables */
.table-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--bg-surface-hover);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Skeleton Loader Effect */
html.skeleton-active .card-value,
html.skeleton-active canvas,
html.skeleton-active td,
html.skeleton-active .badge {
    color: transparent !important;
    background-color: var(--bg-surface-hover) !important;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    border-color: transparent !important;
    box-shadow: none !important;
    pointer-events: none;
}

html.skeleton-active .badge::after,
html.skeleton-active td::after,
html.skeleton-active .card-value::after,
html.skeleton-active canvas::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: skeleton-shine 1s infinite linear;
    z-index: 10;
}

@keyframes skeleton-shine {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Premium Checkboxes */
.premium-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
    vertical-align: middle;
}

/* Bulk Action Bar */
.bulk-action-bar {
    position: fixed;
    bottom: -100px;
    left: calc(50% + 125px); /* Offset for sidebar */
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}
.bulk-action-bar.visible {
    bottom: 32px;
}
.bulk-action-bar .badge-count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    margin-right: 8px;
}

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

tr:hover td {
    background-color: var(--bg-surface-hover);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px -2px var(--badge-glow, transparent);
    transition: all 0.3s ease;
}

.badge::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: badge-shine 3s infinite;
}

@keyframes badge-shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.badge-warning {
    --badge-glow: rgba(245, 158, 11, 0.4);
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-success {
    --badge-glow: rgba(16, 185, 129, 0.4);
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-muted {
    --badge-glow: rgba(148, 163, 184, 0.2);
    background-color: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
    animation: none; /* No shine for muted */
}
.badge-muted::after {
    display: none;
}

/* Utils */
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.flex { display: flex; }
.gap-4 { gap: 16px; }
.items-end { align-items: flex-end; }

.sidebar.collapsed .hide-on-collapse {
    display: none !important;
}

/* Fix dark mode calendar icon visibility */
html.dark input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.8; }
html.dark input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }
