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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #212529;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

header {
    background: #ffffff;
    padding: 24px 32px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 24px;
}

.header-brand {
    margin-bottom: 20px;
}

.header-brand h1 {
    color: #1a73e8;
    margin-bottom: 4px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.header-brand .tagline {
    color: #5f6368;
    font-size: 14px;
    margin: 0;
    font-weight: 400;
}

nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    color: #5f6368;
}

.nav-btn:hover {
    background: #f1f3f4;
    color: #202124;
}

.nav-btn.active {
    background: #e8f0fe;
    color: #1a73e8;
}

main {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    min-height: 600px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.page-header h2 {
    color: #202124;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.3px;
}

.btn {
    padding: 10px 24px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:hover {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.btn:active {
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #1765cc;
}

.btn-secondary {
    background: #ffffff;
    color: #5f6368;
    border-color: #dadce0;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #dadce0;
}

.btn-danger {
    background: #d93025;
    color: white;
}

.btn-danger:hover {
    background: #c5221f;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 13px;
}

thead {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 2px solid #dadce0;
}

th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #202124;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
    color: #3c4043;
    vertical-align: middle;
}

tbody tr {
    transition: background-color 0.15s;
}

tbody tr:hover {
    background: #f8f9fa;
}

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

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-in_stock {
    background: #e6f4ea;
    color: #137333;
}

.status-sold {
    background: #e8f0fe;
    color: #1967d2;
}

.status-pending {
    background: #fef7e0;
    color: #b06000;
}

.status-ordered, .status-scheduled {
    background: #e8eaed;
    color: #3c4043;
}

.status-received, .status-in_transit {
    background: #fce8e6;
    color: #c5221f;
}

.status-installed, .status-delivered {
    background: #e6f4ea;
    color: #137333;
}

.status-paid {
    background: #e6f4ea;
    color: #137333;
}

.status-partial {
    background: #fef7e0;
    color: #b06000;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    color: #202124;
    font-size: 20px;
    font-weight: 500;
}

.close-modal {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    color: #5f6368;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-modal:hover {
    background: #f1f3f4;
    color: #202124;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #202124;
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
    color: #202124;
    background: #ffffff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.loading {
    text-align: center;
    padding: 60px;
    color: #5f6368;
    font-size: 15px;
}

.error, .message.error {
    background: #fce8e6;
    color: #c5221f;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    border-left: 4px solid #d93025;
    font-size: 14px;
}

.success, .message.success {
    background: #e6f4ea;
    color: #137333;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    border-left: 4px solid #1e8e3e;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #80868b;
}

.empty-state h3 {
    margin-bottom: 8px;
    font-size: 18px;
    color: #5f6368;
    font-weight: 500;
}

.empty-state p {
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: #dadce0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.stat-card h4 {
    color: #5f6368;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 500;
    color: #202124;
    letter-spacing: -0.5px;
}

.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 10px 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.pagination-info {
    color: #5f6368;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.pagination-controls .btn {
    min-width: 36px;
    padding: 6px 10px;
}

.pagination-controls .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    header {
        padding: 16px;
    }

    .header-brand h1 {
        font-size: 22px;
    }

    .header-brand .tagline {
        font-size: 13px;
    }

    nav {
        gap: 6px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 13px;
        flex: 1;
        min-width: 70px;
    }

    main {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h2 {
        font-size: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .value {
        font-size: 24px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 13px;
        -webkit-overflow-scrolling: touch;
    }

    thead, tbody, tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    th, td {
        padding: 10px 8px;
    }

    th {
        font-size: 12px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }

    .btn-sm {
        width: 100%;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 85vh;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
        width: 100%;
    }

    .filters {
        flex-direction: column;
    }

    .filters > div {
        width: 100%;
    }

    .filters input,
    .filters select {
        width: 100%;
    }

    #quarterly-inputs,
    #custom-inputs {
        flex-direction: column;
        width: 100%;
    }

    .form-group {
        width: 100%;
    }

    .empty-state {
        padding: 60px 20px;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 20px;
    }

    .nav-btn {
        padding: 9px 16px;
        font-size: 13px;
    }

    table {
        font-size: 13px;
    }

    .stat-card .value {
        font-size: 26px;
    }
}
