:root {
    --qp-primary: #e74623;
    --qp-primary-dark: #64170b;
    --qp-bg: #f4f6f9;
    --qp-sidebar: #1c2b3a;
    --qp-sidebar-active: #2f5d8a;
    --qp-text-muted: #6b7280;
}

* { box-sizing: border-box; }

body {
    background: var(--qp-bg);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    color: #1f2937;
}

/* -------- Login page -------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--qp-primary-dark), var(--qp-primary));
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 45px rgba(0,0,0,0.25);
}
.login-card .brand {
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-card .brand i {
    font-size: 2.2rem;
    color: var(--qp-primary);
}
.login-card .brand h4 {
    margin-top: .5rem;
    font-weight: 700;
    color: var(--qp-primary-dark);
}

/* -------- App layout -------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 230px;
    background: var(--qp-sidebar);
    color: #cbd5e1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.25rem 1.25rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-nav {
    padding: 1rem 0.6rem;
}
.sidebar-nav .nav-link {
    color: #cbd5e1;
    padding: .6rem .9rem;
    border-radius: 8px;
    margin-bottom: .2rem;
    font-size: .93rem;
}
.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: .5rem;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-nav .nav-link.active {
    background: var(--qp-sidebar-active);
    color: #fff;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    background: #fff;
    padding: .9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: .5rem;
}
.page-content {
    padding: 1.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--qp-primary-dark);
    font-size: 1.4rem;
    line-height: 1;
    padding: .1rem .3rem;
}
.btn-icon:hover { color: var(--qp-primary); }

.sidebar-overlay {
    display: none;
}

/* -------- Responsive: tablet & mobile -------- */
@media (max-width: 991.98px) {
    .sidebar {
        width: 250px;
    }
}

@media (max-width: 767.98px) {
    .app-wrapper {
        position: relative;
        display: block !important;
    }
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        width: 250px !important;
        max-width: 80vw !important;
        z-index: 1050 !important;
        transform: translateX(-100%) !important;
        transition: transform .25s ease !important;
        box-shadow: 4px 0 16px rgba(0,0,0,0.25);
    }
    .sidebar.show {
        transform: translateX(0) !important;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 1040;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
    .topbar {
        padding: .75rem 1rem;
    }
    .topbar h5 {
        font-size: 1rem;
        max-width: 55vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .page-content {
        padding: 1rem;
    }
    .card-panel {
        padding: 1rem;
    }
    .stat-card {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.35rem;
    }
    .login-card {
        padding: 1.75rem 1.25rem;
        margin: 1rem;
    }
}

@media (max-width: 575.98px) {
    .topbar-user .badge {
        font-size: .65rem;
    }
    h5 { font-size: 1rem; }
    h6 { font-size: .95rem; }
}

/* -------- Cards / stats -------- */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 4px solid var(--qp-primary);
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--qp-primary-dark);
}
.stat-card .stat-label {
    color: var(--qp-text-muted);
    font-size: .85rem;
}

.card-panel {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.table thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--qp-text-muted);
    border-bottom-width: 1px;
}

.badge-status-draft { background:#9ca3af; }
.badge-status-sent { background:#3b82f6; }
.badge-status-approved { background:#22c55e; }
.badge-status-rejected { background:#ef4444; }

#itemsTable input, #itemsTable select {
    min-width: 90px;
}
.item-remove-btn {
    cursor: pointer;
}

@media print {
    .no-print { display: none !important; }
    .page-content { padding: 0; }
}
