:root {
    /* Colors - Clean Light Theme */
    --bg-body: #f3f6fc;
    /* Very light blue-grey for main background */
    --bg-white: #ffffff;
    --bg-sidebar: #ffffff;

    /* Text Colors */
    --text-primary: #1a1c21;
    /* Almost black for strong contrast */
    --text-secondary: #6b7280;
    /* Gray for labels */
    --text-muted: #9ca3af;

    /* Accents - Inspired by image */
    --primary: #1a1c21;
    /* Use dark/black for primary actions to match high contrast */
    --accent-blue: #3b82f6;
    /* Bright Blue */
    --accent-green: #10b981;
    /* Green */
    --accent-yellow: #fbbf24;
    /* Yellow/Orange */
    --accent-purple: #8b5cf6;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 80px;

    /* Shapes */
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03);
    /* Soft, spread out shadow */

    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Helvetica, 'Inter', Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    /* Make text look sharper like in the image */
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border-right: none;
    /* Removed border for cleaner look */
    box-shadow: var(--shadow-sm);
    /* Subtle separation */
    z-index: 50;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0 0.5rem;
}

.logo-img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: #f8fafc;
    /* Very light hover */
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--text-primary);
    /* Black active state like modern design */
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-item i {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

.nav-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 1.5rem 0;
}

.sidebar-footer {
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding-top: 2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: transparent;
    padding: 0;
    border: none;
    height: auto;
    position: relative;
    top: 0;
}

/* Search Bar */
.header-search {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-white);
    padding: 0.75rem 1.25rem;
    border-radius: 99px;
    /* Pill shape */
    width: 400px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.header-search:focus-within {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.header-search i {
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

.header-search input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: transparent;
}

.header-search input::placeholder {
    color: #94a3b8;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-icon {
    background: white;
    border: 1px solid #e2e8f0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-icon:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.mobile-toggle-btn {
    display: none;
    flex-shrink: 0;
}

.btn-primary {
    background-color: var(--text-primary);
    /* Black button */
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.btn-text {
    background-color: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
}

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

/* Profile */
.user-profile {
    cursor: pointer;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

/* Dashboard Content */
.content-area {
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Big Title */
.dashboard-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

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

.dashboard-grid.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.dashboard-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.dashboard-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.m303-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.chart-card {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.benefit-card {
    grid-column: span 1;
    background: var(--text-primary);
    color: white;
}

/* Cards */
.glass {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    border: none;
    /* No border for clean look */
    backdrop-filter: none;
    /* Remove glass blur, go for solid clean */
}

.stat-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

/* Add some subtle accent decoration to cards */
/* Decorated removed for cleaner look */

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    z-index: 1;
}

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

.stat-icon {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 1rem 0;
    z-index: 1;
    letter-spacing: -1px;
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--success);
    font-weight: 600;
    z-index: 1;
}

/* Specific colors for specific cards if needed, handled via JS or specific classes. 
   For now, keeping them clean white. 
*/

/* Recent Activity */
.recent-activity {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    border: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #f1f5f9;
    white-space: nowrap;
}

.data-table td {
    padding: 1.25rem 1.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

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

.data-table tr:hover td {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
}

.badge-paid {
    background-color: #037400;
    color: #06ff00;
}

.badge-unpaid {
    background-color: #a30000;
    color: #ff0000;
}

.badge-pending {
    background-color: #fef3c7;
    color: #d97706;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

/* Form Groups */
.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: var(--text-primary);
    font-size: 16px;
    /* 16px to prevent iOS auto-zoom */
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    background: white;
}

/* Upload Zone Modern */
.upload-zone-modern {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
    min-height: 200px;
}

.upload-zone-modern:hover,
.upload-zone-modern.drag-over {
    border-color: var(--accent-blue);
    background: #eff6ff;
}

.upload-illustration {
    background: white;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 0.5rem;
}

.upload-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.link-text {
    color: var(--accent-blue);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

/* Divider */
.divider-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    width: 100%;
}

.divider-line {
    height: 1px;
    background: #e2e8f0;
    flex: 1;
}

.divider-text {
    padding: 0 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Modern Type Selector */
.upload-options-container {
    width: 100%;
}

.options-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.type-selector-modern {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    background: transparent;
    padding: 0;
}

.type-btn-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-btn-modern:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.type-btn-modern.active {
    border-color: var(--text-primary);
    background: var(--text-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.type-btn-modern.active i {
    color: white;
    /* Ensure icons turn white on active */
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .header-search {
        width: 300px;
    }

    .dashboard-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: var(--sidebar-width);
        z-index: 10000;
        transition: left 0.3s ease;
        background: white;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-toggle-btn {
        display: flex;
    }

    .main-content {
        padding: 1.5rem;
        height: auto;
        overflow: visible;
    }

    .top-header {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .header-search {
        order: 3;
        width: 100%;
    }

    .header-actions {
        gap: 0.75rem;
    }

    .btn span {
        display: none;
    }

    .btn {
        padding: 0.75rem;
    }

    .dashboard-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .dashboard-grid.grid-4,
    .dashboard-grid.grid-3,
    .dashboard-grid.grid-2 {
        grid-template-columns: 1fr !important;
    }

    .m303-preview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .m303-preview-header button {
        width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .modal-content {
        padding: 1.5rem;
        width: calc(100% - 2rem);
        margin: 1rem;
        max-height: 85vh;
    }

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

    .btn {
        width: 100%;
    }

    .header-actions .btn {
        width: auto;
    }

    .type-selector-modern {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table th,
    .data-table td {
        padding: 1rem 0.75rem;
        font-size: 0.85rem;
    }

    .top-header .header-actions .btn-primary {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }

    .top-header .header-actions .btn-primary i {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .dashboard-title {
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 2rem;
    }
}

/* --- Auth Style --- */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #e0e7ff 0%, #f3f6fc 100%);
    backdrop-filter: blur(20px);
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.auth-card {
    padding: 3rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.auth-header {
    margin-bottom: 2.5rem;
}

.auth-logo {
    width: 80px;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-view.hidden {
    display: none;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    margin-top: 1rem;
}

.auth-footer {
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-view .info-box {
    background: #eff6ff;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    text-align: left;
}

.auth-view .info-box i {
    color: var(--accent-blue);
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.auth-view .info-box p {
    font-size: 0.9rem;
    color: #1e40af;
    line-height: 1.4;
    font-weight: 500;
}

/* Visibility Control */
body.auth-required .app-container {
    display: none;
}

body.authenticated .auth-overlay {
    display: none;
}

body.authenticated .app-container {
    display: flex;
}