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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.hidden {
    display: none !important;
}

/* Login */
.login-box {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-logo {
    max-width: 200px;
    margin-bottom: 16px;
}

.login-box h1 {
    color: #1a73e8;
    margin-bottom: 8px;
}

.login-box h2 {
    color: #666;
    font-weight: 400;
    margin-bottom: 30px;
}

.login-box input {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.login-box button {
    width: 100%;
    padding: 14px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.login-box button:hover {
    background: #1557b0;
}

.error {
    color: #d93025;
    margin-top: 12px;
}

/* Navigation */
nav {
    background: #1a73e8;
    color: white;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 60px;
}

.nav-brand {
    font-size: 20px;
    font-weight: 600;
    margin-right: 40px;
}

.nav-logo {
    height: 36px;
}

.nav-links {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

#logout-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Main content */
main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

h2 {
    margin-bottom: 24px;
    color: #333;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card.highlight {
    background: #1a73e8;
    color: white;
}

.stat-value {
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.8;
}

/* Dashboard sections */
.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section h3 {
    margin-bottom: 16px;
    color: #333;
}

/* View header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-actions {
    display: flex;
    gap: 12px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
}

tr:hover {
    background: #f8f9fa;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-received { background: #e3f2fd; color: #1565c0; }
.status-ready_to_invoice { background: #fff3e0; color: #ef6c00; }
.status-invoiced { background: #e8f5e9; color: #2e7d32; }
.status-sent { background: #e8f5e9; color: #2e7d32; }
.status-paid { background: #c8e6c9; color: #1b5e20; }
.status-draft { background: #f5f5f5; color: #666; }

/* Buttons */
.btn-primary {
    padding: 10px 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-invoice {
    padding: 6px 14px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-invoice:hover {
    background: #388e3c;
}

.btn-paid {
    padding: 6px 14px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-paid:hover {
    background: #1976d2;
}

.btn-view {
    padding: 6px 14px;
    background: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
    margin-right: 8px;
}

.btn-view:hover {
    background: #e0e0e0;
}

.btn-cancel {
    padding: 10px 20px;
    background: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Selects */
select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
}

.modal-content h3 {
    margin-bottom: 24px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-row input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Splits */
.splits-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.split-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.split-card h4 {
    color: #1a73e8;
    margin-bottom: 16px;
}

.split-card .amount {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
}

.split-card .details {
    font-size: 14px;
    color: #666;
}

.split-card .paid {
    color: #4caf50;
}

.split-card .unpaid {
    color: #ff9800;
}

/* Invoice Preview */
.invoice-preview {
    width: 600px;
}

.preview-header {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 15px;
}

.preview-table {
    width: 100%;
    margin-bottom: 16px;
}

.preview-table td {
    padding: 10px 12px;
    border: 1px solid #ddd;
}

.preview-table td:first-child {
    background: #f8f9fa;
    font-weight: 500;
    width: 45%;
}

.preview-email {
    background: #e3f2fd;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 1000px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .nav-links {
        display: none;
    }
}
