body {
    font-family: Arial, sans-serif;
    background-color: #f4f6f8;
    margin: 0;
    color: #333;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

h1 {
    color: #1f2937;
    margin-bottom: 20px;
}

h2 {
    color: #374151;
    margin-top: 28px;
}

.navbar {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;

    background-color: white;
    border: 1px solid #ddd;
    padding: 12px 16px;
    margin-bottom: 24px;
    border-radius: 8px;
}

.navbar a {
    font-weight: bold;
}


.card {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
}

table {
    border-collapse: collapse;
    width: 100%;
    background-color: white;
    margin-top: 12px;
}

th {
    background-color: #1f2937;
    color: white;
}

th,
td {
    border: 1px solid #ddd;
    padding: 9px;
    text-align: left;
}

tr:nth-child(even) {
    background-color: #f9fafb;
}

a {
    text-decoration: none;
    color: #2563eb;
}

a:hover {
    text-decoration: underline;
}

button {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background-color: #1d4ed8;
}

input,
select {
    padding: 7px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 22px 0;
}

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

.stat-card {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
}

.stat-title {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #1f2937;
}

.invoice-summary{
    margin-top:30px;
    padding:20px;
    border:1px solid #ddd;
    border-radius:10px;
    background:#fafafa;
}

.invoice-summary-item{
    display:flex;
    justify-content:space-between;
    font-size:20px;
    margin:10px 0;
}

.invoice-summary-item strong{
    font-size:24px;
}

.stock-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.stock-card {
    background-color: white;
    border-radius: 8px;
    padding: 16px;
    flex: 1;
    min-width: 300px;
}

.stock-danger {
    border-left: 5px solid #dc2626;
}

.stock-warning {
    border-left: 5px solid #f59e0b;
}

.stock-ok {
    border-left: 5px solid #16a34a;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.menu-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
}

.menu-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #1f2937;
}

.menu-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.menu-links a {
    text-decoration: none;
}

tbody tr:hover {
    background-color: #eef5ff;
}

.stock-empty {
    color: #dc2626;
    font-weight: bold;
}

.stock-low {
    color: #f59e0b;
    font-weight: bold;
}

.stock-ok {
    color: #16a34a;
    font-weight: bold;
}


.btn-link:hover {
    background-color: #d1d5db;
    text-decoration: none;
}

.btn-link {
    display: inline-block;
    background: #e5e7eb;
    color: #111827;
    padding: 6px 10px;
    border-radius: 6px;
    margin: 2px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.btn-link:hover {
    background: #d1d5db;
    text-decoration: none;
}

.profit-positive {
    color: #16a34a;
    font-weight: bold;
}

.profit-negative {
    color: #dc2626;
    font-weight: bold;
}

.status-completed {
    color: #16a34a;
    font-weight: bold;
}

.status-draft {
    color: #f59e0b;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}

.action-buttons .btn-link {
    white-space: nowrap;
    padding: 5px 8px;
    font-size: 13px;
}

.categories-table .id-column {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    text-align: center;
}

.form-control {
    width: 320px;
}

.form-card {
    max-width: 500px;
}

.card.invoice-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: flex-start;
    gap: 50px;
}

.card.invoice-header .invoice-left {
    flex: 2;
}

.card.invoice-header .invoice-right {
    flex: 1;
    text-align: right;
}

.card.invoice-header p {
    margin: 6px 0;
}

.product-thumb {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.price-image {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
}

@media print {

    .no-print {
        display: none !important;
    }

}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 34px);
    gap: 8px;
    justify-content: center;
}

.action-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #e5e7eb;
    color: #374151;
    text-decoration: none;
    font-size: 16px;
}

.action-btn:hover {
    background: #dbeafe;
    transform: scale(1.08);
}

.archive-actions {
    display: grid;
    grid-template-columns: repeat(2, 34px);
    gap: 8px;
    justify-content: center;
}

.archive-actions form {
    margin: 0;
}

