:root {
    --primary: #0066ff;
    --primary-light: #e6f0ff;
    --secondary: #6c757d;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #1a1a1a;
    --bg-body: #f4f5f7;
    --bg-card: #ffffff;
    --text-main: #2b3674;
    --text-muted: #a3aed1;
    --border-color: rgba(0,0,0,0.05);
    --sidebar-width: 280px;
    --radius: 24px;
    --shadow: 0px 18px 40px rgba(112, 144, 176, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --bg-body: #1a1a1a;
    --bg-card: #2d2d2d;
    --text-main: #f5f5f5;
    --text-muted: #a0a0a0;
    --border-color: rgba(255,255,255,0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.app-container {
    background: #ffffff;
    border-radius: 32px;
    box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.05);
    display: flex;
    width: 100%;
    min-height: calc(100vh - 48px);
    overflow: hidden;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: transparent;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: var(--transition);
    border-right: 1px solid rgba(0,0,0,0.03);
}

.sidebar.collapsed {
    left: calc(var(--sidebar-width) * -1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 40px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 6px;
}

.logo-icon div {
    background: white;
    border-radius: 2px;
}

.nav-menu {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-link i {
    font-size: 18px;
}

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #b2bec3;
    letter-spacing: 1px;
    margin: 24px 0 12px 16px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 40px 48px;
    min-width: 0;
    transition: var(--transition);
    background: transparent;
}

.main-content.sidebar-hidden {
    margin-left: 0;
}

.main-content.full-width {
    margin-left: 0;
    max-width: 100%;
    padding: 40px 8%;
    margin: 0 auto;
}

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

/* Top Nav Pills */
.top-nav-pills {
    display: flex;
    gap: 12px;
    background: white;
    padding: 8px;
    border-radius: 40px;
    box-shadow: var(--shadow);
}

.pill-link {
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.pill-link.active, .pill-link:hover {
    background: var(--primary);
    color: white;
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-select {
    padding: 10px 36px 10px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-main);
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--bg-card);
    box-shadow: var(--shadow);
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary);
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 6px 16px;
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dfe6e9;
    overflow: hidden;
}

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

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

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card.dark-card {
    background: var(--dark);
    color: white;
}

.card.dark-card .stat-label {
    color: rgba(255,255,255,0.7);
}

.card.dark-card .stat-value {
    color: white;
}

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

.card.primary-card .stat-label {
    color: rgba(255,255,255,0.8);
}

.card.primary-card .stat-value {
    color: white;
}

.card:hover {
    transform: translateY(-5px);
}

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.badge-success { background: #e3f9e5; color: #1f7a33; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

/* Grid Layout for Charts & Tables */
.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.chart-container {
    width: 100%;
    position: relative;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Custom Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    padding: 16px;
    border-bottom: 1px solid #f1f2f6;
}

td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f2f6;
}

.status-pill {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-new { background: #eef2ff; color: #4338ca; }
.status-done { background: #ecfdf5; color: #065f46; }

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #0069d9;
}

/* Floating WhatsApp Simulator */
#wa-simulator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
    border: 1px solid #e1e1e1;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#wa-simulator.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.wa-header {
    background: #075e54;
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-body {
    flex-grow: 1;
    background: #e5ddd5;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wa-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    position: relative;
}

.wa-msg-received {
    align-self: flex-start;
    background: white;
}

.wa-msg-sent {
    align-self: flex-end;
    background: #dcf8c6;
}

.wa-footer {
    padding: 12px;
    background: #f0f0f0;
    display: flex;
    gap: 10px;
}

.wa-input {
    flex-grow: 1;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    outline: none;
}

.wa-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(37, 211, 102, 0.4);
    z-index: 2001;
}

/* Face Detection Overlay */
.face-container {
    position: relative;
    display: inline-block;
}

.face-box {
    position: absolute;
    border: 2px solid var(--primary);
    border-radius: 4px;
    pointer-events: none;
}
