:root {
    --primary: #1a2a6c;
    --secondary: #b21f1f;
    --accent: #fdbb2d;
    --bg-main: #f4f7f6;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #dcdde1;
    --success: #27ae60;
    --warning: #f39c12;
    --error: #e74c3c;
    --sidebar-width: 260px;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
}

/* Typography */
h1, h2, h3 {
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }

/* Components */
.brand {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 3rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background: var(--accent);
    color: var(--primary);
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card.accent { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.error { border-left-color: var(--error); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Tables */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    background: #f8f9fa;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:hover td {
    background: #fcfcfc;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.customer-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.customer-list-item:last-child {
    border-bottom: none;
}

.customer-list-item:hover {
    background: #f9f9f9;
}

.search-bar {
    position: sticky;
    top: 0;
    background: white;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.receipt-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    max-width: 400px;
    margin: 2rem auto;
    box-shadow: var(--shadow);
}

.success-icon {
    width: 64px;
    height: 64px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.badge-success { background: #e3f9e5; color: #1f7a33; }
.badge-warning { background: #fff4e5; color: #b45d00; }
.badge-danger { background: #ffebeb; color: #c53030; }

/* Forms & Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #131e4e; }

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

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
}

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

/* Agent Specific */
.daily-collection-card {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f);
    color: white;
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collection-target {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Icon Placeholders */
.placeholder-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Utility */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.header-main { display: flex; justify-content: space-between; align-items: center; }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 1.5rem 0.5rem; }
    .sidebar span { display: none; }
    .main-content { margin-left: 80px; width: calc(100% - 80px); }
    .brand { justify-content: center; }
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 1.5rem;
    }

    .daily-collection-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar .brand {
        margin-bottom: 0;
    }

    .sidebar .nav-menu {
        display: none; /* In a real app we'd add a hamburger menu */
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    h1 { font-size: 1.5rem; }
    .stat-value { font-size: 1.5rem; }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-main > div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .card {
        padding: 1rem;
    }

    /* Fixed table issues on mobile */
    .table-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}
