:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --line: #d9e0ea;
    --text: #172033;
    --muted: #667085;
    --brand: #0f766e;
    --brand-strong: #115e59;
    --warn: #b45309;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #eef6f5, #f7f9fc);
}

.login-panel {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
}

.sidebar {
    background: #121826;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .28) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .24);
    border-radius: 999px;
}

.sidebar .nav {
    padding-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    padding: 8px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    margin-bottom: 14px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    font-weight: 700;
}

.brand small {
    display: block;
    color: #b8c0cc;
    font-size: 12px;
}

.nav-link {
    color: #c7cfdd;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    min-height: 42px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.nav-link svg {
    width: 18px;
    height: 18px;
}

.main {
    min-width: 0;
}

.topbar {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.mobile-menu-btn,
.sidebar-backdrop {
    display: none;
}

.mobile-menu-btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    height: 44px;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    width: 42px;
}

.topbar-title {
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.topbar p {
    margin: 3px 0 0;
    color: var(--muted);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.user-chip small {
    color: var(--muted);
    text-transform: capitalize;
}

.content {
    padding: 24px 28px 36px;
}

.panel,
.toolbar,
.form-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel {
    padding: 18px;
}

.toolbar {
    padding: 14px;
    margin-bottom: 16px;
}

.form-panel {
    padding: 18px;
    margin-bottom: 18px;
}

.table {
    margin-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #eef6f5;
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 700;
}

.status.warn {
    background: #fff7ed;
    color: var(--warn);
}

.status.danger {
    background: #fef3f2;
    color: var(--danger);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

.pdv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

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

.product-tile {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

    .sidebar {
        bottom: 0;
        box-shadow: 18px 0 42px rgba(15, 23, 42, .24);
        height: 100vh;
        height: 100dvh;
        left: 0;
        max-width: 88vw;
        overscroll-behavior: contain;
        overflow-y: auto;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        transition: transform .24s ease;
        -webkit-overflow-scrolling: touch;
        width: 340px;
        z-index: 1050;
    }

    body.menu-open {
        overflow: hidden;
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        background: rgba(15, 23, 42, .58);
        bottom: 0;
        display: none;
        left: 0;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 1040;
    }

    body.menu-open .sidebar-backdrop {
        display: block;
    }

    .mobile-menu-btn {
        display: inline-flex;
        flex: 0 0 auto;
        position: sticky;
        top: max(10px, env(safe-area-inset-top));
        z-index: 1060;
    }

    .brand {
        border-bottom: 1px solid rgba(255, 255, 255, .12);
        margin-bottom: 14px;
        padding-bottom: 18px;
    }

    .brand-mark {
        height: 46px;
        width: 46px;
    }

    .brand strong {
        font-size: 18px;
    }

    .brand small {
        font-size: 13px;
    }

    .sidebar .nav {
        gap: 8px !important;
    }

    .sidebar .nav-link {
        border-radius: 8px;
        font-size: 16px;
        gap: 12px;
        min-height: 50px;
        padding: 12px 14px;
    }

    .sidebar .nav-link svg {
        height: 22px;
        width: 22px;
    }

    .product-grid,
    .pdv-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        display: grid;
        gap: 12px;
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .user-chip {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        grid-column: 1 / -1;
        width: 100%;
    }

    .content,
    .topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .product-grid,
    .pdv-layout {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 14px;
    }
}

@media (max-width: 560px) {
    .sidebar .nav-link {
        font-size: 16px;
        min-height: 50px;
        padding: 12px 14px;
    }

    .sidebar .nav-link svg {
        height: 22px;
        width: 22px;
    }
}

@media (max-width: 520px) {
    .panel > .d-flex.justify-content-between {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 10px;
    }

    .panel > .d-flex.justify-content-between .btn {
        width: 100%;
    }
}
