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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f3f4ff 0%, #e8f4ff 100%);
    min-height: 100vh;
    color: #2d3748;
}

body.modal-open {
    overflow: hidden;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    gap: 6px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #6c5ce7 0%, #45aaf2 100%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 12px 25px rgba(69, 170, 242, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #1abc9c 100%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(46, 204, 113, 0.2);
}

.btn-success:hover {
    box-shadow: 0 12px 25px rgba(26, 188, 156, 0.25);
}

.btn-secondary {
    background: #edf2f7;
    color: #2d3748;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-light {
    background: rgba(108, 92, 231, 0.12);
    color: #4c51bf;
}

.btn-light:hover {
    background: rgba(108, 92, 231, 0.18);
}

.btn-delete,
.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    color: #fff;
}

.btn-light.btn-sm,
.btn-delete.btn-sm,
.btn-danger.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    font-size: 16px;
}

a.btn {
    text-decoration: none;
}

.dashboard-body {
    padding: 32px;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(18px);
    border-radius: 24px;
    padding: 24px 32px;
    box-shadow: 0 20px 40px rgba(76, 103, 159, 0.12);
}

.header-left h1 {
    font-size: 28px;
    color: #2d3748;
    margin-bottom: 6px;
}

.welcome-text {
    color: #718096;
    font-size: 14px;
}

.header-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(76, 103, 159, 0.1);
}

.form-card h2 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 8px;
}

.form-description {
    color: #718096;
    font-size: 14px;
    margin-bottom: 20px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.search-container input,
.modal textarea {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.search-container input:focus,
.modal textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    outline: none;
}

.form-message {
    margin-top: 16px;
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 14px;
}

.alert-error,
.form-message.alert-error {
    background: #ffe0e3;
    color: #c53030;
}

.alert-success,
.form-message.alert-success {
    background: #e6fffa;
    color: #2c7a7b;
}

.stats-card {
    display: grid;
    gap: 16px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(86, 204, 242, 0.18) 100%);
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
}

.stats-label {
    color: #4a5568;
    font-weight: 500;
}

.stats-value {
    font-size: 22px;
    font-weight: 700;
    color: #2d3748;
}

.search-card {
    padding: 18px 24px;
}

.search-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.content-grid.single-column {
    grid-template-columns: minmax(0, 1fr);
}

.pdf-inline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-inline-controls .date-input {
    min-width: 150px;
}

.products-card {
    min-height: 500px;
    display: block;
}

.date-input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #2d3748;
    transition: border-color 0.3s;
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
}

.products-list {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    grid-auto-rows: auto;
    gap: 18px;
    width: 100%;
    box-sizing: border-box;
}

.products-list .product-card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}


.product-media {
    width: 100%;
    height: 200px;
    background: #f7fafc;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    contain: layout style paint;
}

.product-media img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.product-media img.loaded {
    opacity: 1;
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #a0aec0;
    background: #f7fafc;
    border-radius: 6px;
}

.product-body h3 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 6px;
}

.product-body p {
    font-size: 13px;
    color: #718096;
}

.product-body p span {
    color: #4a5568;
    font-weight: 600;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.product-quantity {
    color: #4c51bf;
    font-weight: 600;
}

.product-actions {
    display: flex;
    gap: 8px;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    background: #edf2f7;
    color: #2d3748;
    border-radius: 12px;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.page-btn:hover,
.page-btn.active {
    background: #6c5ce7;
    color: #fff;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
    background: rgba(247, 250, 252, 0.7);
    border-radius: 20px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(45, 55, 72, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    z-index: 100;
}

.modal[hidden] {
    display: none;
}

.modal-content {
    max-width: 560px;
    width: 100%;
    gap: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal textarea {
    width: 100%;
    min-height: 200px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #6c5ce7 0%, #45aaf2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 26px;
    color: #2d3748;
}

.login-subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 24px;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form button {
    margin-top: 10px;
}

@media (max-width: 1024px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }

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

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

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-right {
        width: 100%;
        flex-wrap: wrap;
    }
}

.progress-container {
    margin-top: 20px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    transition: width 0.3s ease;
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.progress-text {
    text-align: center;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 640px) {
    .dashboard-body {
        padding: 16px;
    }

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

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

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