.archive-actions .icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #e5e7eb;
    color: #374151;
    text-decoration: none;
    font-size: 16px;
}

.customer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.customer-actions .btn-link {
    white-space: nowrap;
}

.customer-actions-column {
    width: 170px;
    text-align: center;
}

.product-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

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

.form-column label {
    font-weight: bold;
    margin-top: 8px;
}

.form-column .form-control {
    width: 100%;
    box-sizing: border-box;
}
.product-form-actions {
    text-align: center;
    margin-top: 20px;
}

.upload-preview {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 12px;
    background-color: #f9fafb;
}

.current-product-image {
    text-align: center;
    margin-bottom: 20px;
}

.edit-product-image {
    max-width: 250px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.product-info-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 30px;
    align-items: center;
}

.product-photo {
    text-align: center;
}

.product-detail-image {
    width: 240px;
    max-width: 240px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.product-info p {
    margin: 10px 0;
}

.vat-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.vat-included {
    background: #e8f7ec;
    color: #18793b;
}

.vat-excluded {
    background: #f1f1f1;
    color: #555;
}

.error-message {
    margin: 20px 0;
    padding: 14px 18px;

    background: #ffe6e6;
    border: 1px solid #ffb3b3;
    border-radius: 8px;

    color: #b00020;
    font-weight: 600;
}

.success-message {
    margin: 20px 0;
    padding: 14px 18px;
    background: #e8f8ec;
    border: 1px solid #8fd19e;
    border-radius: 8px;
    color: #1b5e20;
    font-weight: 600;
}

.access-denied {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.access-denied__card {
    width: 100%;
    max-width: 520px;
    padding: 32px;
    border: 1px solid #dddddd;
    border-radius: 12px;
    text-align: center;
    background: #ffffff;
}

.access-denied__card h1 {
    margin-top: 0;
}

.access-denied__card .button {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 18px;
    text-decoration: none;
}

/* ==========================
   Mobile (до 768px)
========================== */

@media (max-width: 768px) {

    .page {
        padding: 12px;
    }

    h1 {
        font-size: 30px;
        line-height: 1.2;
    }

    h2 {
        font-size: 24px;
        line-height: 1.25;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .navbar a,
    .navbar button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .navbar a {
        padding: 8px 10px;
    }

    .stats-grid,
    .menu-grid,
    .product-form-grid,
    .product-info-grid {
        grid-template-columns: 1fr;
    }

    .stock-grid {
        flex-direction: column;
    }

    .card.invoice-header {
        flex-direction: column !important;
        gap: 20px;
    }

    .card.invoice-header .invoice-right {
        text-align: left;
    }

    .form-control {
        width: 100%;
    }

    input,
    select {
        min-height: 42px;
        font-size: 16px;
        box-sizing: border-box;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .customer-actions,
    .action-buttons,
    .archive-actions {
        justify-content: center;
    }

    .action-buttons form {
        width: 100%;
    }

    .action-buttons button {
        width: 100%;
        white-space: normal;
        line-height: 1.4;
    }

    .product-detail-image,
    .edit-product-image {
        max-width: 100%;
        height: auto;
    }

    button,
    .btn-link {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
}

.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {

    .mobile-menu-btn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        min-height: 44px;
        box-sizing: border-box;
    }

    .mobile-navbar {
        display: none;
        margin-bottom: 24px;
    }

    .mobile-navbar.is-open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .mobile-navbar a,
    .mobile-navbar button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
}

.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 30px;
    box-sizing: border-box;

    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.login-card h2 {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-form label {
    font-weight: 600;
}

.login-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    box-sizing: border-box;
}

.login-form button {
    width: 100%;
    min-height: 44px;
    margin-top: 14px;
}

.login-error {
    margin-bottom: 18px;
    padding: 10px 12px;

    color: #b91c1c;
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

@media (max-width: 480px) {
    .login-page {
        padding: 14px;
    }

    .login-card {
        padding: 22px 18px;
    }
}