:root {
    --ink: #172033;
    --muted: #6c7484;
    --line: #dfe5ee;
    --panel: #ffffff;
    --accent: #176b87;
    --accent-2: #c97720;
    --surface: #f5f7fb;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--surface);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 264px;
    background: #121826;
    color: #fff;
    min-height: 100vh;
    padding: 12px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    font-size: 1rem;
}

.sidebar .nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    margin-right: -8px;
}

.sidebar .nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar .nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sidebar .nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar .nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar .nav-link,
.logout-link {
    color: #b9c2d3;
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.8rem;
}

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

.logout-link {
    margin-top: auto;
}

.app-main {
    flex: 1;
    margin-left: 264px;
    min-width: 0;
}

.auth-main {
    margin-left: 0;
}

.auth-main .content-wrap {
    padding: 0;
}

.topbar {
    min-height: 82px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
    width: 100%;
}

.topbar h1 {
    font-size: 1.35rem;
    margin: 0;
    font-weight: 800;
}

.content-wrap {
    padding: 28px;
}

.stat-card,
.panel,
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(23, 32, 51, 0.05);
}

.stat-card {
    padding: 18px;
    min-height: 124px;
}

.stat-card .icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f4f7;
    color: var(--accent);
    font-size: 1.25rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 800;
}

.panel {
    padding: 18px;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.badge-soft-danger {
    color: #9b1c1c;
    background: #fde8e8;
}

.badge-soft-success {
    color: #05603a;
    background: #def7ec;
}
.badge-soft-warning {
    color: #78350f;
    background: #ffedd5;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #eef7f9, #f7f4ed);
}

.auth-card {
    width: min(440px, 100%);
    padding: 28px;
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: #12576e;
    --bs-btn-hover-border-color: #12576e;
}

.btn-warning {
    --bs-btn-bg: var(--accent-2);
    --bs-btn-border-color: var(--accent-2);
    --bs-btn-color: #fff;
}

.sidebar-backdrop {
    display: none;
}

footer {
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 12px 28px;
    font-size: 0.875rem;
    color: var(--muted);
    position: fixed;
    bottom: 0;
    left: 264px;
    right: 0;
    text-align: center;
    z-index: 1010;
    height: auto;
    min-height: 50px;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}
footer p {
    margin: 0;
}

footer a:hover {
    text-decoration: underline;
}

.app-main {
    padding-bottom: 70px;
}

@media print {
    body {
        background: #fff;
        color: #111;
        font-size: 12px;
    }

    /* hide everything by default */
    body * {
        visibility: hidden !important;
    }

    /* show header and report content only */
    .print-header,
    .print-header *,
    .report-table,
    .report-table *,
    .report-content,
    .report-content * {
        visibility: visible !important;
    }

    .sidebar,
    .sidebar-backdrop,
    .topbar,
    footer,
    .print-hide,
    .content-wrap > :not(.print-header):not(.report-table):not(.report-content) {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
        padding: 20px !important;
    }

    .content-wrap {
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-header {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 0 30px 0 !important;
        padding: 0 !important;
    }

    .report-table {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-store-details {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 20px;
    }

    .print-store-details h3 {
        font-size: 1.1rem;
        font-weight: bold;
        margin: 0 0 10px 0;
    }

    .print-store-details p {
        margin: 0;
    }

    table {
        width: 100%;
        border-collapse: collapse !important;
        margin: 0 !important;
    }

    table th,
    table td {
        border: 1px solid #333 !important;
        padding: 6px !important;
        text-align: left;
        font-size: 11px;
    }

    table th {
        background: #f0f0f0;
        font-weight: bold;
    }

    .table-responsive {
        overflow: visible !important;
    }
}



@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(18, 24, 38, 0.45);
        z-index: 1030;
    }

    .app-main {
        margin-left: 0;
    }

    .content-wrap,
    .topbar {
        padding: 18px;
    }
}
