:root {
    --green: #5f8d24;
    --tomato: #9d341f;
    --tomato-dark: #6f2418;
    --ink: #161614;
    --muted: #6f716d;
    --line: #deded9;
    --bg: #f7f8f4;
    --soft: #f0f1ec;
}

body {
    background: var(--bg);
    color: var(--ink);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #fbfbf8, #eceee6);
}

.auth-card {
    width: min(440px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(23, 32, 24, .08);
}

.auth-card h1 {
    font-size: 1.7rem;
}

.brand-mark,
.product-image {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    background: var(--green);
    color: #fff;
    border-radius: 8px;
    font-weight: 800;
}

.login-logo {
    margin-bottom: 18px;
}

.login-logo img {
    display: block;
    width: min(320px, 100%);
    height: auto;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--tomato-dark);
    color: #fff;
    padding: 20px;
}

.sidebar-brand {
    display: block;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    margin-bottom: 24px;
}

.sidebar-brand img {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
    background: #fff;
    border-radius: 6px;
    padding: 8px;
}

.sidebar nav a {
    display: block;
    color: rgba(255,255,255,.86);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,.14);
    color: #fff;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    color: var(--tomato) !important;
    font-weight: 800;
    text-decoration: none;
}

.site-logo img {
    display: block;
    width: 190px;
    max-width: 48vw;
    height: auto;
}

.btn-success {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: #4f7a1d;
    --bs-btn-hover-border-color: #4f7a1d;
    --bs-btn-active-bg: #456c19;
    --bs-btn-active-border-color: #456c19;
}

.text-success {
    color: var(--green) !important;
}

.main-panel {
    min-width: 0;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.main-panel > .section-block,
.main-panel > .content-grid,
.main-panel > .page-heading,
.main-panel > form,
.main-panel > .table-responsive,
.main-panel > .alert {
    margin-left: 24px;
    margin-right: 24px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 18px;
}

.page-heading h1 {
    font-size: 1.65rem;
    margin: 0;
}

.section-block {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.section-block h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.metric-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: .9rem;
}

.metric-card strong {
    display: block;
    font-size: 1.45rem;
    margin-top: 6px;
}

.dashboard-graphs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
}

.dashboard-graph-panel-divider {
    border-left: 1px solid var(--line);
    padding-left: 28px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    min-height: 190px;
    padding-top: 16px;
}

.bar-item {
    flex: 1;
    min-width: 54px;
    text-align: center;
}

.bar-value {
    font-weight: 800;
    margin-bottom: 6px;
}

.bar-track {
    height: 128px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-bottom: 1px solid var(--line);
}

.bar-track span {
    display: block;
    width: min(38px, 80%);
    background: var(--green);
    border-radius: 8px 8px 0 0;
}

.picking-chart .bar-track span {
    background: #777873;
}

.bar-label {
    color: var(--muted);
    font-size: .82rem;
    margin-top: 8px;
    min-height: 34px;
}

.filters-bar {
    display: grid;
    grid-template-columns: 1fr 220px 170px auto auto;
    gap: 10px;
    margin-bottom: 18px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    overflow: hidden !important;
    min-width: 0;
    box-sizing: border-box;
}

.product-card h2 {
    font-size: 1.05rem;
    margin: 12px 0 6px;
}

.product-media,
.category-media {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.product-card img.product-photo,
.product-photo,
.category-media img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    object-position: center;
    border: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
}

.product-card .product-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--green);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.category-card {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
}

.category-card:hover {
    border-color: var(--tomato);
}

.category-card strong {
    display: block;
    font-size: 1.1rem;
}

.category-card small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.category-media span {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: var(--green);
    color: #fff;
    font-weight: 800;
    font-size: 2rem;
}

.product-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}

.product-thumb,
.product-thumb-large {
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #edf2ee;
    flex: 0 0 auto;
}

.product-thumb {
    width: 48px;
    height: 48px;
}

.product-thumb-large {
    width: 96px;
    height: 96px;
}

.admin-category-thumb {
    display: inline-grid;
    width: 88px;
    height: 66px;
    object-fit: contain;
    place-items: center;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #edf2ee;
}

.placeholder-thumb {
    display: inline-grid;
    place-items: center;
    color: #fff;
    background: var(--green);
    font-weight: 800;
}

.product-card p {
    color: var(--muted);
    min-height: 48px;
}

.product-card[id] {
    scroll-margin-top: 90px;
}

.qty-input {
    width: 100px;
}

.cart-total {
    font-size: 1.25rem;
    font-weight: 800;
    text-align: right;
    margin: 16px 0;
}

.confirmation-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
}

.mobile-cart {
    display: none;
}

.stock-search {
    max-width: 360px;
}

.stock-number {
    min-width: 110px;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .filters-bar {
        grid-template-columns: 1fr;
    }

    .main-panel > .section-block,
    .main-panel > .content-grid,
    .main-panel > .page-heading,
    .main-panel > form,
    .main-panel > .table-responsive,
    .main-panel > .alert {
        margin-left: 12px;
        margin-right: 12px;
    }

    .mobile-cart {
        display: block;
        position: fixed;
        right: 16px;
        bottom: 16px;
        z-index: 10;
    }

    .dashboard-graph-panel-divider {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-left: 0;
        padding-top: 22px;
    }
}

@media print {
    .sidebar, .topbar, .navbar, .btn, .filters-bar {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    body {
        background: #fff;
    }
}
